[PATCH] D41342: [InstCombine] Missed optimization in math expression: simplify calls exp functions

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 04:26:26 PDT 2018


lebedev.ri added inline comments.


================
Comment at: test/Transforms/InstCombine/fmul-exp.ll:15
+;
+  %1 = call double @llvm.exp.f64(double %a)
+  %2 = call double @llvm.exp.f64(double %b)
----------------
Please cleanup testcases, name all the variables (`-instnamer` will help)
(When committing, please commit tests first, so the code change shows the test change)


================
Comment at: test/Transforms/InstCombine/fmul-exp.ll:30-31
+;
+  %1 = call fast double @llvm.exp.f64(double %a)
+  %2 = call fast double @llvm.exp.f64(double %b)
+  %mul = fmul fast double %1, %2
----------------
I think this can still be transformed, as long as at least one of them has only one use.
This would be transformed into
```
  %2 = call fast double @llvm.exp.f64(double %b)
  call void @use(double %2)
  %t1 = add fast double %a, %b
  %t2 = call fast double @llvm.exp.f64(double %t2)
  ret double %t2
```
which has the same number of instruction,
And add a test where both of them are two-use, which won't be transformed.


================
Comment at: test/Transforms/InstCombine/fmul-exp2.ll:68
+}
\ No newline at end of file

----------------
Please add newlines


https://reviews.llvm.org/D41342





More information about the llvm-commits mailing list