[llvm] [InferAddressSpaces] apply InferAddressSpaces to inttoptr-zext-ptrtoint address expression. (PR #79108)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 17:41:03 PST 2024
================
@@ -356,9 +384,15 @@ 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));
- return {P2I->getOperand(0)};
+ assert(isNoopPtrIntCastPair(&Op, DL, TTI) || isZExtPtrIntCastPair(&Op, DL));
+ if (isNoopPtrIntCastPair(&Op, DL, TTI)) {
+ auto *P2I = cast<Operator>(Op.getOperand(0));
+ return {P2I->getOperand(0)};
+ } else {
+ auto *ZExt = cast<Operator>(Op.getOperand(0));
+ auto *P2I = dyn_cast<Operator>(ZExt->getOperand(0));
----------------
arsenm wrote:
Unchecked dyn_cast, just use cast<>
https://github.com/llvm/llvm-project/pull/79108
More information about the llvm-commits
mailing list