[all-commits] [llvm/llvm-project] be1e50: [flang] Avoid unnecessary looping for constants (#...

Miguel Saldivar via All-commits all-commits at lists.llvm.org
Wed Sep 3 02:24:43 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: be1e50f56af8e270a0396eef8f62626fbbb84996
      https://github.com/llvm/llvm-project/commit/be1e50f56af8e270a0396eef8f62626fbbb84996
  Author: Miguel Saldivar <miguel.saldivar at hpe.com>
  Date:   2025-09-03 (Wed, 03 Sep 2025)

  Changed paths:
    M flang/lib/Lower/ConvertConstant.cpp

  Log Message:
  -----------
  [flang] Avoid unnecessary looping for constants (#156403)

Going through and doing `convertToAttribute` for all elements, if they
are the same can be costly. If the elements are the same, we can just
call `convertToAttribute` once.

This does give us a significant speed-up:
```console
$ hyperfine --warmup 1 --runs 5 ./slow.sh ./fast.sh
Benchmark 1: ./slow.sh
  Time (mean ± σ):      1.606 s ±  0.014 s    [User: 1.393 s, System: 0.087 s]
  Range (min … max):    1.591 s …  1.628 s    5 runs

Benchmark 2: ./fast.sh
  Time (mean ± σ):     452.9 ms ±   7.6 ms    [User: 249.9 ms, System: 83.3 ms]
  Range (min … max):   443.9 ms … 461.7 ms    5 runs

Summary
  ./fast.sh ran
    3.55 ± 0.07 times faster than ./slow.sh
```

Fixes #125444



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list