[PATCH] D82499: [DAGCombiner] tighten constraints for fma fold

Qiu Chaofan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 00:47:18 PDT 2020


qiucf added a comment.

Hi, I see `reassoc` and `contract` are equivalent in many cases (at least in DAG combiner):

  define double @foo(double %a, double %b, double %c) {
  entry:
    %0 = fmul reassoc double %a, %b
    %1 = fadd reassoc double %0, %c
    ret double %1
  }
  ; => no contract bit, it's still fused into fma



  define double @foo2(double %a, double %b) {
  entry:
    %0 = fmul double %a, 1.1
    %1 = call contract double @llvm.fma.f64(double %0, double 2.1, double %b)
    ret double %1
  }
  ; => no reassoc set, (fma (fmul x, c1), c2, y) became (fma x, c1*c2, y)
  
  declare double @llvm.fma.f64(double, double, double)

Is this expected, or we need to differentiate them in more places?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82499/new/

https://reviews.llvm.org/D82499



More information about the llvm-commits mailing list