http://llvm.org/bugs/show_bug.cgi?id=7982
Summary: Assertion fires when running TwoAddressInstructionPass
more than once
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
I am working on a backend (llc) pass that is to be run shortly before register
allocation. It uses, and makes some last-minute changes to, some of the
analyses used by register allocators. Thus, a number of passes must be run
twice: Once before my pass, then again between my pass and register allocation.
In particular, pass dependences force TwoAddressInstructionPass to run twice
(even if my pass says it will preserve the two-address information).
On the second run on some functions, TwoAddressInstructionPass aborts with this
assertion:
llc: /<...>/TwoAddressInstructionPass.cpp:712:
void<unnamed>::TwoAddressInstructionPass::ProcessCopy(llvm::MachineInstr*,
llvm::MachineBasicBlock*, llvm::SmallPtrSet<llvm::MachineInstr*, 8u>&):
Assertion `SrcRegMap[NewReg] == DstReg && "Can't map to two src physical
registers!"' failed.
To reproduce, apply the following quick-and-dirty changes against trunk to
force TwoAddressInstructionPass to run twice:
Index: lib/CodeGen/LLVMTargetMachine.cpp
===================================================================
--- lib/CodeGen/LLVMTargetMachine.cpp (revision 111910)
+++ lib/CodeGen/LLVMTargetMachine.cpp (working copy)
@@ -387,6 +387,9 @@
if (addPreRegAlloc(PM, OptLevel))
printAndVerify(PM, "After PreRegAlloc passes");
+ extern FunctionPass *createTwoAddressInstructionPass();
+ PM.add(createTwoAddressInstructionPass());
+
// Perform register allocation.
PM.add(createRegisterAllocator(OptLevel));
printAndVerify(PM, "After Register Allocation");
Index: lib/CodeGen/TwoAddressInstructionPass.cpp
===================================================================
--- lib/CodeGen/TwoAddressInstructionPass.cpp (revision 111910)
+++ lib/CodeGen/TwoAddressInstructionPass.cpp (working copy)
@@ -1496,3 +1496,7 @@
RegSequences.clear();
return true;
}
+
+FunctionPass *createTwoAddressInstructionPass() {
+ return new TwoAddressInstructionPass();
+}
Then run:
> llc -march=x86 get_image.ll
on the attached bitcode file get_image.ll (derived from the MiBench suite's
susan benchmark). The second time it is run, TwoAddressInstructionPass will
abort with the above assertion. (The -march=x86 flag is needed for this to
happen.)
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs