[PATCH] Disable DAGCombine for -O0 and optnone

Oleg Ranevskyy llvm.mail.list at gmail.com
Tue Jun 2 10:27:15 PDT 2015


In http://reviews.llvm.org/D9992#179746, @mkuper wrote:

> So, there's something that I'm fairly sure will break on x86, and it doesn't seem to be covered by a test. :-(
>  The x86 PerformFMACombine actually performs an essential part of isel - it lowers a target-independent ISD node into a target-dependent one.
>
> Now, for cases where the FMA comes from an x86 intrinsic, it's not an issue, since we never get the target-independent ISD. For cases where the FMA itself is constructed by a DAGCombine (which is what fma_patterns tests), it's not an issue either, because the FMA never gets formed. But it will be hit when the FMA comes from a target-independent intrinsic.
>
> TL;DR:
>  Try compiling this with -mattr=+fma -O0 with your patch, I expect it to fail:
>
>   declare <4 x float> @llvm.fma.v4f32(<4 x float> %a, <4 x float>  %b, <4 x float>  %c)
>  
>   define <4 x float> @test_fma1(<4 x float> %a0, <4 x float> %a1, <4 x float> %a2) {
>     %res = call <4 x float> @llvm.fma.v4f32(<4 x float> %a0, <4 x float> %a1, <4 x float> %a2)
>     ret <4 x float> %res
>   }
>


Thank you Michael! You are right - your test fails with the patch.
The next version of the patch moves FMA lowering on X86 from combine to the Legalize step, thus it no longer depends on DAGCombine availability. It also adds a test you provided. I will update the review summary with the description of the changes made. Would you be able to take a look, please?


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9992

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list