Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

infinite recursion with opt -instcombine #46721

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR47752
Status CONFIRMED
Importance P enhancement
Reported by Mikael Holmén (mikael.holmen@ericsson.com)
Reported on 2020-10-07 01:52:46 -0700
Last modified on 2020-12-14 14:29:11 -0800
Version trunk
Hardware PC Linux
CC hans@chromium.org, lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com, tstellar@redhat.com
Fixed by commit(s) rGfed0f890e5698a7a408acaf0aa23319e918f6a2a
Attachments bbi-48251.ll (327 bytes, text/plain)
Blocks PR47800
Blocked by
See also
Created attachment 24029
bbi-48251.ll reproducer

llvm commit: 1aa8e6a51a0eb

Reproduce with:
 opt -S -o - bbi-48251.ll -instcombine

Result:

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.  Program arguments: ../../master/llvm/build-all/bin/opt -S -o - bbi-48251.ll -
instcombine
1.  Running pass 'Function Pass Manager' on module 'bbi-48251.ll'.
2.  Running pass 'Combine redundant instructions' on function '@g'
  #0 0x00000000027d2723 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../../master/llvm/build-all/bin/opt+0x27d2723)
  #1 0x00000000027d03ee llvm::sys::RunSignalHandlers() (../../master/llvm/build-all/bin/opt+0x27d03ee)
  #2 0x00000000027d2bdc SignalHandler(int) (../../master/llvm/build-all/bin/opt+0x27d2bdc)
  #3 0x00007fadc69978a0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x128a0)
  #4 0x00000000022e25f2 llvm::Negator::visitImpl(llvm::Value*, unsigned int) (../../master/llvm/build-all/bin/opt+0x22e25f2)
  #5 0x00000000022e4323 llvm::Negator::negate(llvm::Value*, unsigned int) (../../master/llvm/build-all/bin/opt+0x22e4323)
  #6 0x00000000022e34e1 llvm::Negator::visitImpl(llvm::Value*, unsigned int) (../../master/llvm/build-all/bin/opt+0x22e34e1)
  #7 0x00000000022e4323 llvm::Negator::negate(llvm::Value*, unsigned int) (../../master/llvm/build-all/bin/opt+0x22e4323)

etc

This starts happening with commit 67266d879c7 from April 22:

    [InstCombine] Negator: shufflevector is negatible

    All these folds are correct as per alive-tv
Quuxplusone commented 3 years ago

Attached bbi-48251.ll (327 bytes, text/plain): bbi-48251.ll reproducer

Quuxplusone commented 3 years ago
Thanks!
I've fixed this particular issue in fed0f890e5698a7a408acaf0aa23319e918f6a2a,
but i suspect there may be more such endless combine loops lurking.
Quuxplusone commented 3 years ago
(In reply to Roman Lebedev from comment #1)
> Thanks!
> I've fixed this particular issue in fed0f890e5698a7a408acaf0aa23319e918f6a2a,
> but i suspect there may be more such endless combine loops lurking.

Nice, thanks!
Quuxplusone commented 3 years ago

Sorry, not going to hold 11.0.0 for this one unless maybe if we do another release candidate.

Quuxplusone commented 3 years ago

This patch does not apply cleanly to the release/11.x branch. Could someone attach a patch that applies or create a branch on your local github for with the patch applied?

Quuxplusone commented 3 years ago

I was able to fix the merge conflict.

Roman, what is your opinion about backporting this?

https://github.com/tstellar/llvm-project/pull/271/commits/a2c5b384def332c29b8d3974bb0f1a6128d691e1

Quuxplusone commented 3 years ago

We need a conclusion on this by Dec. 14 in order for the fix to be included in the release.

Quuxplusone commented 3 years ago
(In reply to Tom Stellard from comment #5)
> I was able to fix the merge conflict.
The conflict is only in tests, not in code.
So before backporting the patch, take llvm/test/Transforms/InstCombine/sub-of-
negatible.ll from trunk,
regenerate check lines, and commit it, and then cherry-pick the fix, discard
test changes in the cherry-pick,
and again regenerate said test file.

> Roman, what is your opinion about backporting this?
>
> https://github.com/tstellar/llvm-project/pull/271/commits/
> a2c5b384def332c29b8d3974bb0f1a6128d691e1
Quuxplusone commented 3 years ago

I would like someone familiar with the code to do this backport. I'm not comfortable regenerating test checks without knowing what the correct output should look like.