1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

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
This commit is contained in:
Eric Christopher 2010-03-27 01:54:00 +00:00
parent 3f00f8044f
commit cf18deaea3

View File

@ -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());
}
}