[PATCH] D19578: [EarlyCSE] Simplify guard intrinsics

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 14:09:57 PDT 2016


reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.

LGTM w/minor comments.


================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:561
@@ +560,3 @@
+      if (match(Cond, m_One())) {
+        // Elide guards on true, since operationally they're no-ops.  In the
+        // future we can consider more sophisticated tradeoffs here with
----------------
You should consider (as a future change) moving this into isInstructionTriviallyDead.

================
Comment at: test/Transforms/EarlyCSE/guards.ll:26
@@ +25,3 @@
+; CHECK-NEXT:  call void (i1, ...) @llvm.experimental.guard(i1 %cond) [ "deopt"() ]
+; CHECK-NEXT:  %rval = add i32 %val0, %val0
+; CHECK-NEXT:  ret i32 %rval
----------------
If you used a sub here, you could check for ret i32 0

================
Comment at: test/Transforms/EarlyCSE/guards.ll:45
@@ +44,3 @@
+
+define i32 @test3(i32 %val) {
+; After a guard has executed the condition it was guarding is known to
----------------
I'd suggest splitting this into two test cases.


http://reviews.llvm.org/D19578





More information about the llvm-commits mailing list