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

Bill Wendling via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 13 14:29:48 PDT 2018


void added inline comments.


================
Comment at: llvm/docs/LangRef.rst:14432-14433
+The result of the intrinsic will depend on what optimisations are
+run. In particular, note that it will always be false if constant
+folding is not done.
+
----------------
This is true only for expressions that evaluate to constants not immediates, right?

Should you also mention that if a function with llvm.is.constant() is inlined, any constants fed into the inlined function may cause llvm.is.constant() to return true? (or something to that affect)


================
Comment at: llvm/include/llvm/IR/Intrinsics.td:838
+// Intrinsic to detect whether its argument is a constant.
+def int_is_constant : Intrinsic<[llvm_i1_ty], [llvm_any_ty], [IntrNoMem], "llvm.is.constant">;
+
----------------
80-columns?


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:1176
            AI != E; ++AI) {
+        if (AI->get()->getType()->isStructTy())
+          return markOverdefined(I); // Can't handle struct args.
----------------
This seems unrelated. Was it meant to be in this patch? If so, could you comment that it's specifically related to llvm.is.constant()?


https://reviews.llvm.org/D4276





More information about the llvm-commits mailing list