@@ -240,7 +240,8 @@ class InferAddressSpacesImpl {
240
240
SmallVectorImpl<const Use *> *PoisonUsesToFix) const ;
241
241
unsigned joinAddressSpaces (unsigned AS1, unsigned AS2) const ;
242
242
243
- unsigned getPredicatedAddrSpace (const Value &V, Value *Opnd) const ;
243
+ unsigned getPredicatedAddrSpace (const Value &PtrV,
244
+ const Instruction *UserCtxI) const ;
244
245
245
246
public:
246
247
InferAddressSpacesImpl (AssumptionCache &AC, const DominatorTree *DT,
@@ -909,18 +910,14 @@ void InferAddressSpacesImpl::inferAddressSpaces(
909
910
}
910
911
}
911
912
912
- unsigned InferAddressSpacesImpl::getPredicatedAddrSpace (const Value &V,
913
- Value *Opnd) const {
914
- const Instruction *I = dyn_cast<Instruction>(&V);
915
- if (!I)
916
- return UninitializedAddressSpace;
917
-
918
- Opnd = Opnd->stripInBoundsOffsets ();
919
- for (auto &AssumeVH : AC.assumptionsFor (Opnd)) {
913
+ unsigned InferAddressSpacesImpl::getPredicatedAddrSpace (
914
+ const Value &Ptr , const Instruction *UserCtxI) const {
915
+ const Value *StrippedPtr = Ptr .stripInBoundsOffsets ();
916
+ for (auto &AssumeVH : AC.assumptionsFor (StrippedPtr)) {
920
917
if (!AssumeVH)
921
918
continue ;
922
919
CallInst *CI = cast<CallInst>(AssumeVH);
923
- if (!isValidAssumeForContext (CI, I , DT))
920
+ if (!isValidAssumeForContext (CI, UserCtxI , DT))
924
921
continue ;
925
922
926
923
const Value *Ptr ;
@@ -989,7 +986,8 @@ bool InferAddressSpacesImpl::updateAddressSpace(
989
986
OperandAS = PtrOperand->getType ()->getPointerAddressSpace ();
990
987
if (OperandAS == FlatAddrSpace) {
991
988
// Check AC for assumption dominating V.
992
- unsigned AS = getPredicatedAddrSpace (V, PtrOperand);
989
+ unsigned AS =
990
+ getPredicatedAddrSpace (*PtrOperand, &cast<Instruction>(V));
993
991
if (AS != UninitializedAddressSpace) {
994
992
LLVM_DEBUG (dbgs ()
995
993
<< " deduce operand AS from the predicate addrspace "
0 commit comments