mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145810 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user