New user self-registration is disabled due to spam. For an account please email bugs-admin@lists.llvm.org with your e-mail address and full name.

Bug 45186 - DAGCombiner::Run infinite loop / memory leak
Summary: DAGCombiner::Run infinite loop / memory leak
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: trunk
Hardware: Other FreeBSD
: P normal
Assignee: Hal Finkel
URL:
Keywords:
Depends on:
Blocks: release-10.0.1
  Show dependency tree
 
Reported: 2020-03-12 12:39 PDT by Brandon Bergren
Modified: 2020-06-23 14:17 PDT (History)
7 users (show)

See Also:
Fixed By Commit(s): 099a875f28d0131a6ae85af91b9eb8627917fbbe 177a9ac3c6b


Attachments
reproduce files from manually crashing compiler with SIGBUS. (132.85 KB, application/gzip)
2020-03-12 12:39 PDT, Brandon Bergren
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brandon Bergren 2020-03-12 12:39:52 PDT
Created attachment 23227 [details]
reproduce files from manually crashing compiler with SIGBUS.

FreeBSD clang 9.0.1 could compile this code OK, but FreeBSD clang 10.0.0 llvmorg-10.0.0-rc3-1-gc290cb61fdc gets stuck in an infinite loop, and so does current llvm master.

Code is from FreeBSD security/nss package building on powerpc64.
Comment 1 Piotr Kubaj 2020-03-19 12:58:55 PDT
The same bug affects also multimedia/x264.
Comment 2 Piotr Kubaj 2020-04-02 09:10:52 PDT
Adding dim@ to cc.
Comment 3 Dimitry Andric 2020-04-02 12:15:17 PDT
Reduced to:

// clang -cc1 -triple powerpc64-- -S -target-feature +vsx -O2 -std=c99 -vectorize-loops gcm-min.c
struct {
  long b, c;
} d;
long e(unsigned char *f) {
  return (long)f[0] << 56 | (long)f[1] << 48 | (long)f[2] << 40 |
         (long)f[3] << 32 | (long)f[4] << 24 | f[5] << 16 | f[6] << 8 | f[7];
}
void g(void) {
  d.c = e((unsigned char *)g + 8);
  d.b = e((unsigned char *)g);
}
Comment 4 Dimitry Andric 2020-04-02 13:27:44 PDT
Regression caused by https://reviews.llvm.org/rGa9ad65a2b34 aka https://reviews.llvm.org/D71954 ("[PowerPC] Change default for unaligned FP access for older subtargets"), which was a fix for bug 40554.
Comment 5 Nemanja Ivanovic 2020-05-26 06:28:42 PDT
Ah, this really was only supposed to be used for scalar types.
Comment 6 Nemanja Ivanovic 2020-05-26 11:45:43 PDT
Is this something you need backported to 10.0.1?
Comment 7 Dimitry Andric 2020-05-26 12:14:46 PDT
(In reply to Nemanja Ivanovic from comment #6)
> Is this something you need backported to 10.0.1?

Yes, that would be nice, thanks for the fix!. I'm certainly going to import it into FreeBSD when the upcoming 10.0.1-rc2 drops. Or I'll cherry-pick it separately, so it can be merged back to older FreeBSD branches.
Comment 8 Nemanja Ivanovic 2020-05-27 06:58:12 PDT
Can we get this merged into 10.0.1?
Comment 9 Nemanja Ivanovic 2020-05-27 13:15:52 PDT
Sorry, that would mean that both commits need to be merged in:
a9ad65a2b34f9cbcd207114caa862ef2dc4553c8
099a875f28d0131a6ae85af91b9eb8627917fbbe
Comment 10 Tom Stellard 2020-05-27 20:06:19 PDT
(In reply to Nemanja Ivanovic from comment #9)
> Sorry, that would mean that both commits need to be merged in:
> a9ad65a2b34f9cbcd207114caa862ef2dc4553c8

This patch is from December and already in the branch.

> 099a875f28d0131a6ae85af91b9eb8627917fbbe
Comment 11 Tom Stellard 2020-05-27 20:07:18 PDT
Hal, what do you think about backporting this?

https://reviews.llvm.org/rG099a875f28d0131a6ae85af91b9eb8627917fbbe
Comment 12 Piotr Kubaj 2020-06-11 10:57:00 PDT
Reopened for merging.
Comment 13 Hal Finkel 2020-06-19 13:53:40 PDT
(In reply to Tom Stellard from comment #11)
> Hal, what do you think about backporting this?
> 
> https://reviews.llvm.org/rG099a875f28d0131a6ae85af91b9eb8627917fbbe

LGTM.
Comment 14 Tom Stellard 2020-06-23 14:17:12 PDT
Merged: 177a9ac3c6b