[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 06:36:47 PDT 2021
aqjune added a comment.
I left a few nitpicks that is probably worth addressed
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp:306
+ // convert ptr2int ( phi[ int2ptr(ptr2int(x))] ) --> ptr2int ( phi [ x ] )
+ if (!PN.hasOneUse())
+ return nullptr;
----------------
You can do this folding when PN has multiple uses all of which are ptrtoint as well.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp:334
+ PN.getIncomingBlock(OpNum));
+ }
+ PHIArgMergedDebugLoc(NewPtrPhi, PN);
----------------
Is there a reason why a new phi is created?
Would replacing the corresponding op with the optimized pointer be enough?
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