aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index c5c2a5e3c5..3697b2a514 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -5437,6 +5437,28 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
} else {
switch (II->getIntrinsicID()) {
default: break;
+ case Intrinsic::ppc_altivec_lvx:
+ case Intrinsic::ppc_altivec_lvxl:
+ // Turn lvx -> load if the pointer is known aligned.
+ if (GetKnownAlignment(II->getOperand(1), TD) >= 16) {
+ Instruction *Ptr = new CastInst(II->getOperand(1),
+ PointerType::get(II->getType()), "tmp");
+ InsertNewInstBefore(Ptr, CI);
+ return new LoadInst(Ptr);
+ }
+ break;
+ case Intrinsic::ppc_altivec_stvx:
+ case Intrinsic::ppc_altivec_stvxl:
+ // Turn stvx -> store if the pointer is known aligned.
+ if (GetKnownAlignment(II->getOperand(2), TD) >= 16) {
+ const Type *OpTy = II->getOperand(1)->getType();
+ Instruction *Ptr = new CastInst(II->getOperand(2),
+ PointerType::get(OpTy), "tmp");
+ InsertNewInstBefore(Ptr, CI);
+ return new StoreInst(II->getOperand(1), Ptr);
+ }
+ break;
+
case Intrinsic::stackrestore: {
// If the save is right next to the restore, remove the restore. This can
// happen when variable allocas are DCE'd.