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

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 12:25:32 PDT 2016


sanjoy added inline comments.

================
Comment at: include/llvm/Transforms/Utils/Local.h:295
@@ +294,3 @@
+/// instructions deleted.
+unsigned appendUnreachable(Instruction *I);
+
----------------
reames wrote:
> Why can't you just use the API immediately above?  
No specific reason; just from a readability POV I found it a little better to have a separately named utility than add a bool to an existing one.  If you prefer editing `changeToUnreachable` instead, I can do that too (as you can tell, I won't even have to change the implementation).

In case you were asking why I cannot use the API above as is, `changeToUnreachable` removes `I`.  But for guards the original instruction needs to remain, since that is how we'll get out of the compile (IOW it is more like "exit(0)" than it is like "store to null").


http://reviews.llvm.org/D19245





More information about the llvm-commits mailing list