aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO/ArgumentPromotion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/IPO/ArgumentPromotion.cpp')
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index 00b147e885..40a87e880d 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -687,7 +687,11 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
Ops.clear();
AA.copyValue(OrigLoad->getOperand(0), V);
}
- Args.push_back(new LoadInst(V, V->getName()+".val", Call));
+ // 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);
+ newLoad->setAlignment(OrigLoad->getAlignment());
+ Args.push_back(newLoad);
AA.copyValue(OrigLoad, Args.back());
}
}