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

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 05:16:00 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);
+    });
----------------
RKSimon wrote:

Sorry, I can't remember off hand why it ended up that way - I suppose it was mainly to make it so we could return directly from isGuaranteedNotToBeUndefOrPoisonForTargetNode? Theres sufficiently little target support so far that refactoring isn't out of the question if it proves necessary.

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


More information about the llvm-commits mailing list