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

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 08:01:58 PDT 2024


================
@@ -218,6 +218,13 @@ def idempotent_prop : GICombineRule<
    (match (idempotent_prop_frags $dst, $src)),
    (apply (GIReplaceReg $dst, $src))>;
 
+// Convert freeze(Op(Op0, NonPoisonOps...)) to Op(freeze(Op0), NonPoisonOps...)
+// when Op0 is not guaranteed non-poison
+def push_freeze_to_prevent_poison_propagation : GICombineRule<
+  (defs root:$root, build_fn_matchinfo:$matchinfo),
+  (match (wip_match_opcode G_FREEZE):$root,
----------------
tschuett wrote:

wip_match_opcode is forbidden.
```
def freeze_of_poison : GICombineRule<
   (defs root:$root),
   (match (G_FREEZE $root, $src),
          [{ return !isGuaranteedNotToBePoison(${src}.getReg(), MRI) && Helper.matchFreezeOf ....]),
   (apply (Helper.apply...)>;
```

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


More information about the llvm-commits mailing list