[PATCH] D132989: [InstSimplify] Odd - X ==/!= X -> false/true

Liao Chunyu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 5 09:01:35 PDT 2022


liaolucy added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:3134
+      if (Pred == CmpInst::ICMP_EQ)
+        return ConstantInt::getFalse(getCompareTy(RHS));
+      if (Pred == CmpInst::ICMP_NE)
----------------
spatel wrote:
> This can be shortened like the code above:
>   return getFalse(ITy);
>   ...
>   return getTrue(ITy);
456c7ef68e13b9dedd12a2333e01b6fdbc534b0a  


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:3134
+      if (Pred == CmpInst::ICMP_EQ)
+        return ConstantInt::getFalse(getCompareTy(RHS));
+      if (Pred == CmpInst::ICMP_NE)
----------------
liaolucy wrote:
> spatel wrote:
> > This can be shortened like the code above:
> >   return getFalse(ITy);
> >   ...
> >   return getTrue(ITy);
> 456c7ef68e13b9dedd12a2333e01b6fdbc534b0a  
https://reviews.llvm.org/rG456c7ef68e13b9dedd12a2333e01b6fdbc534b0a  done, sorry I didn't read it carefully


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132989/new/

https://reviews.llvm.org/D132989



More information about the llvm-commits mailing list