summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/IPO/ArgumentPromotion.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/ArgumentPromotion.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index 8e9520c84a9..13df8280f34 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -263,7 +263,8 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
Value *Idx = GetElementPtrInst::Create(
STy, *AI, Idxs, (*AI)->getName() + "." + Twine(i), Call);
// TODO: Tell AA about the new values?
- Args.push_back(new LoadInst(Idx, Idx->getName() + ".val", Call));
+ Args.push_back(new LoadInst(STy->getElementType(i), Idx,
+ Idx->getName() + ".val", Call));
ArgAttrVec.push_back(AttributeSet());
}
} else if (!I->use_empty()) {
@@ -299,7 +300,8 @@ doPromotion(Function *F, SmallPtrSetImpl<Argument *> &ArgsToPromote,
}
// Since we're replacing a load make sure we take the alignment
// of the previous load.
- LoadInst *newLoad = new LoadInst(V, V->getName() + ".val", Call);
+ LoadInst *newLoad =
+ new LoadInst(OrigLoad->getType(), V, V->getName() + ".val", Call);
newLoad->setAlignment(OrigLoad->getAlignment());
// Transfer the AA info too.
AAMDNodes AAInfo;
OpenPOWER on IntegriCloud