llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Compile time regression after #154336

Open piotrAMD opened this issue 1 year ago • 9 comments

https://github.com/llvm/llvm-project/pull/154336 causes some drastic compile time regressions for AMDGPU. In one real world case compilation time jumped from a fraction of second to over 1 hour, where most of the time is spent in the instcombine. Here's the simplified reproducer repro.txt:

$ time ./opt_fail -passes="instcombine" -disable-output repro.txt

real 0m3,221s user 0m3,208s sys 0m0,013s

$ time ./opt_pass -passes="instcombine" -disable-output repro.txt

real 0m0,017s user 0m0,008s sys 0m0,009s

piotrAMD avatar Nov 20 '25 10:11 piotrAMD

FYI @nikic

jayfoad avatar Nov 25 '25 10:11 jayfoad

@nikic Would you like any assistance in resolving this, or do you have any thoughts on what might be causing the issue?

This is actually a correctness issues for us, because the compilation time increase is so dramatic that it causes TDR problems in real games. We had to revert the problematic commit downstream temporarily.

piotrAMD avatar Dec 09 '25 15:12 piotrAMD

cc @c-rhodes this is probably related to the issues discussed in https://github.com/llvm/llvm-project/pull/157678. I just tried https://github.com/llvm/llvm-project/pull/171435 with this repro, and it drops the time from 1.5s to 0.03s.

nikic avatar Dec 09 '25 16:12 nikic

#171435 is causing compile-time issues as well (see https://github.com/dtcxzyw/llvm-opt-benchmark/pull/3129), I just threw that together this morning whilst picking the freeze work back up and was surprised the tests passed so posted a draft PR so I could try it on @dtcxzyw's infra. The smallest is https://github.com/dtcxzyw/llvm-opt-benchmark/blob/main/bench/ffmpeg/original/avc.ll which I reduced to https://godbolt.org/z/6Gx58GfK1, but have not had chance to look at it properly yet as I got pulled into something else this afternoon.

I'd probably need your help to turn it around quickly if we want it as a fix for this

c-rhodes avatar Dec 09 '25 16:12 c-rhodes

#171435 is causing compile-time issues as well (see dtcxzyw/llvm-opt-benchmark#3129), I just threw that together this morning whilst picking the freeze work back up and was surprised the tests passed so posted a draft PR so I could try it on @dtcxzyw's infra. The smallest is https://github.com/dtcxzyw/llvm-opt-benchmark/blob/main/bench/ffmpeg/original/avc.ll which I reduced to https://godbolt.org/z/6Gx58GfK1, but have not had chance to look at it properly yet as I got pulled into something else this afternoon.

I'd probably need your help to turn it around quickly if we want it as a fix for this

@c-rhodes I am sorry to tell you the computational resource in my CI is shared by my experiment about the automated program repair of LLVM (will be completed before this weekend). So the timeout failures may be flaky :( Can you reproduce it locally?

dtcxzyw avatar Dec 09 '25 17:12 dtcxzyw

#171435 is causing compile-time issues as well (see dtcxzyw/llvm-opt-benchmark#3129), I just threw that together this morning whilst picking the freeze work back up and was surprised the tests passed so posted a draft PR so I could try it on @dtcxzyw's infra. The smallest is https://github.com/dtcxzyw/llvm-opt-benchmark/blob/main/bench/ffmpeg/original/avc.ll which I reduced to https://godbolt.org/z/6Gx58GfK1, but have not had chance to look at it properly yet as I got pulled into something else this afternoon. I'd probably need your help to turn it around quickly if we want it as a fix for this

@c-rhodes I am sorry to tell you the computational resource in my CI is shared by my experiment about the automated program repair of LLVM (will be completed before this weekend). So the timeout failures may be flaky :( Can you reproduce it locally?

I can reproduce it locally yes, I think it's genuine and not because of your CI resources

c-rhodes avatar Dec 09 '25 17:12 c-rhodes

@c-rhodes was there a reason why #171435 was closed, given it seemed to help with this?

perlfu avatar Jan 29 '26 08:01 perlfu

@c-rhodes was there a reason why #171435 was closed, given it seemed to help with this?

there's more context here: https://github.com/llvm/llvm-project/pull/157678#discussion_r2627806533

but in short, I don't have much experience with instcombine and this particular code is quite tricky, I tried a few things but couldn't get it to work.

c-rhodes avatar Jan 29 '26 08:01 c-rhodes

Thanks for the revert - closing.

piotrAMD avatar Apr 20 '26 12:04 piotrAMD