[llvm-commits] [llvm] r75159 - in /llvm/trunk: include/llvm/IntrinsicInst.h lib/Transforms/Scalar/InstructionCombining.cpp

Owen Anderson resistor at mac.com
Thu Jul 9 11:36:21 PDT 2009


Author: resistor
Date: Thu Jul  9 13:36:20 2009
New Revision: 75159

URL: http://llvm.org/viewvc/llvm-project?rev=75159&view=rev
Log:
A little bit more LLVMContextification.

Modified:
    llvm/trunk/include/llvm/IntrinsicInst.h
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/include/llvm/IntrinsicInst.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicInst.h?rev=75159&r1=75158&r2=75159&view=diff

==============================================================================
--- llvm/trunk/include/llvm/IntrinsicInst.h (original)
+++ llvm/trunk/include/llvm/IntrinsicInst.h Thu Jul  9 13:36:20 2009
@@ -202,9 +202,13 @@
              "setLength called with value of wrong type!");
       setOperand(3, L);
     }
-    void setAlignment(unsigned A) {
-      const Type *Int32Ty = getOperand(4)->getType();
-      setOperand(4, ConstantInt::get(Int32Ty, A));
+    
+    void setAlignment(Constant* A) {
+      setOperand(4, A);
+    }
+    
+    const Type *getAlignmentType() const {
+      return getOperand(4)->getType();
     }
     
     // Methods for support type inquiry through isa, cast, and dyn_cast:

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=75159&r1=75158&r2=75159&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Jul  9 13:36:20 2009
@@ -9694,7 +9694,8 @@
   unsigned CopyAlign = MI->getAlignment();
 
   if (CopyAlign < MinAlign) {
-    MI->setAlignment(MinAlign);
+    MI->setAlignment(Context->getConstantInt(MI->getAlignmentType(), 
+                                             MinAlign, false));
     return MI;
   }
   
@@ -9768,7 +9769,8 @@
 Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) {
   unsigned Alignment = GetOrEnforceKnownAlignment(MI->getDest());
   if (MI->getAlignment() < Alignment) {
-    MI->setAlignment(Alignment);
+    MI->setAlignment(Context->getConstantInt(MI->getAlignmentType(),
+                                             Alignment, false));
     return MI;
   }
   





More information about the llvm-commits mailing list