[llvm-commits] [llvm] r124713 - /llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp

Dan Gohman gohman at apple.com
Tue Feb 1 18:05:46 PST 2011


Author: djg
Date: Tue Feb  1 20:05:46 2011
New Revision: 124713

URL: http://llvm.org/viewvc/llvm-project?rev=124713&view=rev
Log:
Conservatively, clear optional flags, such as nsw, when performing
reassociation. No testcase, because I wasn't able to create a testcase
which actually demonstrates a problem.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=124713&r1=124712&r2=124713&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Feb  1 20:05:46 2011
@@ -157,6 +157,9 @@
           // It simplifies to V.  Form "A op V".
           I.setOperand(0, A);
           I.setOperand(1, V);
+          // Conservatively clear the optional flags, since they may not be
+          // preserved by the reassociation.
+          I.clearSubclassOptionalData();
           Changed = true;
           ++NumReassoc;
           continue;
@@ -174,6 +177,9 @@
           // It simplifies to V.  Form "V op C".
           I.setOperand(0, V);
           I.setOperand(1, C);
+          // Conservatively clear the optional flags, since they may not be
+          // preserved by the reassociation.
+          I.clearSubclassOptionalData();
           Changed = true;
           ++NumReassoc;
           continue;
@@ -193,6 +199,9 @@
           // It simplifies to V.  Form "V op B".
           I.setOperand(0, V);
           I.setOperand(1, B);
+          // Conservatively clear the optional flags, since they may not be
+          // preserved by the reassociation.
+          I.clearSubclassOptionalData();
           Changed = true;
           ++NumReassoc;
           continue;
@@ -210,6 +219,9 @@
           // It simplifies to V.  Form "B op V".
           I.setOperand(0, B);
           I.setOperand(1, V);
+          // Conservatively clear the optional flags, since they may not be
+          // preserved by the reassociation.
+          I.clearSubclassOptionalData();
           Changed = true;
           ++NumReassoc;
           continue;
@@ -234,6 +246,9 @@
         Worklist.Add(New);
         I.setOperand(0, New);
         I.setOperand(1, Folded);
+        // Conservatively clear the optional flags, since they may not be
+        // preserved by the reassociation.
+        I.clearSubclassOptionalData();
         Changed = true;
         continue;
       }





More information about the llvm-commits mailing list