diff options
author | Duncan Sands <baldrick@free.fr> | 2012-10-30 16:03:32 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2012-10-30 16:03:32 +0000 |
commit | 446cf94cdbbc1f8e22452fc46664ac73d810c6a2 (patch) | |
tree | 81ecaa52ec11d25214b1ee28cfafa3543fddc94e /lib/VMCore/ConstantFold.cpp | |
parent | 92b469971e6125e1aae90c43e0f00a5cb1e88b47 (diff) |
Fix isEliminableCastPair to work correctly in the presence of pointers
with different sizes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167018 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 60cd3fbe22..fe3edac42e 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -87,9 +87,13 @@ foldConstantCastPair( Instruction::CastOps firstOp = Instruction::CastOps(Op->getOpcode()); Instruction::CastOps secondOp = Instruction::CastOps(opc); + // Assume that pointers are never more than 64 bits wide. + IntegerType *FakeIntPtrTy = Type::getInt64Ty(DstTy->getContext()); + // Let CastInst::isEliminableCastPair do the heavy lifting. return CastInst::isEliminableCastPair(firstOp, secondOp, SrcTy, MidTy, DstTy, - Type::getInt64Ty(DstTy->getContext())); + FakeIntPtrTy, FakeIntPtrTy, + FakeIntPtrTy); } static Constant *FoldBitCast(Constant *V, Type *DestTy) { |