summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2010-03-27 01:54:00 +0000
committerEric Christopher <echristo@apple.com>2010-03-27 01:54:00 +0000
commit81c03447fc6358197258903e3fc6ee65b16ee768 (patch)
treecd511c942243716994587f9f8d81810ea216774e /llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
parent6888e798d3b1c5bb36e8b962058168e17cf730a3 (diff)
downloadbcm5719-llvm-81c03447fc6358197258903e3fc6ee65b16ee768.tar.gz
bcm5719-llvm-81c03447fc6358197258903e3fc6ee65b16ee768.zip
When we promote a load of an argument make sure to take the alignment
of the previous load - it's usually important. For example, we don't want to blindly turn an unaligned load into an aligned one. llvm-svn: 99699
Diffstat (limited to 'llvm/lib/Transforms/IPO/ArgumentPromotion.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/ArgumentPromotion.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index 00b147e8851..40a87e880d7 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/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());
}
}
OpenPOWER on IntegriCloud