[PATCH] Disable DAGCombine for -O0 and optnone

Michael Kuperstein michael.m.kuperstein at intel.com
Wed May 27 15:06:17 PDT 2015


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
  }


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