[llvm] [IR] Require that ptrmask mask matches pointer index size (PR #69343)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 07:44:33 PDT 2023
================
@@ -7420,11 +7420,12 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
}
case Intrinsic::ptrmask: {
SDValue Ptr = getValue(I.getOperand(0));
- SDValue Const = getValue(I.getOperand(1));
+ SDValue Mask = getValue(I.getOperand(1));
EVT PtrVT = Ptr.getValueType();
- setValue(&I, DAG.getNode(ISD::AND, sdl, PtrVT, Ptr,
- DAG.getZExtOrTrunc(Const, sdl, PtrVT)));
+ assert(PtrVT == Mask.getValueType() &&
----------------
arichardson wrote:
I had a quick [look at CHERI LLVM](https://github.com/CTSRD-CHERI/llvm-project/blob/20ce0d45e296b441250cd30df1a93f607107f189/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp#L7225) and it appears this code has not been adapted (yet), so it seems like it hasn't compiled any code where ptrmask reaches SDAG. Having an assertion with a sensible error message rather than failures later on is definitely an improvement :)
https://github.com/llvm/llvm-project/pull/69343
More information about the llvm-commits
mailing list