[PATCH] D16240: [InstCombine] Simplify a known nonzero incoming value of PHI

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 18 18:28:55 PST 2016


majnemer added a subscriber: majnemer.
majnemer added a comment.

My gut reaction would be to ask why we aren't trying to fold the comparison across the PHI as that would catch this case (and others) quite naturally.


================
Comment at: lib/Transforms/InstCombine/InstCombinePHI.cpp:19-20
@@ -18,2 +18,4 @@
 #include "llvm/Transforms/Utils/Local.h"
+#include "llvm/Analysis/ValueTracking.h"
+#include "llvm/IR/PatternMatch.h"
 using namespace llvm;
----------------
Please sort these.

================
Comment at: test/Transforms/InstCombine/phi.ll:763-764
@@ -762,1 +762,4 @@
 
+; CHECK-LABEL: @phi_knownnonzero
+; CHECK-NOT: select
+define i1 @phi_knownnonzero(i32 %n, i32 %s, i32* nocapture readonly %P) {
----------------
This is not a sufficient test.  Please make the test highlight the instruction which you have altered.


http://reviews.llvm.org/D16240





More information about the llvm-commits mailing list