summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-12-05 17:23:27 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-12-05 17:23:27 +0000
commit13231037f0e9cc4eeb7f0454c35c9c4100760bac (patch)
tree7f232a6eb23aec6e685e1c30d195f7cbbd638784 /llvm/lib/Transforms/Utils
parent603825163f4633fae22ec048aa6f17e34f8f6323 (diff)
downloadbcm5719-llvm-13231037f0e9cc4eeb7f0454c35c9c4100760bac.tar.gz
bcm5719-llvm-13231037f0e9cc4eeb7f0454c35c9c4100760bac.zip
Add a little heuristic to Value::isUsedInBasicBlock to speed it up for small basic blocks.
- Calling getUser in a loop is much more expensive than iterating over a few instructions. - Use it instead of the open-coded loop in AddrModeMatcher. - 5% speedup on ARMDisassembler.cpp Release builds. llvm-svn: 145810
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/AddrModeMatcher.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp b/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp
index 8e5a1eb2c84..d83145289ce 100644
--- a/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp
+++ b/llvm/lib/Transforms/Utils/AddrModeMatcher.cpp
@@ -473,14 +473,7 @@ bool AddressingModeMatcher::ValueAlreadyLiveAtInst(Value *Val,Value *KnownLive1,
// Check to see if this value is already used in the memory instruction's
// block. If so, it's already live into the block at the very least, so we
// can reasonably fold it.
- BasicBlock *MemBB = MemoryInst->getParent();
- for (Value::use_iterator UI = Val->use_begin(), E = Val->use_end();
- UI != E; ++UI)
- // We know that uses of arguments and instructions have to be instructions.
- if (cast<Instruction>(*UI)->getParent() == MemBB)
- return true;
-
- return false;
+ return Val->isUsedInBasicBlock(MemoryInst->getParent());
}
OpenPOWER on IntegriCloud