[llvm] [BPF] improve error handling by custom lowering & fail() (PR #75088)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 05:04:09 PST 2023
================
@@ -617,6 +622,21 @@ static void NegateCC(SDValue &LHS, SDValue &RHS, ISD::CondCode &CC) {
}
}
+SDValue BPFTargetLowering::LowerSDIVSREM(SDValue Op, SelectionDAG &DAG) const {
+ SDLoc DL(Op);
+ fail(DL, DAG,
+ "unsupported signed division, please convert to unsigned div/mod.");
+ return DAG.getUNDEF(Op->getValueType(0));
+}
+
+SDValue BPFTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
+ SelectionDAG &DAG) const {
+ SDLoc DL(Op);
+ fail(DL, DAG, "unsupported dynamic stack allocation");
+ auto Ops = {DAG.getConstant(0, SDLoc(), Op.getValueType()), Op.getOperand(0)};
+ return DAG.getMergeValues(Ops, SDLoc());
----------------
eddyz87 wrote:
Oh, right, and when it says "node always has two return values" this means that `MERGE_VALUES` has to be used.
Thank you.
https://github.com/llvm/llvm-project/pull/75088
More information about the llvm-commits
mailing list