summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp5
-rw-r--r--llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp4
-rw-r--r--llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp6
-rw-r--r--llvm/lib/Transforms/Scalar/SROA.cpp7
4 files changed, 8 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 40e52ee755e..31dea892178 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -190,7 +190,7 @@ Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) {
unsigned CopyAlign = MI->getAlignment();
if (CopyAlign < MinAlign) {
- MI->setAlignment(ConstantInt::get(MI->getAlignmentType(), MinAlign, false));
+ MI->setAlignment(MinAlign);
return MI;
}
@@ -265,8 +265,7 @@ Instruction *InstCombiner::SimplifyMemTransfer(MemIntrinsic *MI) {
Instruction *InstCombiner::SimplifyMemSet(MemSetInst *MI) {
unsigned Alignment = getKnownAlignment(MI->getDest(), DL, MI, &AC, &DT);
if (MI->getAlignment() < Alignment) {
- MI->setAlignment(ConstantInt::get(MI->getAlignmentType(),
- Alignment, false));
+ MI->setAlignment(Alignment);
return MI;
}
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index 09bcbb28265..5f6fa65abd1 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -1385,10 +1385,10 @@ void DFSanVisitor::visitMemTransferInst(MemTransferInst &I) {
Value *AlignShadow;
if (ClPreserveAlignment) {
AlignShadow = IRB.CreateMul(I.getAlignmentCst(),
- ConstantInt::get(I.getAlignmentCst()->getType(),
+ ConstantInt::get(I.getAlignmentType(),
DFSF.DFS.ShadowWidth / 8));
} else {
- AlignShadow = ConstantInt::get(I.getAlignmentCst()->getType(),
+ AlignShadow = ConstantInt::get(I.getAlignmentType(),
DFSF.DFS.ShadowWidth / 8);
}
Type *Int8Ptr = Type::getInt8PtrTy(*DFSF.DFS.Ctx);
diff --git a/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp b/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
index 99480f12da9..6c871bb9e7e 100644
--- a/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
+++ b/llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
@@ -374,8 +374,7 @@ bool AlignmentFromAssumptionsPass::processAssumption(CallInst *ACall) {
NewAlignment = std::max(NewAlignment, AltSrcAlignment);
if (NewAlignment > MI->getAlignment()) {
- MI->setAlignment(ConstantInt::get(Type::getInt32Ty(
- MI->getParent()->getContext()), NewAlignment));
+ MI->setAlignment(NewAlignment);
++NumMemIntAlignChanged;
}
@@ -385,8 +384,7 @@ bool AlignmentFromAssumptionsPass::processAssumption(CallInst *ACall) {
assert((!isa<MemIntrinsic>(MI) || isa<MemSetInst>(MI)) &&
"Unknown memory intrinsic");
- MI->setAlignment(ConstantInt::get(Type::getInt32Ty(
- MI->getParent()->getContext()), NewDestAlignment));
+ MI->setAlignment(NewDestAlignment);
++NumMemIntAlignChanged;
}
}
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index bfe3754f076..5a543c652b2 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -2684,8 +2684,7 @@ private:
assert(!IsSplit);
assert(NewBeginOffset == BeginOffset);
II.setDest(getNewAllocaSlicePtr(IRB, OldPtr->getType()));
- Type *CstTy = II.getAlignmentCst()->getType();
- II.setAlignment(ConstantInt::get(CstTy, getSliceAlign()));
+ II.setAlignment(getSliceAlign());
deleteIfTriviallyDead(OldPtr);
return false;
@@ -2807,9 +2806,7 @@ private:
II.setSource(AdjustedPtr);
if (II.getAlignment() > SliceAlign) {
- Type *CstTy = II.getAlignmentCst()->getType();
- II.setAlignment(
- ConstantInt::get(CstTy, MinAlign(II.getAlignment(), SliceAlign)));
+ II.setAlignment(MinAlign(II.getAlignment(), SliceAlign));
}
DEBUG(dbgs() << " to: " << II << "\n");
OpenPOWER on IntegriCloud