Skip to content

llc crashes with -tls-load-hoist=true #112771

@abhishek-kaushik22

Description

@abhishek-kaushik22

Godbolt link: https://godbolt.org/z/PPGeo171b
IR reproducer:

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@I58561 = external thread_local global ptr

define i32 @I59676() {
entry:
  %0 = tail call ptr @llvm.threadlocal.address.p0(ptr @I58561)
  %1 = tail call ptr @llvm.threadlocal.address.p0(ptr @I58561)
  ret i32 0
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

; uselistorder directives
uselistorder ptr @llvm.threadlocal.address.p0, { 1, 0 }

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

Stack Dump:

llvm.threadlocal.address first argument must be a GlobalValue
llvm.threadlocal.address first argument must be a GlobalValue
in function I59676
LLVM ERROR: Broken function found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -tls-load-hoist=true <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'Module Verifier' on function '@I59676'
 #0 0x00000000038c64c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/llc+0x38c64c8)
 #1 0x00000000038c40ac SignalHandler(int) Signals.cpp:0:0
 #2 0x00007d9a03242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007d9a032969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007d9a03242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007d9a032287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000000000074fb06 llvm::UniqueStringSaver::save(llvm::Twine const&) (.cold) StringSaver.cpp:0:0
 #7 0x000000000381bd58 (/opt/compiler-explorer/clang-trunk/bin/llc+0x381bd58)
 #8 0x0000000002f84416 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) Verifier.cpp:0:0
 #9 0x0000000002ec42b2 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2ec42b2)
#10 0x0000000002ec4541 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2ec4541)
#11 0x0000000002ec5ee6 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/llc+0x2ec5ee6)
#12 0x0000000000873364 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#13 0x0000000000763cf6 main (/opt/compiler-explorer/clang-trunk/bin/llc+0x763cf6)
#14 0x00007d9a03229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#15 0x00007d9a03229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#16 0x000000000086b10e _start (/opt/compiler-explorer/clang-trunk/bin/llc+0x86b10e)
Program terminated with signal: SIGSEGV
Compiler returned: 139

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvmUmbrella label for LLVM issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions