change the MemIntrinsic get/setAlignment method to take an unsigned
instead of a Constant*, which is what the clients of it really want.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66364 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 09722d9..86048e6 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -9302,10 +9302,10 @@
   unsigned DstAlign = GetOrEnforceKnownAlignment(MI->getOperand(1));
   unsigned SrcAlign = GetOrEnforceKnownAlignment(MI->getOperand(2));
   unsigned MinAlign = std::min(DstAlign, SrcAlign);
-  unsigned CopyAlign = MI->getAlignment()->getZExtValue();
+  unsigned CopyAlign = MI->getAlignment();
 
   if (CopyAlign < MinAlign) {
-    MI->setAlignment(ConstantInt::get(Type::Int32Ty, MinAlign));
+    MI->setAlignment(MinAlign);
     return MI;
   }
   
@@ -9377,8 +9377,8 @@
 
 Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) {
   unsigned Alignment = GetOrEnforceKnownAlignment(MI->getDest());
-  if (MI->getAlignment()->getZExtValue() < Alignment) {
-    MI->setAlignment(ConstantInt::get(Type::Int32Ty, Alignment));
+  if (MI->getAlignment() < Alignment) {
+    MI->setAlignment(Alignment);
     return MI;
   }
   
@@ -9388,7 +9388,7 @@
   if (!LenC || !FillC || FillC->getType() != Type::Int8Ty)
     return 0;
   uint64_t Len = LenC->getZExtValue();
-  Alignment = MI->getAlignment()->getZExtValue();
+  Alignment = MI->getAlignment();
   
   // If the length is zero, this is a no-op
   if (Len == 0) return MI; // memset(d,c,0,a) -> noop
diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index be9db96..fc9f5f2 100644
--- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -678,13 +678,11 @@
                                  M->getParent()->getParent()->getParent(),
                                  M->getIntrinsicID(), Tys, 1);
     
-  std::vector<Value*> args;
-  args.push_back(M->getRawDest());
-  args.push_back(MDep->getRawSource());
-  args.push_back(M->getLength());
-  args.push_back(M->getAlignment());
+  Value *Args[4] = {
+    M->getRawDest(), MDep->getRawSource(), M->getLength(), M->getAlignmentCst()
+  };
   
-  CallInst* C = CallInst::Create(MemCpyFun, args.begin(), args.end(), "", M);
+  CallInst* C = CallInst::Create(MemCpyFun, Args, Args+4, "", M);
   
   
   // If C and M don't interfere, then this is a valid transformation.  If they
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 351ecea..644625f 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -725,7 +725,7 @@
   // that doesn't have anything to do with the alloca that we are promoting. For
   // memset, this Value* stays null.
   Value *OtherPtr = 0;
-  unsigned MemAlignment = MI->getAlignment()->getZExtValue();
+  unsigned MemAlignment = MI->getAlignment();
   if (MemTransferInst *MTI = dyn_cast<MemTransferInst>(MI)) { // memmove/memcopy
     if (BCInst == MTI->getRawDest())
       OtherPtr = MTI->getRawSource();
@@ -1356,7 +1356,7 @@
         continue;
       }
     }
-
+    
     // Ignore dbg intrinsic.
     if (isa<DbgInfoIntrinsic>(User))
       continue;
@@ -1440,7 +1440,7 @@
       MSI->eraseFromParent();
       continue;
     }
-
+    
     // If user is a dbg info intrinsic then it is safe to remove it.
     if (isa<DbgInfoIntrinsic>(User)) {
       User->eraseFromParent();