llc assertion failure with COFF target
| Bugzilla Link | 25912 |
| Resolution | FIXED |
| Resolved on | Dec 21, 2015 19:39 |
| Version | trunk |
| OS | Linux |
| CC | @majnemer,@vns-mn,@kcc,@rnk |
Extended Description
pass the following simple ll file to llc, llc will assert. I have not looked at in in details.
; ModuleID = '
@llvm.global_ctors = appending global [1 x { i32, void (), i8 }] [{ i32, void (), i8 } { i32 0, void ()* @__llvm_profile_init, i8* null }]
; Function Attrs: noinline define internal void @__llvm_profile_init() unnamed_addr #1 { ret void }
attributes #0 = { nounwind }
The assertion failure is:
llc: /usr/local/google/davidxl/dev/llvm/include/llvm/Support/Casting.h:237: typename cast_retty<X, Y >::ret_type llvm::cast(Y ) [X = llvm::MCSectionCOFF, Y = llvm::MCSection]: Assertion `isa
Fixed in r256226.
feel free to commit it to bring your bot back: r256225.
FTR, this also seems to crash the sanitizer bootstrap bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/ 10417/steps/check-llvm%20msan/logs/stdio
The following patch seems to fix that test, feel free to commit it to bring your bot back:
diff --git a/test/Instrumentation/InstrProfiling/#23499 .ll b/test/Instrumentation/InstrProfiling/#23499 .ll index d63c01a..d92adf3 100644 --- a/test/Instrumentation/InstrProfiling/#23499 .ll +++ b/test/Instrumentation/InstrProfiling/#23499 .ll @@ -4,7 +4,7 @@
; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S | FileCheck %s ; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s -; RUN: opt < %s -mtriple=x86_64-pc-win64-coff -instrprof -S | FileCheck %s --check-prefix=COFF +; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -instrprof -S | FileCheck %s --check-prefix=COFF
FTR, this also seems to crash the sanitizer bootstrap bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/10417/steps/check-llvm%20msan/logs/stdio
Great. Thanks for fixing the issue (set aside the win32 vs win64 issue, I think the bug itself is still valid -- as elf section should not be created when the specified format is coff).
Because win64 isn't the name of the MSVC environment.
Sorry I am still confused. Is x86_64-pc-win64-coff a valid triple to use?
"x86_64-pc-win64-coff" is a valid triple in the sense that LLVM should be able to successfully parse it into something but the result will not make sense to LLVM. The "win64" component that you are specifying has no meaning to LLVM.
x86_64-pc-win64-coff: valid. we know what CPU and object file is targeted, we don't know what OS environment "win64" means. x86_64-pc-win32-coff: valid. we know what CPU and object file is targeted and we know we are targeting Windows.
Ok -- is there any documentation on that? Should LLVM recognize win64 as windows or there is a reason LLVM can not do that?
We could teach LLVM to recognize win64 but I think it would be a superfluous change, there would be no real benefit that I can see.
I saw one other test case uses this triple: test/CodeGen/X86/statepoint-stackmap-format.ll
Should it be fixed?
Yes, I am working on a patch to fix this crash. The patch will also fix that test case.
I also did not seem to find any test case with xxx-win32-coff combination.
That is because we infer the 'coff' object file format from the rest of the triple, 'win32' cannot natively load anything other than 'coff'.
Because win64 isn't the name of the MSVC environment.
Sorry I am still confused. Is x86_64-pc-win64-coff a valid triple to use?
"x86_64-pc-win64-coff" is a valid triple in the sense that LLVM should be able to successfully parse it into something but the result will not make sense to LLVM. The "win64" component that you are specifying has no meaning to LLVM.
x86_64-pc-win64-coff: valid. we know what CPU and object file is targeted, we don't know what OS environment "win64" means. x86_64-pc-win32-coff: valid. we know what CPU and object file is targeted and we know we are targeting Windows.
Ok -- is there any documentation on that? Should LLVM recognize win64 as windows or there is a reason LLVM can not do that?
I saw one other test case uses this triple: test/CodeGen/X86/statepoint-stackmap-format.ll
Should it be fixed?
I also did not seem to find any test case with xxx-win32-coff combination.
Because win64 isn't the name of the MSVC environment.
Sorry I am still confused. Is x86_64-pc-win64-coff a valid triple to use?
"x86_64-pc-win64-coff" is a valid triple in the sense that LLVM should be able to successfully parse it into something but the result will not make sense to LLVM. The "win64" component that you are specifying has no meaning to LLVM.
x86_64-pc-win64-coff: valid. we know what CPU and object file is targeted, we don't know what OS environment "win64" means. x86_64-pc-win32-coff: valid. we know what CPU and object file is targeted and we know we are targeting Windows.
Because win64 isn't the name of the MSVC environment.
Sorry I am still confused. Is x86_64-pc-win64-coff a valid triple to use?
Because win64 isn't the name of the MSVC environment.
Why can't win64 be used?
StaticCtorSection is created as ELF in
MCObjectFileInfo::InitMCObjectFileInfo because TT.isOSWindows() returns false.
The IL is still legal here, right?
The IR is fine but your triple is wrong. I believe you want x86_64-pc-win32-coff.
StaticCtorSection is created as ELF in
MCObjectFileInfo::InitMCObjectFileInfo because TT.isOSWindows() returns false.
The IL is still legal here, right?
I think so. The logic in MCObjectFileInfo::InitMCObjectFileInfo to find the object format ta use is really suspicious.
StaticCtorSection is created as ELF in
MCObjectFileInfo::InitMCObjectFileInfo because TT.isOSWindows() returns false.
The IL is still legal here, right?
StaticCtorSection is created as ELF in
MCObjectFileInfo::InitMCObjectFileInfo because TT.isOSWindows() returns false.