G_FMINNUM_IEEE and G_FMAXNUM_IEEE are known to be never SNaN
and there is no need to quiet them using G_FCANONICALIZE.
Add post legalizer combine that deletes such G_FCANONICALIZE and
replaces its uses with input (G_FMINNUM_IEEE or G_FMAXNUM_IEEE) register.
Details
Diff Detail
Event Timeline
llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp | ||
---|---|---|
257 | You can use standard replaceSingleDefInstWithOperand or replaceSingleDefInstWithReg instead of defining your own apply function. |
llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp | ||
---|---|---|
253–255 | Really we should have an isCanonicalized utility function like we do in the DAG rather than special casing these two |
llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp | ||
---|---|---|
250 | I think the C should be capital too, matchRemoveFCanonicalize. This matches buildFCanonicalize in MIRBuilder. |
llvm/lib/Target/AMDGPU/SIISelLowering.cpp | ||
---|---|---|
9649 | I don't think this really belongs in SITargetLowering, but I don't have a better suggestion for now | |
9655–9658 | Duplicated / dead path for fcanonicalize. This meant G_FCONSTANT | |
9671 | We shouldn't actually treat these generic instructions differently based on the subtarget, but I guess that's an existing problem | |
llvm/test/CodeGen/AMDGPU/GlobalISel/combine-fcanonicalize.mir | ||
169 | Needs tests for the G_FCONSTANT cases |
I think the C should be capital too, matchRemoveFCanonicalize. This matches buildFCanonicalize in MIRBuilder.