[llvm] [CodeGen] Use first EHLabel as a stop gate for live range shrinking (PR #114195)

Nathan Chancellor via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 08:33:05 PST 2024


nathanchance wrote:

I am noticing a significant compile time regression (perhaps infinite loop?) with this change with certain compile options, which I discovered when building the Linux kernel for 32-bit x86. `cvise` spits out the trivial C reproducer:

```
enum { RATE_6M_PLCP } il4965_tx_status_reply_tx_agg_2;
int il4965_tx_status_reply_tx_i;
short il4965_tx_status_reply_tx_start_idx,
    il4965_tx_status_reply_tx_frame_status_0_0;
int il4965_tx_status_reply_tx() {
  int sh, start = il4965_tx_status_reply_tx_start_idx;
  long long bitmap;
  for (; il4965_tx_status_reply_tx_i; il4965_tx_status_reply_tx_i++) {
    if (il4965_tx_status_reply_tx_frame_status_0_0)
      continue;
    if (sh > 4) {
      sh = start;
      bitmap = sh = 0;
    }
    bitmap |= 1ULL << sh;
  }
  if (bitmap)
    il4965_tx_status_reply_tx_agg_2 = 1;
  return 0;
}
```

Immediately prior to this change:

```
Benchmark 1: clang --target=i686-linux-gnu -march=geode -O2 -g -c 4965-mac.i
  Time (mean ± σ):      14.9 ms ±   0.3 ms    [User: 8.9 ms, System: 5.9 ms]
  Range (min … max):    14.5 ms …  17.0 ms    142 runs
```

At this change:

```
$ clang --target=i686-linux-gnu -march=geode -O2 -g -c 4965-mac.i
<hangs>
```

https://github.com/llvm/llvm-project/pull/114195


More information about the llvm-commits mailing list