[llvm] [InferAddressSpaces] apply InferAddressSpaces to inttoptr-zext-ptrtoint address expression. (PR #79108)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 12:01:54 PST 2024
================
@@ -356,8 +384,14 @@ getPointerOperands(const Value &V, const DataLayout &DL,
return {II.getArgOperand(0)};
}
case Instruction::IntToPtr: {
- assert(isNoopPtrIntCastPair(&Op, DL, TTI));
- auto *P2I = cast<Operator>(Op.getOperand(0));
+ assert(isNoopPtrIntCastPair(&Op, DL, TTI) || isZExtPtrIntCastPair(&Op, DL));
+ Operator *P2I;
+ if (isNoopPtrIntCastPair(&Op, DL, TTI)) {
+ P2I = cast<Operator>(Op.getOperand(0));
+ } else {
+ auto *ZExt = cast<Operator>(Op.getOperand(0));
+ P2I = cast<Operator>(ZExt->getOperand(0));
+ }
----------------
arichardson wrote:
If you return a `Value*`/`Operator*` this could be simplified
```suggestion
Operator *P2I = getNoopOrExtPtrIntCastPair(&Op, DL, TTI)
assert(P2I != nullptr);
```
https://github.com/llvm/llvm-project/pull/79108
More information about the llvm-commits
mailing list