[all-commits] [llvm/llvm-project] f61f99: [instcombine] Optimise for zero initialisation of ...

zjaffal via All-commits all-commits at lists.llvm.org
Wed Aug 17 03:13:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f61f99a105914c7060baf4161ffacc96a0995764
      https://github.com/llvm/llvm-project/commit/f61f99a105914c7060baf4161ffacc96a0995764
  Author: Zain Jaffal <z_jaffal at apple.com>
  Date:   2022-08-17 (Wed, 17 Aug 2022)

  Changed paths:
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/test/Transforms/InstCombine/remove-loop-phi-fastmul.ll

  Log Message:
  -----------
  [instcombine] Optimise for zero initialisation of product given fast flags are enabled

Currently, clang ignores the 0 initialisation in finite math
For example:

```
double f_prod = 0;
double arr[1000];
for (size_t i = 0; i < 1000; i++) {
  f_prod *= arr[i];
 }
```
Clang will ignore that `f_prod` is set to zero and it will generate assembly to iterate over the loop.

Reviewed By: fhahn, spatel

Differential Revision: https://reviews.llvm.org/D131672




More information about the All-commits mailing list