[llvm] [RISCV] RISCVISD::SELECT_CC is for integer comparisons only which can't create poison (PR #151943)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 4 04:15:14 PDT 2025
https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/151943
The result type is irrelevant - its the comparison type that matters
>From 321d423775b78539481e8c68edfd083d3c1d63e7 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Mon, 4 Aug 2025 12:14:29 +0100
Subject: [PATCH] [RISCV] RISCVISD::SELECT_CC is for integer comparisons only
which can't create poison
The result type is irrelevant - its the comparison type that matters
---
llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index b6d1ee8bc3050..9e1deea93b971 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -21478,11 +21478,10 @@ bool RISCVTargetLowering::canCreateUndefOrPoisonForTargetNode(
// TODO: Add more target nodes.
switch (Op.getOpcode()) {
case RISCVISD::SELECT_CC:
- // Integer select_cc cannot create poison.
- // TODO: What are the FP poison semantics?
- // TODO: This instruction blocks poison from the unselected operand, can
- // we do anything with that?
- return !Op.getValueType().isInteger();
+ // Integer comparisons cannot create poison.
+ assert(Op.getOperand(0).getValueType().isInteger() &&
+ "RISCVISD::SELECT_CC only compares integers");
+ return false;
}
return TargetLowering::canCreateUndefOrPoisonForTargetNode(
Op, DemandedElts, DAG, PoisonOnly, ConsiderFlags, Depth);
More information about the llvm-commits
mailing list