Fix for pr2093: direct operands aren't necessarily addresses, so don't
try to simplify them.
llvm-svn: 47610
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index e6f7283..15ccbbd 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -970,7 +970,8 @@
// Compute the constraint code and ConstraintType to use.
OpInfo.ComputeConstraintToUse(*TLI);
- if (OpInfo.ConstraintType == TargetLowering::C_Memory) {
+ if (OpInfo.ConstraintType == TargetLowering::C_Memory &&
+ OpInfo.isIndirect) {
Value *OpVal = OpInfo.CallOperandVal;
MadeChange |= OptimizeLoadStoreInst(I, OpVal, OpVal->getType(),
SunkAddrs);