mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
Implement a trivial form of store->load forwarding where the store and the
load are exactly consequtive. This is picked up by other passes, but this triggers thousands of times in fortran programs that use static locals (and is thus a compile-time speedup). llvm-svn: 23320
This commit is contained in:
parent
c183614166
commit
2657841260
@ -4925,6 +4925,15 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
|
||||
|
||||
// None of the following transforms are legal for volatile loads.
|
||||
if (LI.isVolatile()) return 0;
|
||||
|
||||
// If the instruction immediately before this is a store to the same address,
|
||||
// do a simple form of store->load forwarding.
|
||||
if (&LI.getParent()->front() != &LI) {
|
||||
BasicBlock::iterator BBI = &LI; --BBI;
|
||||
if (StoreInst *SI = dyn_cast<StoreInst>(BBI))
|
||||
if (SI->getOperand(1) == LI.getOperand(0))
|
||||
return ReplaceInstUsesWith(LI, SI->getOperand(0));
|
||||
}
|
||||
|
||||
if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(Op))
|
||||
if (isa<ConstantPointerNull>(GEPI->getOperand(0)) ||
|
||||
|
Loading…
Reference in New Issue
Block a user