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

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 06:48:27 PDT 2020


arsenm added a comment.

Tests missing



================
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...
----------------
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)


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:2176-2177
+      // When we apply the combine we will change the opcode...
+      if (!Def->getOperand(1).isReg() || !Def->getOperand(2).isReg())
+        return false;
+      // ... and negate the operands.
----------------
This is illegal, you can just assume these are registers


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