[llvm-commits] [llvm] r146805 - in /llvm/trunk: lib/Target/ARM/Thumb2SizeReduction.cpp test/CodeGen/Thumb2/2011-12-16-T2SizeReduceAssert.ll

Evan Cheng evan.cheng at apple.com
Fri Dec 16 17:25:34 PST 2011


Author: evancheng
Date: Fri Dec 16 19:25:34 2011
New Revision: 146805

URL: http://llvm.org/viewvc/llvm-project?rev=146805&view=rev
Log:
Fix a CPSR liveness tracking bug introduced when I converted IT block to bundle.

Added:
    llvm/trunk/test/CodeGen/Thumb2/2011-12-16-T2SizeReduceAssert.ll
Modified:
    llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp

Modified: llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp?rev=146805&r1=146804&r2=146805&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp (original)
+++ llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Fri Dec 16 19:25:34 2011
@@ -880,14 +880,17 @@
     }
 
   ProcessNext:
-    if (LiveCPSR &&
-        NextMII != E && MI->isInsideBundle() && !NextMII->isInsideBundle() &&
-        BundleMI->killsRegister(ARM::CPSR))
+    if (NextMII != E && MI->isInsideBundle() && !NextMII->isInsideBundle()) {
       // FIXME: Since post-ra scheduler operates on bundles, the CPSR kill
       // marker is only on the BUNDLE instruction. Process the BUNDLE
       // instruction as we finish with the bundled instruction to work around
       // the inconsistency.
-      LiveCPSR = false;
+      if (BundleMI->killsRegister(ARM::CPSR))
+        LiveCPSR = false;
+      MachineOperand *MO = BundleMI->findRegisterDefOperand(ARM::CPSR);
+      if (MO && !MO->isDead())
+        LiveCPSR = true;
+    }
 
     bool DefCPSR = false;
     LiveCPSR = UpdateCPSRDef(*MI, LiveCPSR, DefCPSR);

Added: llvm/trunk/test/CodeGen/Thumb2/2011-12-16-T2SizeReduceAssert.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/2011-12-16-T2SizeReduceAssert.ll?rev=146805&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb2/2011-12-16-T2SizeReduceAssert.ll (added)
+++ llvm/trunk/test/CodeGen/Thumb2/2011-12-16-T2SizeReduceAssert.ll Fri Dec 16 19:25:34 2011
@@ -0,0 +1,28 @@
+; RUN: llc < %s -mtriple=thumbv7-apple-ios -relocation-model=pic -disable-fp-elim -mcpu=cortex-a8 
+
+%struct.LIST_NODE.0.16 = type { %struct.LIST_NODE.0.16*, i8* }
+
+define %struct.LIST_NODE.0.16* @list_AssocListPair(%struct.LIST_NODE.0.16* %List, i8* %Key) nounwind readonly {
+entry:
+  br label %bb3
+
+bb:                                               ; preds = %bb3
+  %Scan.0.idx7.val = load i8** undef, align 4
+  %.idx = getelementptr i8* %Scan.0.idx7.val, i32 4
+  %0 = bitcast i8* %.idx to i8**
+  %.idx.val = load i8** %0, align 4
+  %1 = icmp eq i8* %.idx.val, %Key
+  br i1 %1, label %bb5, label %bb2
+
+bb2:                                              ; preds = %bb
+  %Scan.0.idx8.val = load %struct.LIST_NODE.0.16** undef, align 4
+  br label %bb3
+
+bb3:                                              ; preds = %bb2, %entry
+  %Scan.0 = phi %struct.LIST_NODE.0.16* [ %List, %entry ], [ %Scan.0.idx8.val, %bb2 ]
+  %2 = icmp eq %struct.LIST_NODE.0.16* %Scan.0, null
+  br i1 %2, label %bb5, label %bb
+
+bb5:                                              ; preds = %bb3, %bb
+  ret %struct.LIST_NODE.0.16* null
+}





More information about the llvm-commits mailing list