[PATCH] D105002: [InferAddressSpaces] NFC: Check type before casting operands to PtrToIntInst
Reshabh Sharma via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 28 06:06:54 PDT 2021
rksharma added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp:473
if (isNoopPtrIntCastPair(cast<Operator>(I2P), *DL, TTI))
- PushPtrOperand(
- cast<PtrToIntInst>(I2P->getOperand(0))->getPointerOperand());
+ if (PtrToIntInst *P2I = dyn_cast<PtrToIntInst>(I2P->getOperand(0)))
+ PushPtrOperand(P2I->getPointerOperand());
----------------
arsenm wrote:
> Can't you access the operator operand anyway and still handle constant expressions?
Are you saying something like,
```
PushPtrOperand(cast<Operator>(I2P->getOperand(0))->getOperand(0));
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105002/new/
https://reviews.llvm.org/D105002
More information about the llvm-commits
mailing list