[PATCH] D19245: [SimplifyCFG] Fold `llvm.guard(false)` to unreachable

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 17:45:16 PDT 2016


majnemer added a subscriber: majnemer.

================
Comment at: lib/Transforms/Utils/Local.cpp:1331
@@ +1330,3 @@
+        if (II->getIntrinsicID() == Intrinsic::experimental_guard) {
+          // An call to the guard intrinsic bails out of the current compilation
+          // unit if the predicate passed to it is false.  If the predicate is a
----------------
An call -> A call.

================
Comment at: lib/Transforms/Utils/Local.cpp:1341
@@ +1340,3 @@
+            if (CI->isZero() && !isa<UnreachableInst>(II->getNextNode())) {
+              changeToUnreachable(II->getNextNode(), /* UseLLVMTrap = */ false);
+              Changed = true;
----------------
I think the usual style doesn't have spaces before the variable or around the equals:
  changeToUnreachable(II->getNextNode(), /*UseLLVMTrap=*/false);

I've also seen it formatted like so:
  changeToUnreachable(II->getNextNode(), /*UseLLVMTrap*/ false);


http://reviews.llvm.org/D19245





More information about the llvm-commits mailing list