From: Evan Cheng Date: Sat, 25 Oct 2008 23:49:39 +0000 (+0000) Subject: Handle cases where there aren't uses in the barrier mbb. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=79d5b5acaec05cf2caba02ed023427da959e0b11;p=oota-llvm.git Handle cases where there aren't uses in the barrier mbb. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58174 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/PreAllocSplitting.cpp b/lib/CodeGen/PreAllocSplitting.cpp index 1b2b635f393..456be09ecd3 100644 --- a/lib/CodeGen/PreAllocSplitting.cpp +++ b/lib/CodeGen/PreAllocSplitting.cpp @@ -457,8 +457,12 @@ PreAllocSplitting::ShrinkWrapLiveInterval(VNInfo *ValNo, DefMI->eraseFromParent(); CurrLI->removeRange(ValNo->def, LIs->getMBBEndIdx(MBB)+1); } + } else if (MBB == BarrierMBB) { + // Remove entire live range from start of mbb to barrier. + CurrLI->removeRange(LIs->getMBBStartIdx(MBB), + LIs->getUseIndex(BarrierIdx)+1); } else { - // Remove entire live range of the bb out of the live interval. + // Remove entire live range of the mbb out of the live interval. CurrLI->removeRange(LIs->getMBBStartIdx(MBB), LIs->getMBBEndIdx(MBB)+1); } diff --git a/test/CodeGen/X86/pre-split5.ll b/test/CodeGen/X86/pre-split5.ll new file mode 100644 index 00000000000..d3538250b3c --- /dev/null +++ b/test/CodeGen/X86/pre-split5.ll @@ -0,0 +1,56 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -pre-alloc-split + +target triple = "i386-apple-darwin9.5" + %struct.FILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, %struct.__sFILEX*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64 } + %struct.__sFILEX = type opaque + %struct.__sbuf = type { i8*, i32 } +@"\01LC1" = external constant [48 x i8] ; <[48 x i8]*> [#uses=1] + +define i32 @main() nounwind { +entry: + br label %bb5.us + +bb5.us: ; preds = %bb8.split, %bb5.us, %entry + %i.0.reg2mem.0.ph = phi i32 [ 0, %entry ], [ %indvar.next53, %bb8.split ], [ %i.0.reg2mem.0.ph, %bb5.us ] ; [#uses=2] + %j.0.reg2mem.0.us = phi i32 [ %indvar.next47, %bb5.us ], [ 0, %bb8.split ], [ 0, %entry ] ; [#uses=1] + %indvar.next47 = add i32 %j.0.reg2mem.0.us, 1 ; [#uses=2] + %exitcond48 = icmp eq i32 %indvar.next47, 256 ; [#uses=1] + br i1 %exitcond48, label %bb8.split, label %bb5.us + +bb8.split: ; preds = %bb5.us + %indvar.next53 = add i32 %i.0.reg2mem.0.ph, 1 ; [#uses=2] + %exitcond54 = icmp eq i32 %indvar.next53, 256 ; [#uses=1] + br i1 %exitcond54, label %bb11, label %bb5.us + +bb11: ; preds = %bb11, %bb8.split + %i.1.reg2mem.0 = phi i32 [ %indvar.next44, %bb11 ], [ 0, %bb8.split ] ; [#uses=1] + %indvar.next44 = add i32 %i.1.reg2mem.0, 1 ; [#uses=2] + %exitcond45 = icmp eq i32 %indvar.next44, 63 ; [#uses=1] + br i1 %exitcond45, label %bb14, label %bb11 + +bb14: ; preds = %bb14, %bb11 + %indvar = phi i32 [ %indvar.next40, %bb14 ], [ 0, %bb11 ] ; [#uses=1] + %indvar.next40 = add i32 %indvar, 1 ; [#uses=2] + %exitcond41 = icmp eq i32 %indvar.next40, 32768 ; [#uses=1] + br i1 %exitcond41, label %bb28, label %bb14 + +bb28: ; preds = %bb14 + %0 = fdiv double 2.550000e+02, 0.000000e+00 ; [#uses=1] + br label %bb30 + +bb30: ; preds = %bb36, %bb28 + %m.1.reg2mem.0 = phi i32 [ %m.0, %bb36 ], [ 0, %bb28 ] ; [#uses=1] + %1 = mul double 0.000000e+00, %0 ; [#uses=1] + %2 = fptosi double %1 to i32 ; [#uses=1] + br i1 false, label %bb36, label %bb35 + +bb35: ; preds = %bb30 + %3 = tail call i32 (%struct.FILE*, i8*, ...)* @fprintf(%struct.FILE* null, i8* getelementptr ([48 x i8]* @"\01LC1", i32 0, i32 0), i32 0, i32 0, i32 0, i32 %2) nounwind ; [#uses=0] + br label %bb36 + +bb36: ; preds = %bb35, %bb30 + %m.0 = phi i32 [ 0, %bb35 ], [ %m.1.reg2mem.0, %bb30 ] ; [#uses=1] + br label %bb30 +} + +declare i32 @fprintf(%struct.FILE*, i8*, ...) nounwind