The patch does not pass math flags to float VPCmpIntrinsics because LLParser
could not identify float VPCmpIntrinsics as FPMathOperators.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I would split this patch. One for vp.fcmp and one for the other operations. The LLParser issue is concerning and may delay the vp.fcmp support. That shouldn't block the other nodes.
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7603 | If we hit this line on an FP operation with fast math flags, would we add fast math flags to an ISD::ZERO_EXTEND? Might be safer to pass the flags to the DAG.getNode call in the default case. | |
llvm/test/CodeGen/RISCV/rvv/fast-math-flags-vp.ll | ||
3 ↗ | (On Diff #429415) | declartion -> declaration |
The update removes the part of vp.fcmp support and using argument of DAG.getNode to pass flags.
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7603 | Thank your reminder. I fix the bug in the latest update. |
llvm/test/CodeGen/RISCV/pass-fast-math-flags-sdnode.ll | ||
---|---|---|
2 | You need REQUIRES: asserts if you use -debug-only. The -debug-only option isn't available on builds without asserts. |
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7615 | Why can't we do? SDValue Result; SDNodeFlags SDFlags; if (auto *FPMO = dyn_cast<FPMathOperator>(&VPIntrin)) SDFlags.copyFMF(*FPMO); Result = DAG.getNode(Opcode, DL, VTs, OpValues, SDFlags); |
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7615 | getNode with SDVTList does not use SDNodeFlags directly. SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, ArrayRef<SDValue> Ops, const SDNodeFlags Flags) { if (VTList.NumVTs == 1) return getNode(Opcode, DL, VTList.VTs[0], Ops); |
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7615 | Can you submit a patch to fix that? It’s a bug. |
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | ||
---|---|---|
7615 | Yeah, I am willing to do that. |
llvm/test/CodeGen/RISCV/pass-fast-math-flags-sdnode.ll | ||
---|---|---|
2 | I didn't think about this before, but is it possible to use -stop-after=finalize-isel and inspect the MIR output instead? That wouldn't require an asserts build. |
llvm/test/CodeGen/RISCV/pass-fast-math-flags-sdnode.ll | ||
---|---|---|
2 | There is no optimization of VP using fast math flags and I don't know how to make MIR print fast-math flags. The output of llc -mtriple=riscv64 -mattr=+v fa. -stop-after=finalize-isel : | |
2 | Could we get MIR |
LGTM
llvm/test/CodeGen/RISCV/pass-fast-math-flags-sdnode.ll | ||
---|---|---|
2 | I think we're dropping the fast math flags when we go from ISD::VP* to RISCVISD::*_VL. So my suggestion won't work without a lot more work. We can use the debug output and REQUIRES: asserts |
If we hit this line on an FP operation with fast math flags, would we add fast math flags to an ISD::ZERO_EXTEND?
Might be safer to pass the flags to the DAG.getNode call in the default case.