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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 13:18:25 PDT 2024


================
@@ -1733,10 +1733,21 @@ static bool canCreateUndefOrPoison(Register Reg, const MachineRegisterInfo &MRI,
                                    UndefPoisonKind Kind) {
   MachineInstr *RegDef = MRI.getVRegDef(Reg);
 
+  if (auto *GMI = dyn_cast<GenericMachineInstr>(RegDef)) {
+    if (ConsiderFlagsAndMetadata && includesPoison(Kind) &&
+        GMI->hasPoisonGeneratingFlags())
+      return true;
+  }
+  // Conservatively return true.
+  else
+    return true;
+
   switch (RegDef->getOpcode()) {
   case TargetOpcode::G_FREEZE:
     return false;
   default:
+    if (isa<GCastOp>(RegDef) || isa<GBinOp>(RegDef))
+      return false;
----------------
arsenm wrote:

return bool expression 

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


More information about the llvm-commits mailing list