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

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 11:34:01 PDT 2016


reames added a subscriber: reames.

================
Comment at: include/llvm/Transforms/Utils/Local.h:295
@@ +294,3 @@
+/// instructions deleted.
+unsigned appendUnreachable(Instruction *I);
+
----------------
Why can't you just use the API immediately above?  

================
Comment at: lib/Transforms/Utils/Local.cpp:1287
@@ +1286,3 @@
+unsigned llvm::appendUnreachable(Instruction *I) {
+  return makeUnreachableImpl(I, /* UseLLVMTrap = */ false,
+                             /* KeepOriginalInst = */ true);
----------------
You should respect UseLLVMTrap here.

================
Comment at: lib/Transforms/Utils/Local.cpp:1347
@@ -1329,1 +1346,3 @@
 
+        if (II->getIntrinsicID() == Intrinsic::experimental_guard)
+          // Unlike in llvm.assume, it is not "obviously profitable" for guards
----------------
Add a comment explain what this does rather than what it does not do.


http://reviews.llvm.org/D19245





More information about the llvm-commits mailing list