[PATCH] InstCombine: Combine two icmps into one if the RHSs agree

Chad Rosier mcrosier at codeaurora.org
Fri Aug 1 10:13:18 PDT 2014


================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:819
@@ +818,3 @@
+        (Ty->isVectorTy() &&
+         cast<VectorType>(Ty)->getElementType()->isIntegerTy())) {
+      // We are creating two instructions; make sure we are replacing at least
----------------
Perhaps,
Ty->isIntOrIntVectorTy()

================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:822
@@ +821,3 @@
+      // that many.
+      if (LHS->hasOneUse() || RHS->hasOneUse()) {
+        Value *NewOr = Builder->CreateOr(Val, Val2);
----------------
Should this be

if (LHS->hasOneUse() && RHS->hasOneUse())

We should check to make sure the both compares have one and only one use, right?

http://reviews.llvm.org/D4744






More information about the llvm-commits mailing list