[PATCH] D125887: [CGP] Freeze condition when despeculating ctlz/cttz

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 19 08:20:41 PDT 2022


fhahn accepted this revision.
fhahn added a comment.

LGTM, thanks!



================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:2042
+  Value *Op = CountZeros->getOperand(0);
+  if (llvm::isKnownNonZero(Op, *DL))
     return false;
----------------
nit: while you are here, `llvm::` could be dropped.


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:2064
+  if (!isGuaranteedNotToBeUndefOrPoison(Op))
+    Op = Builder.CreateFreeze(Op); // Avoid introducing branch on poison.
+  Value *Cmp = Builder.CreateICmpEQ(Op, Zero, "cmpz");
----------------
nit: might be worth to name the freeze adding a `fr.` prefix or something to the name of the frozen value.


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

https://reviews.llvm.org/D125887



More information about the llvm-commits mailing list