[PATCH] D47922: unsigned foo(unsigned x, unsigned y) { return x > y && x != 0; } should fold to x > y

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 7 23:24:49 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:1312
   else if (match(UnsignedICmp,
-                 m_ICmp(UnsignedPred, m_Value(Y), m_Specific(X))) &&
+                 m_ICmp(UnsignedPred, m_Specific(Y), m_Value(X))) &&
            ICmpInst::isUnsigned(UnsignedPred))
----------------
Alive thinks this makes sense: https://rise4fun.com/Alive/7d9


================
Comment at: test/Transforms/InstCombine/and3.ll:4
+
+; x > y && x != 0 -> x > y
+
----------------
Can you place it next to the rest of the tests from `simplifyUnsignedRangeCheck()`?


Repository:
  rL LLVM

https://reviews.llvm.org/D47922





More information about the llvm-commits mailing list