summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-18 18:59:44 +0000
committerChris Lattner <sabre@nondot.org>2004-07-18 18:59:44 +0000
commit9db07b9307d7e48001d816af32eaa1db6f17b0b9 (patch)
tree57a095558d779c4ec33e9047c5b11ed2295fb24d /lib/Transforms
parenta51e4f63015b59b05dd0be5a1987bdfd074bb267 (diff)
downloadllvm-9db07b9307d7e48001d816af32eaa1db6f17b0b9.tar.gz
llvm-9db07b9307d7e48001d816af32eaa1db6f17b0b9.tar.bz2
llvm-9db07b9307d7e48001d816af32eaa1db6f17b0b9.tar.xz
Minor cleanup, no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14972 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 6ade82e1bd..d53cdbf87d 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -2456,10 +2456,8 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
bool InstCombiner::transformConstExprCastCall(CallSite CS) {
if (!isa<ConstantExpr>(CS.getCalledValue())) return false;
ConstantExpr *CE = cast<ConstantExpr>(CS.getCalledValue());
- if (CE->getOpcode() != Instruction::Cast ||
- !isa<GlobalValue>(CE->getOperand(0)))
+ if (CE->getOpcode() != Instruction::Cast || !isa<Function>(CE->getOperand(0)))
return false;
- if (!isa<Function>(CE->getOperand(0))) return false;
Function *Callee = cast<Function>(CE->getOperand(0));
Instruction *Caller = CS.getInstruction();
@@ -2809,8 +2807,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
Indices.push_back(cast<Constant>(*I));
if (I == E) { // If they are all constants...
- Constant *CE =
- ConstantExpr::getGetElementPtr(GV, Indices);
+ Constant *CE = ConstantExpr::getGetElementPtr(GV, Indices);
// Replace all uses of the GEP with the new constexpr...
return ReplaceInstUsesWith(GEP, CE);
@@ -2977,8 +2974,6 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
if (Constant *C = dyn_cast<Constant>(Op))
if (C->isNullValue()) // load null -> 0
return ReplaceInstUsesWith(LI, Constant::getNullValue(LI.getType()));
- else if (isa<GlobalValue>(C))
- Op = C;
// Instcombine load (constant global) into the value loaded...
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Op))