[PATCH] D79830: Add support of __builtin_expect_with_probability

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 13 06:27:19 PDT 2020


erichkeane added a comment.

Type checking/value checking for this should happen during Sema, not codegen.



================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2049
+    ConstantFP *Confidence_f = dyn_cast<ConstantFP>(Confidence);
+    if (!Confidence_f) {
+      CGM.Error(E->getArg(2)->getLocStart(),
----------------
This check should be able to be done during Sema.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2056
+      if (prob < 0.0 || prob > 1.0) {
+        CGM.Error(E->getArg(2)->getLocStart(),
+                  "probability of __builtin_expect_with_probability is "
----------------
Same as above, we shouldn't do this during Codegen.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79830





More information about the cfe-commits mailing list