[PATCH] D37832: Eliminate PHI (int typed) which is only used by inttoptr
David Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 14 21:59:29 PDT 2017
davidxl added a comment.
It does not look like related SROA -- the conversion already exists via stack memory store and load in IR. It looks like related libstdc++'s tuple implementation, though I did not have a small repro -- whether it is from sroa is also irrelevant -- user source can always produce IR like this which needs to be cleaned up or understood (by analysis).
Regarding PR34548, since I can not reproduce it, so I did not really get what the issue is. Can you elaborate why checking deref is needed (which is of course easy to do).
================
Comment at: lib/Transforms/InstCombine/InstCombinePHI.cpp:72
+// int_ptr = BitCast(ptr_ptr)
+// int_init = Load(int_ptr)
+// br label %bb2
----------------
hfinkel wrote:
> I don't understand why you're looking for a load here specifically. It's a good example, because it shows that you might need to look for something here other than a ptrtoint, but that seems to motivate taking a general input (not specifically looking for this load as you do below).
Checking for loads because instcombine can fold the inserted inttoptr away. Same for PHI defs. For other instructions, we are basically just hoisting inttoptr above to the PHI operand, which is unclear it is a win.
https://reviews.llvm.org/D37832
More information about the llvm-commits
mailing list