[PATCH] D64963: Add a pass to lower is.constant intrinsics

Joerg Sonnenberger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 05:38:25 PDT 2019


joerg added inline comments.


================
Comment at: lib/Transforms/Scalar/LowerIsConstantIntrinsic.cpp:9
+//
+// This pass lowers the 'is.constant' intrinsic to 'true' or 'false'.
+//
----------------
Fundamentally, we don't have to care too much about the 'true' part. That's handled by normal constant folding well enough already. It's only a fallback for the -O0 pass really.


================
Comment at: lib/Transforms/Scalar/LowerIsConstantIntrinsic.cpp:44
+  if (Exp) {
+    II->replaceAllUsesWith(Exp);
+    II->eraseFromParent();
----------------
RAUW is not good enough here. We want to have at least replaceAndRecursivelySimplify, but even that is not good enough as it still leaves conditional branches on constant conditions. D62025 depended on SimplifyCFG for that, but that doesn't work for the -O0 chain. That said, is there a reason for not handling that in InstructionSimplify.cpp explicitly?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D64963





More information about the llvm-commits mailing list