[PATCH] D85029: [JumpThreading] Allow duplicating a basic block into preds when its branch condition is freeze(phi)

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 13:12:08 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:1778
+  // This transformation is correct when a frozen PN is used as a branch
+  // condition as well, because it does not remove the freeze instruction.
+  //
----------------
This comment is a bit misleading.  Really, this transform is valid on any PHI node, whether or not it feeds into the branch.  It's just a heuristic that we only do this for i1 PHIs that feed directly into a branch.


================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:1206
+  if (PN && PN->getParent() == BB && isa<BranchInst>(BB->getTerminator()))
+    return ProcessBranchOnPHI(PN);
 
----------------
aqjune wrote:
> efriedma wrote:
> > Would it make sense to use SimplifyValue here?  (That sort of interacts with your other patch, I think?)
> I think it is tricky, since SimplifyValue may be extracted from icmp as well (line 1179)
By the same logic that makes it okay to look through freeze, it would be legal to look through icmps, I think? But maybe not profitable, and out of scope for this patch, I guess.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85029/new/

https://reviews.llvm.org/D85029



More information about the llvm-commits mailing list