aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-22 19:07:21 +0000
committerChris Lattner <sabre@nondot.org>2003-05-22 19:07:21 +0000
commitc54e2b8f84c6ab9a315745cde9de0e1e93308ae0 (patch)
tree26c8255a82090ad446bf78c58f0072d580a1d7bd
parentf69315bd79c3cc8f92f3b003b2cdab57aba3a20e (diff)
downloadexternal_llvm-c54e2b8f84c6ab9a315745cde9de0e1e93308ae0.zip
external_llvm-c54e2b8f84c6ab9a315745cde9de0e1e93308ae0.tar.gz
external_llvm-c54e2b8f84c6ab9a315745cde9de0e1e93308ae0.tar.bz2
Minor cleanups.
This hunk: - } else if (Src->getNumOperands() == 2 && Src->use_size() == 1) { + } else if (Src->getNumOperands() == 2) { Allows GEP folding to be more aggressive, which reduces the number of instructions and can dramatically speed up BasicAA in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6286 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index d73ee1e..7c77a66 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -18,10 +18,7 @@
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/ConstantHandling.h"
-#include "llvm/iMemory.h"
-#include "llvm/iOther.h"
-#include "llvm/iPHINode.h"
-#include "llvm/iOperators.h"
+#include "llvm/Instructions.h"
#include "llvm/Pass.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Support/InstIterator.h"
@@ -941,7 +938,7 @@ Instruction *InstCombiner::visitPHINode(PHINode &PN) {
Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
- // Is it 'getelementptr %P, uint 0' or 'getelementptr %P'
+ // Is it 'getelementptr %P, long 0' or 'getelementptr %P'
// If so, eliminate the noop.
if ((GEP.getNumOperands() == 2 &&
GEP.getOperand(1) == Constant::getNullValue(Type::LongTy)) ||
@@ -956,8 +953,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
std::vector<Value *> Indices;
// Can we combine the two pointer arithmetics offsets?
- if (Src->getNumOperands() == 2 && isa<Constant>(Src->getOperand(1)) &&
- isa<Constant>(GEP.getOperand(1))) {
+ if (Src->getNumOperands() == 2 && isa<Constant>(Src->getOperand(1)) &&
+ isa<Constant>(GEP.getOperand(1))) {
// Replace: gep (gep %P, long C1), long C2, ...
// With: gep %P, long (C1+C2), ...
Value *Sum = *cast<Constant>(Src->getOperand(1)) +
@@ -967,7 +964,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
GEP.setOperand(1, Sum);
AddUsesToWorkList(*Src); // Reduce use count of Src
return &GEP;
- } else if (Src->getNumOperands() == 2 && Src->use_size() == 1) {
+ } else if (Src->getNumOperands() == 2) {
// Replace: gep (gep %P, long B), long A, ...
// With: T = long A+B; gep %P, T, ...
//