[PATCH] Peephole optimization causes different code generation at "-O2 -g" and "-O2".

Eric Christopher echristo at gmail.com
Thu Feb 13 21:53:55 PST 2014



================
Comment at: lib/CodeGen/PeepholeOptimizer.cpp:598
@@ -596,1 +597,3 @@
 
+      // Skip debug values. They should not effect this peephole optimization.
+      if (MI->isDebugValue())
----------------
"effect" -> "affect"

================
Comment at: lib/CodeGen/PeepholeOptimizer.cpp:641
@@ -635,2 +640,3 @@
         // can enable folding by converting SUB to CMP.
+        unsigned FoldedReg = FoldAsLoadDefReg; // Need this below
         MachineInstr *DefMI = 0;
----------------
Elaborate here.

================
Comment at: lib/CodeGen/PeepholeOptimizer.cpp:659
@@ +658,3 @@
+
+          // Mark any DBG_VALUE that uses FoldReg as undef (but don't 
+          // delete it.)  Code copied from DeadMachineInstructionElim.
----------------
I agree with Manman here on this - is there some more general way of doing this since we'll want to do it across multiple passes I imagine. It needs more comments for sure.


http://llvm-reviews.chandlerc.com/D2728



More information about the llvm-commits mailing list