[PATCH] D86709: [GlobalISel] Extend not_cmp_fold to work on conditional expressions

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 06:55:11 PDT 2020


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2173-2174
+      // Implement De Morgan's laws:
+      // ~(x & y) -> ~x | ~y
+      // ~(x | y) -> ~x & ~y
+      // When we apply the combine we will change the opcode...
----------------
arsenm wrote:
> This is only better if this is fed by a compare you can invert. This should probably not do this if it finds some other i1 def.
> 
> We also should probably check if the inverted condcode is legal, but I guess we're missing cond code legality infrastructure (and none of the targets with gisel now don't need it)
> This is only better if this is fed by a compare you can invert.

We process the whole expression tree and return false if we find anything that is not an AND or OR or a comparison.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86709



More information about the llvm-commits mailing list