[llvm] [GlobalISel] Add `isKnownNeverZero` to `GISelValueTracking` (PR #198438)
Alan Li via llvm-commits
llvm-commits at lists.llvm.org
Tue May 19 08:17:58 PDT 2026
================
@@ -8816,3 +8816,35 @@ bool CombinerHelper::matchAVG(MachineInstr &MI, MachineRegisterInfo &MRI,
LLT XTy = MRI.getType(X);
return XTy == MRI.getType(Y) && isLegal({TargetOpc, {XTy}});
}
+
+static unsigned getCountZeroPoisonOpcode(unsigned Opc) {
+ switch (Opc) {
+ case TargetOpcode::G_CTLZ:
+ return TargetOpcode::G_CTLZ_ZERO_POISON;
+ case TargetOpcode::G_CTTZ:
+ return TargetOpcode::G_CTTZ_ZERO_POISON;
+ default:
+ return 0;
+ }
+}
+
+bool CombinerHelper::matchCountZeroToZeroPoison(MachineInstr &MI) const {
+ if (!VT)
+ return false;
+
+ unsigned ZPOpc = getCountZeroPoisonOpcode(MI.getOpcode());
+ if (!ZPOpc)
+ return false;
----------------
lialan wrote:
removed
https://github.com/llvm/llvm-project/pull/198438
More information about the llvm-commits
mailing list