[llvm] [RISCV] Add integer RISCVISD::SELECT_CC to canCreateUndefOrPoison and isGuaranteedNotToBeUndefOrPoison. (PR #84693)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 20 07:46:40 PDT 2024


================
@@ -17041,6 +17041,38 @@ unsigned RISCVTargetLowering::ComputeNumSignBitsForTargetNode(
   return 1;
 }
 
+bool RISCVTargetLowering::isGuaranteedNotToBeUndefOrPoisonForTargetNode(
+    SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG,
+    bool PoisonOnly, unsigned Depth) const {
+
+  // TODO: Add more target nodes.
+  switch (Op.getOpcode()) {
+  case RISCVISD::SELECT_CC:
+    return all_of(Op->ops(), [&](SDValue V) {
+      return DAG.isGuaranteedNotToBeUndefOrPoison(V, PoisonOnly, Depth + 1);
+    });
----------------
nikic wrote:

I'd still like to see this change. It makes very little sense to spell this out per-target. The code in https://github.com/llvm/llvm-project/blob/a84eb244129f288d609307ad42ab5e6c8e1cc795/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L5039-L5043 should be in the default impl of isGuaranteedNotToBeUndefOrPoisonForTargetNode, and then you won't have to do anything special here.

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


More information about the llvm-commits mailing list