[llvm] [BPF] improve error handling by custom lowering & fail() (PR #75088)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 08:33:51 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:
Out of curiosity, I tried replacing this with UNDEF and llvm crashed with a stack trace.
Do you happen to know where expected return type for `LowerDYNAMIC_STACKALLOC` is documented? (in case it is documented).
https://github.com/llvm/llvm-project/pull/75088
More information about the llvm-commits
mailing list