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

Li Jia He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 8 01:47:52 PDT 2018


HLJ2009 added inline comments.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:1312
   else if (match(UnsignedICmp,
-                 m_ICmp(UnsignedPred, m_Value(Y), m_Specific(X))) &&
            ICmpInst::isUnsigned(UnsignedPred))
----------------
HLJ2009 wrote:
> lebedev.ri wrote:
> > So was the old one a harmless typo that rendered that `if` useless, was that a miscompile (needs test then),
> > or is the RHS of the diff is a new case (so the old one is a standalone case, too, and needs a test)?
> Yes, you are right. For the optimization of this file, I did not find the corresponding test case file.Do I need to add all the remaining test cases now? Or submit a change individually.
If we add a test file named simplifyUnsignedRangeCheck.ll and write the optimizations in this function as test cases, would it be better ?


Repository:
  rL LLVM

https://reviews.llvm.org/D47922





More information about the llvm-commits mailing list