A little bit more LLVMContextification.
authorOwen Anderson <resistor@mac.com>
Thu, 9 Jul 2009 18:36:20 +0000 (18:36 +0000)
committerOwen Anderson <resistor@mac.com>
Thu, 9 Jul 2009 18:36:20 +0000 (18:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75159 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IntrinsicInst.h
lib/Transforms/Scalar/InstructionCombining.cpp

index 8f5e05f70cd797d9c3a291f48fc11edf5bfaf9c1..b8480551b5987dde9bfa0afc86140ac6dbca52a7 100644 (file)
@@ -202,9 +202,13 @@ namespace llvm {
              "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:
index 01c11ba84088e1635c4b0d5a44826cc92e4c54a9..8d36f74372772407610dea157198056c3a0c972a 100644 (file)
@@ -9694,7 +9694,8 @@ Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) {
   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::SimplifyMemTransfer(MemIntrinsic *MI) {
 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;
   }