-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Description
Note: Error could only be reproduced on M1 Mac, not intel mac, appears to be M1 MacOS or arm64 specific
LLVM ERROR when trying to run llc on this .ll
file with optimization level -O1
or higher:
declare void @raise (i32)
declare void @abort ()
declare i64 @calloc (i64, i64)define i32 @_c0_main () {
dummy_entry__c0_main:
br label %entry__c0_main
entry__c0_main:
%t44 = bitcast i32 1 to i32
%t211 = icmp slt i32 %t44, 0
br i1 %t211, label %MEM, label %.L14
.L14:
%t45 = sext i32 %t44 to i64
%t46 = mul i64 4, %t45
%t47 = add i64 8, %t46
%t49 = bitcast i64 1 to i64
%t52 = call i64 @calloc (i64 %t47, i64 %t49)
%t196 = icmp eq i64 %t52, 0
br i1 %t196, label %MEM, label %.L15
.L15:
%t217 = inttoptr i64 %t52 to i64*
store i64 %t45, i64* %t217
%t53 = add i64 8, %t52
%t54 = bitcast i64 %t53 to i64
br label %.L1
.L1:
%t55 = bitcast i32 2 to i32
%t56 = bitcast i32 3 to i32
%t218 = icmp slt i32 %t55, %t56
br i1 %t218, label %.L3, label %.L4
.L4:
%t83 = bitcast i32 0 to i32
ret i32 %t83
.L3:
%t110 = bitcast i32 4 to i32
%t111 = bitcast i32 5 to i32
%t198 = icmp eq i32 %t110, %t111
br i1 %t198, label %.L8, label %.L9
.L8:
br label %.L5
.L5:
%t145 = bitcast i32 8 to i32
br label %.L10
.L10:
%t146 = bitcast i32 %t145 to i32
%t147 = bitcast i32 9 to i32
%t194 = icmp slt i32 %t146, %t147
br i1 %t194, label %.L12, label %.L13
.L12:
%t157 = phi i32 [ %t145, %.L10 ], [ %t168, %.L11 ]
%t202 = icmp eq i64 %t54, 0
br i1 %t202, label %MEM, label %.L21
.L21:
%t161 = add i64 %t54, -8
%t209 = inttoptr i64 %t161 to i32*
%t162 = load i32, i32* %t209
%t210 = icmp slt i32 %t157, 0
br i1 %t210, label %MEM, label %.L19
.L19:
%t212 = icmp sge i32 %t157, %t162
br i1 %t212, label %MEM, label %.L20
.L20:
%t163 = sext i32 %t157 to i64
%t213 = mul i64 %t163, 4
%t214 = add i64 %t54, %t213
%t215 = add i64 0, %t214
%t165 = bitcast i32 10 to i32
%t216 = inttoptr i64 %t215 to i32*
store i32 %t165, i32* %t216
%t167 = bitcast i32 1 to i32
%t168 = add i32 %t157, %t167
br label %.L11
.L11:
%t170 = bitcast i32 9 to i32
%t197 = icmp slt i32 %t168, %t170
br i1 %t197, label %.L12, label %.L13
.L13:
br label %.L7
.L7:
br label %.L2
.L2:
%t134 = bitcast i32 2 to i32
%t135 = bitcast i32 3 to i32
%t195 = icmp slt i32 %t134, %t135
br i1 %t195, label %.L3, label %.L4
.L9:
%t183 = bitcast i32 6 to i32
%t208 = icmp eq i64 %t54, 0
br i1 %t208, label %MEM, label %.L18
.L18:
%t184 = add i64 %t54, -8
%t199 = inttoptr i64 %t184 to i32*
%t185 = load i32, i32* %t199
%t200 = icmp slt i32 %t183, 0
br i1 %t200, label %MEM, label %.L16
.L16:
%t201 = icmp sge i32 %t183, %t185
br i1 %t201, label %MEM, label %.L17
.L17:
%t186 = sext i32 %t183 to i64
%t203 = mul i64 %t186, 4
%t204 = add i64 %t54, %t203
%t205 = add i64 0, %t204
%t206 = inttoptr i64 %t205 to i32*
%t189 = load i32, i32* %t206
%t191 = bitcast i32 7 to i32
%t207 = icmp slt i32 %t189, %t191
br i1 %t207, label %.L5, label %.L6
.L6:
br label %.L7
MEM:
%t193 = bitcast i32 12 to i32
call void @raise (i32 %t193)
br label %MEM
}
What I wrote into the terminal:
brew install llvm
sudo nano /etc/paths
- pasted
/opt/homebrew/opt/llvm/bin
into path and restarted terminal - saved the
.ll
file listed in the "what are you trying to do" section into a known directory
llc -O1 <file path to .ll file>
Stack dump:
Invalid bitcast
%t319.old = bitcast i64 %7 to i32
Invalid bitcast
%t319 = bitcast i64 %40 to i32
in function _c0_perceptron
LLVM ERROR: Broken function found, compilation aborted!
PLEASE submit a bug report to https://github.com/Homebrew/homebrew-core/issues and include the crash backtrace.
Stack dump:
0. Program arguments: llc -O1 ./tests/test_llc.l4.ll
1. Running pass 'Function Pass Manager' on module './tests/test_llc.l4.ll'.
2. Running pass 'Module Verifier' on function '@_c0_perceptron'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 libLLVM.dylib 0x000000010af63cfc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 libLLVM.dylib 0x000000010eda817c SignalHandler(int) + 304
2 libsystem_platform.dylib 0x0000000189f1f4a4 _sigtramp + 56
3 libsystem_pthread.dylib 0x0000000189f07ee0 pthread_kill + 288
4 libsystem_c.dylib 0x0000000189e42340 abort + 168
5 libLLVM.dylib 0x000000010ae9c1b0 llvm::report_fatal_error(llvm::Twine const&, bool) + 336
6 libLLVM.dylib 0x000000010ed98310 llvm::report_fatal_error(llvm::StringRef, bool) + 0
7 libLLVM.dylib 0x000000010b1ce6b0 llvm::cl::opt<bool, false, llvm::cl::parser<bool>>::opt<char [30], llvm::cl::OptionHidden, llvm::cl::initializer<bool>, llvm::cl::desc>(char const (&) [30], llvm::cl::OptionHidden const&, llvm::cl::initializer<bool> const&, llvm::cl::desc const&) + 0
8 libLLVM.dylib 0x000000010b11d7dc llvm::FPPassManager::runOnModule(llvm::Module&) + 2548
9 libLLVM.dylib 0x000000010b111ff0 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1284
10 llc 0x00000001024794dc compileModule(char**, llvm::LLVMContext&) + 6200
11 llc 0x0000000102477664 main + 1352
12 dyld 0x00000001027c908c start + 520
zsh: abort llc -O1 ./tests/test_llc.l4.ll
brew config:
HOMEBREW_VERSION: 4.0.16
ORIGIN: https://github.com/Homebrew/brew
HEAD: 01e0c20d01c6aab28d844280d130f0e745e2ddd9
Last commit: 2 days ago
Core tap JSON: 02 May 18:13 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.KzUViLrq6L/org.xquartz:0
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.10 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.37.1 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.79.1 => /usr/bin/curl
macOS: 12.4-arm64
CLT: 14.2.0.0.1.1668646533
Xcode: N/A
Rosetta 2: false