aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-07-31 02:47:24 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-07-31 02:47:24 +0000
commit34af6f597b09c13fba7d3a1960c0810cfc30beff (patch)
treebfeb206153b9f5675d4caf81c23f18528e4c92ba
parent11236143173d1aedeace570ac1133d3d5dfb268e (diff)
Clear kill flags in removeCopyByCommutingDef().
We are extending live ranges, so kill flags are not accurate. They aren't needed until they are recomputed after RA anyway. <rdar://problem/11950722> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161023 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/RegisterCoalescer.cpp2
-rw-r--r--test/CodeGen/ARM/crash-greedy.ll46
2 files changed, 48 insertions, 0 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp
index 733312fbd0..349fcde5ef 100644
--- a/lib/CodeGen/RegisterCoalescer.cpp
+++ b/lib/CodeGen/RegisterCoalescer.cpp
@@ -657,6 +657,8 @@ bool RegisterCoalescer::removeCopyByCommutingDef(const CoalescerPair &CP,
LiveInterval::iterator ULR = IntA.FindLiveRangeContaining(UseIdx);
if (ULR == IntA.end() || ULR->valno != AValNo)
continue;
+ // Kill flags are no longer accurate. They are recomputed after RA.
+ UseMO.setIsKill(false);
if (TargetRegisterInfo::isPhysicalRegister(NewReg))
UseMO.substPhysReg(NewReg, *TRI);
else
diff --git a/test/CodeGen/ARM/crash-greedy.ll b/test/CodeGen/ARM/crash-greedy.ll
index 8a865e23d0..a3d49f620e 100644
--- a/test/CodeGen/ARM/crash-greedy.ll
+++ b/test/CodeGen/ARM/crash-greedy.ll
@@ -82,3 +82,49 @@ if.then195: ; preds = %if.then84
if.end251: ; preds = %if.then195, %if.then84, %entry
ret void
}
+
+; Coalescer failure: removeCopyByCommutingDef leaves a bad kill flag
+; behind.
+define void @rdar11950722() nounwind readonly optsize ssp align 2 {
+entry:
+ br i1 undef, label %land.lhs.true7, label %lor.lhs.false.i
+
+lor.lhs.false.i:
+ br i1 undef, label %if.then10.i, label %land.lhs.true7
+
+if.then10.i:
+ %xFlags.1.i = select i1 undef, i32 0, i32 undef
+ br i1 undef, label %land.lhs.true33.i, label %f.exit
+
+land.lhs.true33.i:
+ %and26.i = and i32 %xFlags.1.i, 8
+ %cmp27.i = icmp eq i32 %and26.i, 0
+ %and29.i = and i32 %xFlags.1.i, 2147483645
+ %xFlags.1.and29.i = select i1 %cmp27.i, i32 %xFlags.1.i, i32 %and29.i
+ %and34.i = and i32 %xFlags.1.i, 8
+ %cmp35.i = icmp eq i32 %and34.i, 0
+ %and37.i = and i32 %xFlags.1.i, 2147483645
+ %yFlags.1.and37.i = select i1 %cmp35.i, i32 %xFlags.1.i, i32 %and37.i
+ br label %f.exit
+
+f.exit:
+ %xFlags.3.i = phi i32 [ %xFlags.1.and29.i, %land.lhs.true33.i ], [ %xFlags.1.i, %if.then10.i ]
+ %yFlags.2.i = phi i32 [ %yFlags.1.and37.i, %land.lhs.true33.i ], [ %xFlags.1.i, %if.then10.i ]
+ %cmp40.i = icmp eq i32 %xFlags.3.i, %yFlags.2.i
+ br i1 %cmp40.i, label %land.lhs.true7, label %land.end
+
+land.lhs.true7:
+ br i1 undef, label %land.lhs.true34, label %lor.lhs.false27
+
+lor.lhs.false27:
+ br i1 undef, label %land.lhs.true34, label %land.end
+
+land.lhs.true34:
+ br i1 undef, label %land.end, label %lor.lhs.false44
+
+lor.lhs.false44:
+ ret void
+
+land.end:
+ ret void
+}