[PATCH] D37832: Eliminate PHI (int typed) which is only used by inttoptr

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 06:17:30 PDT 2017


nlopes added a comment.

This transformation looks correct to me and goes in the right direction (remove unneeded int2ptr/ptr2int, since they block many optimizations).  The patch can be made a bit more general later.
Before the patch goes in, please add a few negative tests; you only have positive ones. Thanks!



================
Comment at: lib/Transforms/InstCombine/InstCombinePHI.cpp:143
+
+    if (!LoadI->hasOneUse())
+      return nullptr;
----------------
I don't think this constraint is needed.


================
Comment at: lib/Transforms/InstCombine/InstCombinePHI.cpp:146
+
+    if (LoadI->isAtomic())
+      return nullptr;
----------------
idem.


https://reviews.llvm.org/D37832





More information about the llvm-commits mailing list