[llvm-commits] [llvm] r170395 - /llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Dec 17 16:46:39 PST 2012


Author: stoklund
Date: Mon Dec 17 18:46:39 2012
New Revision: 170395

URL: http://llvm.org/viewvc/llvm-project?rev=170395&view=rev
Log:
Repair bundles that were broken by removing and reinserting the first
instruction.

This isn't strictly necessary at the moment because Thumb2SizeReduction
also copies all MI flags from the old instruction to the new. However, a
future patch will make that kind of direct flag tampering illegal.

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=170395&r1=170394&r2=170395&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp (original)
+++ llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Mon Dec 17 18:46:39 2012
@@ -896,13 +896,20 @@
 
     LiveCPSR = UpdateCPSRUse(*MI, LiveCPSR);
 
+    // Does NextMII belong to the same bundle as MI?
+    bool NextInSameBundle = NextMII != E && NextMII->isBundledWithPred();
+
     if (ReduceMI(MBB, MI, LiveCPSR, CPSRDef, IsSelfLoop)) {
       Modified = true;
       MachineBasicBlock::instr_iterator I = prior(NextMII);
       MI = &*I;
+      // Removing and reinserting the first instruction in a bundle will break
+      // up the bundle. Fix the bundling if it was broken.
+      if (NextInSameBundle && !NextMII->isBundledWithPred())
+        NextMII->bundleWithPred();
     }
 
-    if (NextMII != E && MI->isInsideBundle() && !NextMII->isInsideBundle()) {
+    if (!NextInSameBundle && MI->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





More information about the llvm-commits mailing list