summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-07-28 21:38:51 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-07-28 21:38:51 +0000
commitf6c690019b7ba9d121e658d16b9d99831df7428f (patch)
tree9a2fa1cfed5dbbd1f600c3e2518dc7d6381f343f
parent43afb6ff1cf7b040e2d70abb47679e1357a329d5 (diff)
downloadllvm-f6c690019b7ba9d121e658d16b9d99831df7428f.tar.gz
llvm-f6c690019b7ba9d121e658d16b9d99831df7428f.tar.bz2
llvm-f6c690019b7ba9d121e658d16b9d99831df7428f.tar.xz
Handle REG_SEQUENCE with implicitly defined operands.
Code like that would only be produced by bugpoint, but we should still handle it correctly. When a register is defined by a REG_SEQUENCE of undefs, the register itself is undef. Previously, we would create a register with uses but no defs. Fixes part of PR10520. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136401 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/ProcessImplicitDefs.cpp6
-rw-r--r--test/CodeGen/ARM/crash.ll21
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/CodeGen/ProcessImplicitDefs.cpp b/lib/CodeGen/ProcessImplicitDefs.cpp
index c04d65637c..b1d8c97602 100644
--- a/lib/CodeGen/ProcessImplicitDefs.cpp
+++ b/lib/CodeGen/ProcessImplicitDefs.cpp
@@ -125,8 +125,14 @@ bool ProcessImplicitDefs::runOnMachineFunction(MachineFunction &fn) {
LiveVariables::VarInfo& vi = LV->getVarInfo(MO.getReg());
vi.removeKill(MI);
}
+ unsigned Reg = MI->getOperand(0).getReg();
MI->eraseFromParent();
Changed = true;
+
+ // A REG_SEQUENCE may have been expanded into partial definitions.
+ // If this was the last one, mark Reg as implicitly defined.
+ if (TargetRegisterInfo::isVirtualRegister(Reg) && MRI->def_empty(Reg))
+ ImpDefRegs.insert(Reg);
continue;
}
}
diff --git a/test/CodeGen/ARM/crash.ll b/test/CodeGen/ARM/crash.ll
index 4b6876df4a..5ecfe15511 100644
--- a/test/CodeGen/ARM/crash.ll
+++ b/test/CodeGen/ARM/crash.ll
@@ -27,3 +27,24 @@ bb3:
exit:
ret void
}
+
+; PR10520 - REG_SEQUENCE with implicit-def operands.
+define arm_aapcs_vfpcc void @foo() nounwind align 2 {
+bb:
+ %tmp = shufflevector <2 x i64> undef, <2 x i64> undef, <1 x i32> <i32 1>
+ %tmp8 = bitcast <1 x i64> %tmp to <2 x float>
+ %tmp9 = shufflevector <2 x float> %tmp8, <2 x float> %tmp8, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
+ %tmp10 = fmul <4 x float> undef, %tmp9
+ %tmp11 = fadd <4 x float> %tmp10, undef
+ %tmp12 = fadd <4 x float> undef, %tmp11
+ %tmp13 = bitcast <4 x float> %tmp12 to i128
+ %tmp14 = bitcast i128 %tmp13 to <4 x float>
+ %tmp15 = bitcast <4 x float> %tmp14 to i128
+ %tmp16 = bitcast i128 %tmp15 to <4 x float>
+ %tmp17 = bitcast <4 x float> %tmp16 to i128
+ %tmp18 = bitcast i128 %tmp17 to <4 x float>
+ %tmp19 = bitcast <4 x float> %tmp18 to i128
+ %tmp20 = bitcast i128 %tmp19 to <4 x float>
+ store <4 x float> %tmp20, <4 x float>* undef, align 16
+ ret void
+}