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

Benjamin Kramer benny.kra at googlemail.com
Sun Aug 16 04:56:43 PDT 2009


Author: d0k
Date: Sun Aug 16 06:56:42 2009
New Revision: 79189

URL: http://llvm.org/viewvc/llvm-project?rev=79189&view=rev
Log:
Fix use after free in Thumb2SizeReduction (PR4707). A MachineInstr was used after erasure.

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=79189&r1=79188&r2=79189&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp (original)
+++ llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Sun Aug 16 06:56:42 2009
@@ -654,8 +654,11 @@
       }
 
       // Try to transform ro a 16-bit non-two-address instruction.
-      if (Entry.NarrowOpc1 && ReduceToNarrow(MBB, MI, Entry, LiveCPSR))
+      if (Entry.NarrowOpc1 && ReduceToNarrow(MBB, MI, Entry, LiveCPSR)) {
         Modified = true;
+        MachineBasicBlock::iterator I = prior(NextMII);
+        MI = &*I;
+      }
     }
 
   ProcessNext:





More information about the llvm-commits mailing list