summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-08 01:30:07 +0000
committerChris Lattner <sabre@nondot.org>2004-08-08 01:30:07 +0000
commit68392422e6f2176b5dc686332a6dd4a69b87f83b (patch)
treeffe4e0c8677d760b0878aefcfd882392c9d6aca3 /lib/Transforms
parent5e2e27284bd838af61453571e3989230e675b66f (diff)
downloadllvm-68392422e6f2176b5dc686332a6dd4a69b87f83b.tar.gz
llvm-68392422e6f2176b5dc686332a6dd4a69b87f83b.tar.bz2
llvm-68392422e6f2176b5dc686332a6dd4a69b87f83b.tar.xz
Two fixes:
1. Fix a REALLY nasty cyclic replacement issue that Anshu discovered, causing nondeterminstic crashes and memory corruption. 2. For performance, don't go inserting constantexpr casts of GV pointers. This should definitely go into 1.3 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15568 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index 0f80c2f8bb..a657f023df 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -151,7 +151,7 @@ bool llvm::ExpressionConvertibleToType(Value *V, const Type *Ty,
// If it's a constant... all constants can be converted to a different
// type.
//
- if (Constant *CPV = dyn_cast<Constant>(V))
+ if (isa<Constant>(V) && !isa<GlobalValue>(V))
return true;
CTMap[V] = Ty;
@@ -984,10 +984,9 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
unsigned OtherIdx = (OldVal == I->getOperand(0)) ? 1 : 0;
Value *OtherOp = I->getOperand(OtherIdx);
+ Res->setOperand(!OtherIdx, NewVal);
Value *NewOther = ConvertExpressionToType(OtherOp, NewTy, VMC, TD);
-
Res->setOperand(OtherIdx, NewOther);
- Res->setOperand(!OtherIdx, NewVal);
break;
}
case Instruction::Shl: