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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 05:02:09 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 think we should at least make that part of the default implementation of this hook.

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


More information about the llvm-commits mailing list