[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:01:02 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:

This implementation doesn't seem to be consistent with canCreateUndefOrPoisonForTargetNode() in terms of FP predicate handling?

Also @RKSimon why https://github.com/llvm/llvm-project/blob/a84eb244129f288d609307ad42ab5e6c8e1cc795/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L5035-L5038 ? I would expect that in a case like this implementing canCreateUndefOrPoisonForTargetNode is sufficient...

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


More information about the llvm-commits mailing list