[PATCH] D106289: [InstCombine] Fold phi ( inttoptr/ptrtoint x ) to phi (x)
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 2 21:20:55 PDT 2021
aqjune added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp:307
+ // Check if all uses of phi are ptr2int.
+ for (User *U : PN.users()) {
+ if (!dyn_cast<PtrToIntInst>(U)) {
----------------
Perhaps there was llvm::all_of that can take this loop body as lambda. Let's use it to simplify this further.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp:1329
+ foldPHIArgIntToPtrToPHI(PN);
+
----------------
I think you'll need to return &PN if it was updated:
```
if (foldPHIArgIntToPtrToPHI(PN))
return &PN;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106289/new/
https://reviews.llvm.org/D106289
More information about the llvm-commits
mailing list