[llvm] [GlobalISel] Introduce `G_POISON` (PR #127825)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 04:10:43 PDT 2025


Mateusz =?utf-8?q?Sokół?= <mat646 at gmail.com>,
Mateusz =?utf-8?q?Sokół?= <mat646 at gmail.com>,
Mateusz =?utf-8?q?Sokół?= <mat646 at gmail.com>,
Mateusz =?utf-8?q?Sokół?= <mat646 at gmail.com>,
Mateusz =?utf-8?q?Sokół?= <mat646 at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/127825 at github.com>


================
@@ -2736,13 +2737,26 @@ bool CombinerHelper::matchAnyExplicitUseIsUndef(MachineInstr &MI) const {
   });
 }
 
+bool CombinerHelper::matchAnyExplicitUseIsPoison(MachineInstr &MI) const {
+  return any_of(MI.explicit_uses(), [this](const MachineOperand &MO) {
+    return MO.isReg() && getOpcodeDef(TargetOpcode::G_POISON, MO.getReg(), MRI);
+  });
+}
+
 bool CombinerHelper::matchAllExplicitUsesAreUndef(MachineInstr &MI) const {
   return all_of(MI.explicit_uses(), [this](const MachineOperand &MO) {
     return !MO.isReg() ||
            getOpcodeDef(TargetOpcode::G_IMPLICIT_DEF, MO.getReg(), MRI);
   });
 }
 
+bool CombinerHelper::matchAllExplicitUsesArePoison(MachineInstr &MI) const {
+  return all_of(MI.explicit_uses(), [this](const MachineOperand &MO) {
+    return !MO.isReg() ||
----------------
arsenm wrote:

This shouldn't need to check if the operand is a register, but this is consistent with the other cases

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


More information about the llvm-commits mailing list