Compile long double a; fn1() { long double _Complex b = a = b * 1.0L; } with -O2 -g -target sparc64 and watch it assert due to oversized debug fragments. This is fallout from r289266.
Assertion failed: (FragmentOffset >= OffsetInBits && "overlapping or duplicate fragments"), function addFragmentOffset, file /Volumes/Fusion/Data/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp, line 405. Reproduced.
define signext i32 @fn1() local_unnamed_addr #0 !dbg !11 { entry: tail call void @llvm.dbg.declare(metadata { fp128, fp128 }* undef, metadata !16, metadata !DIExpression()), !dbg !18 store fp128 fmul (fp128 undef, fp128 0xL00000000000000003FFF000000000000), fp128* @a, align 16, !dbg !19, !tbaa !20 tail call void @llvm.dbg.value(metadata fp128 fmul (fp128 undef, fp128 0xL00000000000000003FFF000000000000), metadata !16, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 128)), !dbg !18 tail call void @llvm.dbg.value(metadata fp128 0xL00000000000000000000000000000000, metadata !16, metadata !DIExpression(DW_OP_LLVM_fragment, 128, 128)), !dbg !18 ret i32 undef, !dbg !24 }
looks like DwarfExpression::addMachineReg is misbehaving.
Yes, I think it gets confused by Q0 being aliased to two 64bit registers, which in turn have two 32bit register aliases each.
Should be fixed in r311951.
Confirmed. Should be merged into 5.0 or 5.0.1.
That's a safe change to pick up.
(In reply to Adrian Prantl from comment #7) > That's a safe change to pick up. When I merge r311951 to the branch, the test asserts as shown below. Since we're so late in the process (and if the original failure started with r289266 it's not technically a regression from 4.0.0), I don't think we shuold attempt to merge it for 5.0.0. [70/71] Running the LLVM regression tests FAIL: LLVM :: DebugInfo/Sparc/subreg.ll (13449 of 21471) ******************** TEST 'LLVM :: DebugInfo/Sparc/subreg.ll' FAILED ******************** Script: -- /work/llvm-5.0/build.release/./bin/llc -filetype=obj -O0 < /usr/local/google/work/llvm-5.0/llvm.src/test/DebugInfo/Sparc/subreg.ll -mtriple sparc64-unknown-linux-gnu | /work/llvm-5.0/build.release/./bin/llvm-dwarfdump - | /work/llvm-5.0/build.release/./bin/FileCheck /usr/local/google/work/llvm-5.0/llvm.src/test/DebugInfo/Sparc/subreg.ll -- Exit Code: 2 Command Output (stderr): -- Intrinsic has incorrect argument type! void (metadata, metadata, metadata)* @llvm.dbg.value llc: /work/llvm-5.0/llvm.src/include/llvm/IR/Instructions.h:1572: llvm::Value* llvm::CallInst::getArgOperand(unsigned int) const: Assertion `i < getNumArgOperands() && "Out of bounds!"' failed. #0 0x0000000001d6122a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/work/llvm-5.0/build.release/./bin/llc+0x1d6122a) #1 0x0000000001d5f2de llvm::sys::RunSignalHandlers() (/work/llvm-5.0/build.release/./bin/llc+0x1d5f2de) #2 0x0000000001d5f442 SignalHandler(int) (/work/llvm-5.0/build.release/./bin/llc+0x1d5f442) #3 0x00007fc498303330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330) #4 0x00007fc4970f3c37 gsignal /build/eglibc-SvCtMH/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0 #5 0x00007fc4970f7028 abort /build/eglibc-SvCtMH/eglibc-2.19/stdlib/abort.c:91:0 #6 0x00007fc4970ecbf6 __assert_fail_base /build/eglibc-SvCtMH/eglibc-2.19/assert/assert.c:92:0 #7 0x00007fc4970ecca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2) #8 0x00000000006c743e llvm::OperandBundleUser<llvm::CallInst, llvm::Use*>::getOperandBundleAt(unsigned int) const [clone .part.1004] (/work/llvm-5.0/build.release/./bin/llc+0x6c743e) #9 0x00000000018c5121 llvm::DbgValueInst::getRawExpression() const (/work/llvm-5.0/build.release/./bin/llc+0x18c5121) #10 0x00000000018d4db3 (anonymous namespace)::Verifier::visitInstruction(llvm::Instruction&) (/work/llvm-5.0/build.release/./bin/llc+0x18d4db3) #11 0x00000000018d83a0 (anonymous namespace)::Verifier::verifyCallSite(llvm::CallSite) (/work/llvm-5.0/build.release/./bin/llc+0x18d83a0) #12 0x00000000018da9f0 (anonymous namespace)::Verifier::visitCallInst(llvm::CallInst&) (/work/llvm-5.0/build.release/./bin/llc+0x18da9f0) #13 0x00000000018dd070 (anonymous namespace)::Verifier::verify(llvm::Function const&) (/work/llvm-5.0/build.release/./bin/llc+0x18dd070) #14 0x00000000018dde44 llvm::verifyModule(llvm::Module const&, llvm::raw_ostream*, bool*) (/work/llvm-5.0/build.release/./bin/llc+0x18dde44) #15 0x000000000077a5b0 compileModule(char**, llvm::LLVMContext&) (/work/llvm-5.0/build.release/./bin/llc+0x77a5b0) #16 0x000000000071649c main (/work/llvm-5.0/build.release/./bin/llc+0x71649c) #17 0x00007fc4970def45 __libc_start_main /build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:321:0 #18 0x000000000076faaa _start (/work/llvm-5.0/build.release/./bin/llc+0x76faaa) Stack dump: 0. Program arguments: /work/llvm-5.0/build.release/./bin/llc -filetype=obj -O0 -mtriple sparc64-unknown-linux-gnu -: The file was not recognized as a valid object file FileCheck error: '-' is empty. FileCheck command line: /work/llvm-5.0/build.release/./bin/FileCheck /usr/local/google/work/llvm-5.0/llvm.src/test/DebugInfo/Sparc/subreg.ll --
Looks like the IR in the test is too new for the 5.0 branch. Jörg, how important is this fix for you? Do you want to try and backport the test to 5.0?
I've adjusted the test case in 312038.
*** Bug 35344 has been marked as a duplicate of this bug. ***