Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[licm] LICM invalidates alias analysis info and uses broken information #792

Closed
lattner opened this issue Aug 15, 2004 · 4 comments
Closed
Assignees
Labels
bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead

Comments

@lattner
Copy link
Collaborator

lattner commented Aug 15, 2004

Bugzilla Link 420
Resolution FIXED
Resolved on Feb 22, 2010 12:51
Version 1.3
OS All
Attachments Testcase that causes the crash

Extended Description

gccld on 253.perlbmk crashes when run on persephone, because the LICM pass is
promoting a memory location out of a loop, and not updating the alias analysis.

The problem is that LICM uses a call to PromoteMemToReg to do all of the heavy
lifting and insertion of PHI nodes. Unfortunately, this causes some reasonably
large churn to the code and the alias analysis impl (glocalsmodref-aa in this
case) is not informed. Later, the stale information is used by LICM and a crash
results.

I will attach a reduced testcase for the problem.

-Chris

@lattner
Copy link
Collaborator Author

lattner commented Aug 15, 2004

assigned to @lattner

@lattner
Copy link
Collaborator Author

lattner commented Sep 14, 2004

Here is a reduced testcase:


%PL_regcomp_parse = internal global sbyte* null

implementation

void %test() {
br label %Outer
Outer:
br label %Inner
Inner:
%tmp.114.i.i.i = load sbyte** %PL_regcomp_parse
%tmp.115.i.i.i = load sbyte* %tmp.114.i.i.i

store sbyte* null, sbyte** %PL_regcomp_parse

    br bool false, label %Inner, label %Next

Next:
br bool false, label %Outer, label %Exit
Exit:
ret void
}


$ llvm-as < llvm/llvm-bugzilla-archive#420 .ll | valgrind opt -globalsmodref-aa -licm -disable-output

@lattner
Copy link
Collaborator Author

lattner commented Sep 15, 2004

*** Bug llvm/llvm-bugzilla-archive#439 has been marked as a duplicate of this bug. ***

@lattner
Copy link
Collaborator Author

lattner commented Sep 15, 2004

This is now fixed, testcase here:
test/Regression/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.llx

Patches here:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040913/018323.html
...
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040913/018328.html

-Chris

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
keryell pushed a commit to keryell/llvm-project that referenced this issue Oct 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…d variables (llvm#792)

In OpenCL, `local`-qualified variables are implicitly considered as
static. In order to support it, this PR unblocks code paths related to
OpenCL static declarations in `CIRGenDecl.cpp`.

Following the approach of LLVM CodeGen, a new class
`CIRGenOpenCLRuntime` is added to handle the language hook of creating
`local`-qualified variables. The default behavior of this hook is quite
simple. It forwards the call to `CGF.buildStaticVarDecl`.

So in CIR, the OpenCL local memory representation is equivalent to the
one defined by SPIR-LLVM convention: a `cir.global` with
`addrspace(local)` and *without initializer*, which corresponds to LLVM
`undef` initializer. See check lines in test for more details.

A `static global`-qualified variable is also added in the test to
exercise the static code path itself.
searlmc1 pushed a commit to ROCm/llvm-project that referenced this issue Mar 6, 2025
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla compile-fail Use [accepts-invalid] and [rejects-valid] instead
Projects
None yet
Development

No branches or pull requests

1 participant