Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions llvm/lib/Transforms/Scalar/LICM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ bool llvm::hoistRegion(DomTreeNode *N, AAResults *AA, LoopInfo *LI,
// invariant.start has no uses.
static bool isLoadInvariantInLoop(LoadInst *LI, DominatorTree *DT,
Loop *CurLoop) {
Value *Addr = LI->getOperand(0);
Value *Addr = LI->getPointerOperand();
const DataLayout &DL = LI->getModule()->getDataLayout();
const TypeSize LocSizeInBits = DL.getTypeSizeInBits(LI->getType());

Expand All @@ -1055,21 +1055,6 @@ static bool isLoadInvariantInLoop(LoadInst *LI, DominatorTree *DT,
if (LocSizeInBits.isScalable())
return false;

// if the type is ptr addrspace(x), we know this is the type of
// llvm.invariant.start operand
auto *PtrASXTy = PointerType::get(LI->getContext(),
LI->getPointerAddressSpace());
unsigned BitcastsVisited = 0;
// Look through bitcasts until we reach the PtrASXTy type (this is
// invariant.start operand type).
// FIXME: We shouldn't really find such bitcasts with opaque pointers.
while (Addr->getType() != PtrASXTy) {
auto *BC = dyn_cast<BitCastInst>(Addr);
// Avoid traversing high number of bitcast uses.
if (++BitcastsVisited > MaxNumUsesTraversed || !BC)
return false;
Addr = BC->getOperand(0);
}
// If we've ended up at a global/constant, bail. We shouldn't be looking at
// uselists for non-local Values in a loop pass.
if (isa<Constant>(Addr))
Expand Down