[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 09:42:04 PDT 2024


================
@@ -1750,13 +1752,26 @@ static bool isGuaranteedNotToBeUndefOrPoison(Register Reg,
 
   MachineInstr *RegDef = MRI.getVRegDef(Reg);
 
+  auto OpCheck = [&](MachineOperand &Operand) {
+    if (!Operand.isReg())
+      return true;
+
+    return isGuaranteedNotToBeUndefOrPoison(Operand.getReg(), MRI, Depth + 1,
+                                            Kind);
+  };
+
   switch (RegDef->getOpcode()) {
   case TargetOpcode::G_FREEZE:
     return true;
   case TargetOpcode::G_IMPLICIT_DEF:
     return !includesUndef(Kind);
   default:
-    return false;
+    GenericMachineInstr *Opr = dyn_cast<GBinOp>(RegDef);
+    if (!Opr)
+      Opr = dyn_cast<GCastOp>(RegDef);
----------------
tschuett wrote:

casts and binops can be poison

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


More information about the llvm-commits mailing list