getNode handling for ISD:SETCC calls FoldSETCC which can canonicalize
FP constants to the RHS. When this happens we should create the node
with the FMF that was requested. By using FlagInserter when can ensure
any calls to getNode/getSetcc during canonicalization will also get the flags.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
What, if any, interaction is there between this and D87361?
Can we solve this with the more general flag propagation scheme proposed there?
I think yes, but here the issue is getSetCC uses a default empty argument for Flags, just like how getNode do. If split it into two versions like D87361, one as normal but Flags is explicitly required, the other for no Flags and use the flags from current inserter (or remove Flags argument, if provide setFlags to flags inserter for rare cases when we want to pass a different flag), we can do it.
Use the FlagInserter mechanism in SelectionDAGBuilder::visitFCmp.
Remove Flags from getSetcc which was previously added for SelectionDAGBuilder.
LGTM - note that having FMF on fcmp in IR is an open problem (https://llvm.org/PR38086), so having it on setcc is probably the same. But this patch doesn't make that any worse AFAICT.