[llvm] [GISel][CombinerHelper] Push freeze through non-poison-producing operands (PR #90618)

Dhruv Chawla via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 04:34:34 PDT 2024


================
@@ -34,6 +34,22 @@ class GenericMachineInstr : public MachineInstr {
   static bool classof(const MachineInstr *MI) {
     return isPreISelGenericOpcode(MI->getOpcode());
   }
+
+  bool hasPoisonGeneratingFlags() const {
+    return getFlags() & (NoUWrap | NoSWrap | IsExact | Disjoint | NonNeg |
+                         FmNoNans | FmNoInfs);
+  }
+
+  void dropPoisonGeneratingFlags() {
+    clearFlag(NoUWrap);
+    clearFlag(NoSWrap);
+    clearFlag(IsExact);
+    clearFlag(Disjoint);
+    clearFlag(NonNeg);
+    clearFlag(FmNoNans);
+    clearFlag(FmNoInfs);
----------------
dc03-work wrote:

I don't see a good way to, `clearFlag` takes a `MIFlag` and checks its value, so this would require doing a bitwise-and with `getFlags()` within a `setFlags()` call which may still not work and will likely be much uglier.

https://github.com/llvm/llvm-project/pull/90618


More information about the llvm-commits mailing list