[llvm-commits] [llvm] r56199 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/ARM/2008-09-14-CoaleserBug.ll

Evan Cheng evan.cheng at apple.com
Sun Sep 14 23:28:42 PDT 2008


Author: evancheng
Date: Mon Sep 15 01:28:41 2008
New Revision: 56199

URL: http://llvm.org/viewvc/llvm-project?rev=56199&view=rev
Log:
Correctly update kill infos after extending a live range and merge 2 val#'s; fix 56165 - do not mark val# copy field if the copy does not define the val#.

Added:
    llvm/trunk/test/CodeGen/ARM/2008-09-14-CoaleserBug.ll
Modified:
    llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp

Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56199&r1=56198&r2=56199&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Sep 15 01:28:41 2008
@@ -182,16 +182,20 @@
   }
 
   // Okay, merge "B1" into the same value number as "B0".
-  if (BValNo != ValLR->valno)
+  if (BValNo != ValLR->valno) {
+    IntB.addKills(ValLR->valno, BValNo->kills);
     IntB.MergeValueNumberInto(BValNo, ValLR->valno);
+  }
   DOUT << "   result = "; IntB.print(DOUT, tri_);
   DOUT << "\n";
 
   // If the source instruction was killing the source register before the
   // merge, unset the isKill marker given the live range has been extended.
   int UIdx = ValLREndInst->findRegisterUseOperandIdx(IntB.reg, true);
-  if (UIdx != -1)
+  if (UIdx != -1) {
     ValLREndInst->getOperand(UIdx).setIsKill(false);
+    IntB.removeKill(ValLR->valno, FillerStart);
+  }
 
   ++numExtends;
   return true;
@@ -568,7 +572,8 @@
       LiveInterval &LI = li_->getInterval(CopyDstReg);
       unsigned DefIdx = li_->getDefIndex(li_->getInstructionIndex(UseMI));
       const LiveRange *DLR = LI.getLiveRangeContaining(DefIdx);
-      DLR->valno->copy = UseMI;
+      if (DLR->valno->def == DefIdx)
+        DLR->valno->copy = UseMI;
     }
   }
 }

Added: llvm/trunk/test/CodeGen/ARM/2008-09-14-CoaleserBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2008-09-14-CoaleserBug.ll?rev=56199&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2008-09-14-CoaleserBug.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/2008-09-14-CoaleserBug.ll Mon Sep 15 01:28:41 2008
@@ -0,0 +1,29 @@
+; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin
+
+@"\01LC1" = external constant [288 x i8]		; <[288 x i8]*> [#uses=1]
+
+declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
+
+define i32 @main(i32 %argc, i8** %argv) nounwind {
+entry:
+	br label %bb.i
+
+bb.i:		; preds = %bb.i, %entry
+	%i.01.i = phi i32 [ 0, %entry ], [ %indvar.next52, %bb.i ]		; <i32> [#uses=1]
+	%indvar.next52 = add i32 %i.01.i, 1		; <i32> [#uses=2]
+	%exitcond53 = icmp eq i32 %indvar.next52, 15		; <i1> [#uses=1]
+	br i1 %exitcond53, label %bb.i33.loopexit, label %bb.i
+
+bb.i33.loopexit:		; preds = %bb.i
+	%0 = malloc [347 x i8]		; <[347 x i8]*> [#uses=2]
+	%.sub = getelementptr [347 x i8]* %0, i32 0, i32 0		; <i8*> [#uses=1]
+	call void @llvm.memcpy.i32( i8* %.sub, i8* getelementptr ([288 x i8]* @"\01LC1", i32 0, i32 0), i32 287, i32 1 ) nounwind
+	br label %bb.i28
+
+bb.i28:		; preds = %bb.i28, %bb.i33.loopexit
+	br i1 false, label %repeat_fasta.exit, label %bb.i28
+
+repeat_fasta.exit:		; preds = %bb.i28
+	free [347 x i8]* %0
+	unreachable
+}





More information about the llvm-commits mailing list