Lines Matching +full:isa +full:- +full:base

1 //===- LoopUnrollAnalyzer.cpp - Unrolling Effect Estimation -----*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
29 /// address (i.e. SCEVUnknown) - in this case we compute the offset and save
30 /// it along with the base address instead.
32 if (!SE.isSCEVable(I->getType()))
37 SimplifiedValues[I] = SC->getValue();
43 if (!IterationNumber->isZero() && SE.isLoopInvariant(S, L))
47 if (!AR || AR->getLoop() != L)
50 const SCEV *ValueAtIteration = AR->evaluateAtIteration(IterationNumber, SE);
53 SimplifiedValues[I] = SC->getValue();
57 // Check if the offset from the base address becomes a constant.
58 auto *Base = dyn_cast<SCEVUnknown>(SE.getPointerBase(S));
59 if (!Base)
62 dyn_cast<SCEVConstant>(SE.getMinusSCEV(ValueAtIteration, Base));
66 Address.Base = Base->getValue();
67 Address.Offset = Offset->getValue();
79 if (!isa<Constant>(LHS))
82 if (!isa<Constant>(RHS))
90 simplifyBinOp(I.getOpcode(), LHS, RHS, FI->getFastMathFlags(), DL);
98 return Base::visitBinaryOperator(I);
108 ConstantInt *SimplifiedAddrOp = AddressIt->second.Offset;
110 auto *GV = dyn_cast<GlobalVariable>(AddressIt->second.Base);
113 if (!GV || !GV->hasDefinitiveInitializer() || !GV->isConstant())
117 dyn_cast<ConstantDataSequential>(GV->getInitializer());
124 if (CDS->getElementType() != I.getType())
127 unsigned ElemSize = CDS->getElementType()->getPrimitiveSizeInBits() / 8U;
128 if (SimplifiedAddrOp->getValue().getActiveBits() > 64)
130 int64_t SimplifiedAddrOpV = SimplifiedAddrOp->getSExtValue();
137 if (Index >= CDS->getNumElements()) {
143 Constant *CV = CDS->getElementAsConstant(Index);
167 return Base::visitCastInst(I);
175 if (!isa<Constant>(LHS))
178 if (!isa<Constant>(RHS))
182 if (!isa<Constant>(LHS) && !isa<Constant>(RHS)) {
187 SimplifiedAddress &LHSAddr = SimplifiedLHS->second;
188 SimplifiedAddress &RHSAddr = SimplifiedRHS->second;
189 if (LHSAddr.Base == RHSAddr.Base) {
203 return Base::visitCmpInst(I);
207 // Run base visitor first. This way we can gather some useful for later
209 if (Base::visitPHINode(PN))
213 return PN.getParent() == L->getHeader();