Skip to content

Commit

Permalink
When we promote a load of an argument make sure to take the alignment
Browse files Browse the repository at this point in the history
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
  • Loading branch information
echristo committed Mar 27, 2010
1 parent 6888e79 commit 81c0344
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
Expand Up @@ -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());
}
}
Expand Down

0 comments on commit 81c0344

Please sign in to comment.