summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorManuel Jacob <me@manueljacob.de>2016-01-21 06:31:08 +0000
committerManuel Jacob <me@manueljacob.de>2016-01-21 06:31:08 +0000
commit925d029461972b44eec4a69a61014b7646a52f3b (patch)
tree06257a67b44d52628b587eed58e21ef1b8369611 /llvm/lib/CodeGen
parenta61ca37b6dd94cf956d75356d8d1fe6a81a234ae (diff)
downloadbcm5719-llvm-925d029461972b44eec4a69a61014b7646a52f3b.tar.gz
bcm5719-llvm-925d029461972b44eec4a69a61014b7646a52f3b.zip
Introduce ConstantFoldCastOperand function and migrate some callers of ConstantFoldInstOperands to use it. NFC.
Summary: Although this is a slight cleanup on its own, the main motivation is to refactor the constant folding API to ease migration to opaque pointers. This will be follow-up work. Reviewers: eddyb Subscribers: zzheng, dblaikie, llvm-commits Differential Revision: http://reviews.llvm.org/D16380 llvm-svn: 258390
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index f6604f38722..0170236553e 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -895,17 +895,17 @@ static bool CanShareConstantPoolEntry(const Constant *A, const Constant *B,
// the constant folding APIs to do this so that we get the benefit of
// DataLayout.
if (isa<PointerType>(A->getType()))
- A = ConstantFoldInstOperands(Instruction::PtrToInt, IntTy,
- const_cast<Constant *>(A), DL);
+ A = ConstantFoldCastOperand(Instruction::PtrToInt,
+ const_cast<Constant *>(A), IntTy, DL);
else if (A->getType() != IntTy)
- A = ConstantFoldInstOperands(Instruction::BitCast, IntTy,
- const_cast<Constant *>(A), DL);
+ A = ConstantFoldCastOperand(Instruction::BitCast, const_cast<Constant *>(A),
+ IntTy, DL);
if (isa<PointerType>(B->getType()))
- B = ConstantFoldInstOperands(Instruction::PtrToInt, IntTy,
- const_cast<Constant *>(B), DL);
+ B = ConstantFoldCastOperand(Instruction::PtrToInt,
+ const_cast<Constant *>(B), IntTy, DL);
else if (B->getType() != IntTy)
- B = ConstantFoldInstOperands(Instruction::BitCast, IntTy,
- const_cast<Constant *>(B), DL);
+ B = ConstantFoldCastOperand(Instruction::BitCast, const_cast<Constant *>(B),
+ IntTy, DL);
return A == B;
}
OpenPOWER on IntegriCloud