New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[regression] Assertion `(I.atEnd() || std::next(I) == def_instr_end()) && "getVRegDef assumes a single definition or no definition"' failed #28079
Comments
assigned to @MatzeB |
|
Thanks, looks much nicer now.
So, if I am reading this correctly, the r269016 patch actually uncovered the bug that was already there before but unnoticed? |
While recomputing live ranges does indeed fail because of the pre-existing problem. I believe this was not a problem before because we only computed liveness when coming fresh out of SSA form which mostly a single def per register and all phi inputs having copies in their predecessors. These copies had undef inputs as necessary so there was no problem. The problem only happens after the register coalescer removes some of the useless copies which unfortunately also removes the knowledge about which lanes are undefined at those places. With this patch constructMainRangeFromSubranges() performs liveness calculation after register coalescing which exposed the issues. I will be on vacation for a week starting tomorrow. I will look into the issue after that. If you are blocked feel free to revert r269016 in the meantime. |
Matthias, for I am not getting this error anymore on latest LLVM git. I can bisect if you would like to know what fixed it. |
The commit was reverted in r269344 (thanks Tom) until I have a fix for the problem. That's why you are not seeing the problem anymore right now. This ticket should stay open. |
Fixed in r270259, r270290. Reapplied the original patch in r270291. |
Thanks, it works! |
Extended Description
Compiling https://gist.github.com/vedranmiletic/3a836854abdf13c60db4 like
$ llc -march=amdgcn -mcpu=bonaire < gmx-OpenCL-kernel-AMD.ll
gives
; Kernel info:
; codeLenInByte = 76
; NumSgprs: 14
; NumVgprs: 4
; FloatMode: 192
; IeeeMode: 0
; ScratchSize: 0
; LDSByteSize: 0 bytes/workgroup (compile time only)
; ReservedVGPRFirst: 0
; ReservedVGPRCount: 0
; COMPUTE_PGM_RSRC2:USER_SGPR: 2
; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
llc: /home/vedranm/workspace/llvm/lib/CodeGen/MachineRegisterInfo.cpp:339: llvm::MachineInstr* llvm::MachineRegisterInfo::getVRegDef(unsigned int) const: Assertion `(I.atEnd() || std::next(I) == def_instr_end()) && "getVRegDef assumes a single definition or no definition"' failed.
#0 0x00007ff7d25d97c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/vedranm/workspace/llvm/lib/Support/Unix/Signals.inc:322:0
#1 0x00007ff7d25d9b3f PrintStackTraceSignalHandler(void*) /home/vedranm/workspace/llvm/lib/Support/Unix/Signals.inc:380:0
#2 0x00007ff7d25d82a8 llvm::sys::RunSignalHandlers() /home/vedranm/workspace/llvm/lib/Support/Signals.cpp:44:0
#3 0x00007ff7d25d92ca SignalHandler(int) /home/vedranm/workspace/llvm/lib/Support/Unix/Signals.inc:210:0
#4 0x00007ff7d0fdc180 __restore_rt (/lib64/libc.so.6+0x36180)
#5 0x00007ff7d0fdc0f8 __GI_raise (/lib64/libc.so.6+0x360f8)
#6 0x00007ff7d0fddd0a __GI_abort (/lib64/libc.so.6+0x37d0a)
#7 0x00007ff7d0fd4967 __assert_fail_base (/lib64/libc.so.6+0x2e967)
#8 0x00007ff7d0fd4a12 (/lib64/libc.so.6+0x2ea12)
#9 0x00007ff7d4c6568f llvm::MachineRegisterInfo::getVRegDef(unsigned int) const /home/vedranm/workspace/llvm/lib/CodeGen/MachineRegisterInfo.cpp:338:0
#10 0x00007ff7d4cad20d (anonymous namespace)::MachineVerifier::visitMachineFunctionAfter() /home/vedranm/workspace/llvm/lib/CodeGen/MachineVerifier.cpp:1518:0
#11 0x00007ff7d4ca73b9 (anonymous namespace)::MachineVerifier::verify(llvm::MachineFunction&) /home/vedranm/workspace/llvm/lib/CodeGen/MachineVerifier.cpp:412:0
#12 0x00007ff7d4ca6bb5 llvm::MachineFunction::verify(llvm::Pass*, char const*, bool) const /home/vedranm/workspace/llvm/lib/CodeGen/MachineVerifier.cpp:292:0
#13 0x00007ff7d4b96b6c llvm::LiveRangeCalc::findReachingDefs(llvm::LiveRange&, llvm::MachineBasicBlock&, llvm::SlotIndex, unsigned int) /home/vedranm/workspace/llvm/lib/CodeGen/LiveRangeCalc.cpp:292:0
#14 0x00007ff7d4b96930 llvm::LiveRangeCalc::extend(llvm::LiveRange&, llvm::SlotIndex, unsigned int) /home/vedranm/workspace/llvm/lib/CodeGen/LiveRangeCalc.cpp:255:0
#15 0x00007ff7d4b9656b llvm::LiveRangeCalc::extendToUses(llvm::LiveRange&, unsigned int, unsigned int) /home/vedranm/workspace/llvm/lib/CodeGen/LiveRangeCalc.cpp:208:0
#16 0x00007ff7d4b7a659 llvm::LiveRangeCalc::extendToUses(llvm::LiveRange&, unsigned int) /home/vedranm/workspace/llvm/lib/CodeGen/LiveRangeCalc.h:185:0
#17 0x00007ff7d4b961ca llvm::LiveRangeCalc::constructMainRangeFromSubranges(llvm::LiveInterval&) /home/vedranm/workspace/llvm/lib/CodeGen/LiveRangeCalc.cpp:145:0
#18 0x00007ff7d4b79c9a llvm::LiveIntervals::constructMainRangeFromSubranges(llvm::LiveInterval&) /home/vedranm/workspace/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1593:0
#19 0x00007ff7d4b87e2f llvm::ConnectedSubRegClasses::computeMainRangesFixFlags(llvm::IntEqClasses const&, llvm::SmallVectorImplllvm::ConnectedSubRegClasses::SubRangeInfo const&, llvm::SmallVectorImplllvm::LiveInterval* const&) const /home/vedranm/workspace/llvm/lib/CodeGen/LiveInterval.cpp:1436:0
#20 0x00007ff7d4b86c6d llvm::ConnectedSubRegClasses::renameComponents(llvm::LiveInterval&) const /home/vedranm/workspace/llvm/lib/CodeGen/LiveInterval.cpp:1289:0
#21 0x00007ff7d4b79be7 llvm::LiveIntervals::renameDisconnectedComponents() /home/vedranm/workspace/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1585:0
#22 0x00007ff7d4c6bada llvm::ScheduleDAGMILive::enterRegion(llvm::MachineBasicBlock*, llvm::MachineInstrBundleIteratorllvm::MachineInstr, llvm::MachineInstrBundleIteratorllvm::MachineInstr, unsigned int) /home/vedranm/workspace/llvm/lib/CodeGen/MachineScheduler.cpp:900:0
#23 0x00007ff7d4c69c51 (anonymous namespace)::MachineSchedulerBase::scheduleRegions(llvm::ScheduleDAGInstrs&, bool) /home/vedranm/workspace/llvm/lib/CodeGen/MachineScheduler.cpp:474:0
#24 0x00007ff7d4c69348 (anonymous namespace)::MachineScheduler::runOnMachineFunction(llvm::MachineFunction&) /home/vedranm/workspace/llvm/lib/CodeGen/MachineScheduler.cpp:359:0
#25 0x00007ff7d4c16cac llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/vedranm/workspace/llvm/lib/CodeGen/MachineFunctionPass.cpp:60:0
#26 0x00007ff7d4225159 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/vedranm/workspace/llvm/lib/IR/LegacyPassManager.cpp:1526:0
#27 0x00007ff7d42252d0 llvm::FPPassManager::runOnModule(llvm::Module&) /home/vedranm/workspace/llvm/lib/IR/LegacyPassManager.cpp:1547:0
#28 0x00007ff7d422561d (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/vedranm/workspace/llvm/lib/IR/LegacyPassManager.cpp:1603:0
#29 0x00007ff7d4225cd1 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/vedranm/workspace/llvm/lib/IR/LegacyPassManager.cpp:1706:0
#30 0x00007ff7d4225ec9 llvm::legacy::PassManager::run(llvm::Module&) /home/vedranm/workspace/llvm/lib/IR/LegacyPassManager.cpp:1738:0
#31 0x000000000041d8da compileModule(char**, llvm::LLVMContext&) /home/vedranm/workspace/llvm/tools/llc/llc.cpp:445:0
#32 0x000000000041c3f1 main /home/vedranm/workspace/llvm/tools/llc/llc.cpp:221:0
#33 0x00007ff7d0fc6721 __libc_start_main (/lib64/libc.so.6+0x20721)
#34 0x000000000041ac09 _start (/home/vedranm/workspace/llvm/build/bin/llc+0x41ac09)
Stack dump:
0. Program arguments: ./bin/llc -march=amdgcn -mcpu=bonaire
Aborted (core dumped)
The revision which broke this is:
commit e607e01
Author: Matthias Braun matze@braunis.de
Date: Tue May 10 04:51:14 2016 +0000
The text was updated successfully, but these errors were encountered: