diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-08-05 07:10:38 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-08-05 07:10:38 +0000 |
commit | eed97ef5d0254bc5e89ef434c4e4857922fbc3d1 (patch) | |
tree | 94e567665996f8e6df723b3e45c51c789b7cc0c6 | |
parent | 7a5d914f5c4e8860dfa5c68c156e560d1fa38fea (diff) | |
download | external_llvm-eed97ef5d0254bc5e89ef434c4e4857922fbc3d1.zip external_llvm-eed97ef5d0254bc5e89ef434c4e4857922fbc3d1.tar.gz external_llvm-eed97ef5d0254bc5e89ef434c4e4857922fbc3d1.tar.bz2 |
Fix PR2568: Fix bug that cause redudant kill marker after its live interval has been extended due to coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54346 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SimpleRegisterCoalescing.cpp | 4 | ||||
-rw-r--r-- | test/CodeGen/X86/2008-08-05-SpillerBug.ll | 44 |
2 files changed, 47 insertions, 1 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index 68be3e1..9cb06ce 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -533,14 +533,16 @@ void SimpleRegisterCoalescing::RemoveUnnecessaryKills(unsigned Reg, MachineOperand &UseMO = UI.getOperand(); if (UseMO.isKill()) { MachineInstr *UseMI = UseMO.getParent(); +#if 0 unsigned SReg, DReg; if (!tii_->isMoveInstr(*UseMI, SReg, DReg)) continue; +#endif unsigned UseIdx = li_->getUseIndex(li_->getInstructionIndex(UseMI)); if (JoinedCopies.count(UseMI)) continue; const LiveRange *UI = LI.getLiveRangeContaining(UseIdx); - if (!LI.isKill(UI->valno, UseIdx+1)) + if (!UI || !LI.isKill(UI->valno, UseIdx+1)) UseMO.setIsKill(false); } } diff --git a/test/CodeGen/X86/2008-08-05-SpillerBug.ll b/test/CodeGen/X86/2008-08-05-SpillerBug.ll new file mode 100644 index 0000000..ca42f2b --- /dev/null +++ b/test/CodeGen/X86/2008-08-05-SpillerBug.ll @@ -0,0 +1,44 @@ +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -disable-fp-elim -stats -info-output-file - | not grep {Number of dead stores elided} +; PR2568 + +@g_3 = external global i16 ; <i16*> [#uses=1] +@g_5 = external global i32 ; <i32*> [#uses=3] + +declare i32 @func_15(i16 signext , i16 signext , i32) nounwind + +define void @func_9_entry_2E_ce(i8 %p_11) nounwind { +newFuncRoot: + br label %entry.ce + +entry.ce.ret.exitStub: ; preds = %entry.ce + ret void + +entry.ce: ; preds = %newFuncRoot + load i16* @g_3, align 2 ; <i16>:0 [#uses=1] + icmp sgt i16 %0, 0 ; <i1>:1 [#uses=1] + zext i1 %1 to i32 ; <i32>:2 [#uses=1] + load i32* @g_5, align 4 ; <i32>:3 [#uses=4] + icmp ugt i32 %2, %3 ; <i1>:4 [#uses=1] + zext i1 %4 to i32 ; <i32>:5 [#uses=1] + icmp eq i32 %3, 0 ; <i1>:6 [#uses=1] + %.0 = select i1 %6, i32 1, i32 %3 ; <i32> [#uses=1] + urem i32 1, %.0 ; <i32>:7 [#uses=2] + sext i8 %p_11 to i16 ; <i16>:8 [#uses=1] + trunc i32 %3 to i16 ; <i16>:9 [#uses=1] + tail call i32 @func_15( i16 signext %8, i16 signext %9, i32 1 ) nounwind ; <i32>:10 [#uses=0] + load i32* @g_5, align 4 ; <i32>:11 [#uses=1] + trunc i32 %11 to i16 ; <i16>:12 [#uses=1] + tail call i32 @func_15( i16 signext %12, i16 signext 1, i32 %7 ) nounwind ; <i32>:13 [#uses=0] + sext i8 %p_11 to i32 ; <i32>:14 [#uses=1] + %p_11.lobit = lshr i8 %p_11, 7 ; <i8> [#uses=1] + %tmp = zext i8 %p_11.lobit to i32 ; <i32> [#uses=1] + %tmp.not = xor i32 %tmp, 1 ; <i32> [#uses=1] + %.015 = ashr i32 %14, %tmp.not ; <i32> [#uses=2] + icmp eq i32 %.015, 0 ; <i1>:15 [#uses=1] + %.016 = select i1 %15, i32 1, i32 %.015 ; <i32> [#uses=1] + udiv i32 %7, %.016 ; <i32>:16 [#uses=1] + icmp ult i32 %5, %16 ; <i1>:17 [#uses=1] + zext i1 %17 to i32 ; <i32>:18 [#uses=1] + store i32 %18, i32* @g_5, align 4 + br label %entry.ce.ret.exitStub +} |