[PATCH] D4276: Added llvm.is.constant intrinsic

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 13 12:16:56 PDT 2018


efriedma added a comment.

It seems like you're waiting to fold llvm.is.constant until really late in the optimization pipeline; we probably want to fold it sometime in the "middle", so we get better optimization. Maybe just after function simplification passes; at that point, we're unlikely to get any more useful information about whether the argument is constant, and we want to simplify the code as much as possible before we run transforms like loop vectorization.



================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:1592
+    return true;
+  } else if (isa<ConstantAggregate>(c) || isa<ConstantExpr>(c)) {
+    for (const Value *subc : c->operand_values()) {
----------------
Probably doesn't make sense to check for ConstantExpr here; if isManifestConstant is true for all the operands of a ConstantExpr, it should get constant-folded.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:5762
+
+    case Intrinsic::is_constant:
+    // If this wasn't constant-folded away by now, then it's not a
----------------
Indentation.


https://reviews.llvm.org/D4276





More information about the llvm-commits mailing list