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

LLVM assertion failure with -O1 #27055

Closed
JeffBezanson opened this issue May 9, 2018 · 6 comments
Closed

LLVM assertion failure with -O1 #27055

JeffBezanson opened this issue May 9, 2018 · 6 comments
Assignees

Comments

@JeffBezanson
Copy link
Member

@JeffBezanson JeffBezanson commented May 9, 2018

I get this running the numbers test with -O1:

julia: /home/jeff/src/julia/deps/srccache/llvm-6.0.0/lib/IR/Value.cpp:404: void llvm::Value::doRAUW(llvm::Value*, bool): Assertion `New->getType() == getType() && "replaceAllUses of value with new value of different type!"' failed.

signal (6): Aborted
in expression starting at /home/jeff/src/julia/test/numbers.jl:1082
raise at /build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56
abort at /build/buildd/eglibc-2.19/stdlib/abort.c:89
__assert_fail_base at /build/buildd/eglibc-2.19/assert/assert.c:92
__assert_fail at /build/buildd/eglibc-2.19/assert/assert.c:101
_ZN4llvm5Value6doRAUWEPS0_b at /home/jeff/src/julia/usr/bin/../lib/libLLVM-6.0.so (unknown line)
_ZN4llvm12InstCombiner3runEv at /home/jeff/src/julia/usr/bin/../lib/libLLVM-6.0.so (unknown line)
_ZL31combineInstructionsOverFunctionRN4llvm8FunctionERNS_19InstCombineWorklistEPNS_9AAResultsERNS_15AssumptionCacheERNS_17TargetLibraryInfoERNS_13DominatorTreeERNS_25OptimizationRemarkEmitterEbPNS_8LoopInfoE at /home/jeff/src/julia/usr/bin/../lib/libLLVM-6.0.so (unknown line)
_ZN4llvm24InstructionCombiningPass13runOnFunctionERNS_8FunctionE at /home/jeff/src/julia/usr/bin/../lib/libLLVM-6.0.so (unknown line)
_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE at /home/jeff/src/julia/usr/bin/../lib/libLLVM-6.0.so (unknown line)
_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE at /home/jeff/src/julia/usr/bin/../lib/libLLVM-6.0.so (unknown line)
_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE at /home/jeff/src/julia/usr/bin/../lib/libLLVM-6.0.so (unknown line)
operator() at /home/jeff/src/julia/src/jitlayers.cpp:480
addModule at /home/jeff/src/julia/usr/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h:57 [inlined]
addModule at /home/jeff/src/julia/src/jitlayers.cpp:607
jl_add_to_ee at /home/jeff/src/julia/src/jitlayers.cpp:845 [inlined]
jl_finalize_function at /home/jeff/src/julia/src/jitlayers.cpp:853
getAddressForFunction at /home/jeff/src/julia/src/codegen.cpp:1318
jl_generate_fptr at /home/jeff/src/julia/src/codegen.cpp:1427
jl_compile_method_internal at /home/jeff/src/julia/src/gf.c:1830 [inlined]
jl_fptr_trampoline at /home/jeff/src/julia/src/gf.c:1837
jl_apply_generic at /home/jeff/src/julia/src/gf.c:2167

Will try to investigate.

@JeffBezanson
Copy link
Member Author

@JeffBezanson JeffBezanson commented May 9, 2018

Dumped the module that instcombine is failing on: https://gist.github.com/JeffBezanson/09ffede3648a980ba397b4f5435392c1

@JeffBezanson
Copy link
Member Author

@JeffBezanson JeffBezanson commented May 9, 2018

Aha, I think I just need to run the PropagateJuliaAddrspaces pass before SROA.

@JeffBezanson JeffBezanson self-assigned this May 9, 2018
@Keno
Copy link
Member

@Keno Keno commented May 10, 2018

Aha, I think I just need to run the PropagateJuliaAddrspaces pass before SROA.

While that may perhaps fix it, LLVM should not crash if we don't run that pass. It's an optimization pass, not a lowering pass. We should try to fix the LLVM bug.

@JeffBezanson
Copy link
Member Author

@JeffBezanson JeffBezanson commented May 10, 2018

I have a promising lead: it looks like InstCombine's code for marking GEPs as inbounds incorrectly skips over addrspace casts, because the code for the prior transform reassigns a variable it uses.

@JeffBezanson
Copy link
Member Author

@JeffBezanson JeffBezanson commented May 10, 2018

Upstream patch submitted: https://reviews.llvm.org/D46722

chapuni pushed a commit to llvm-project/llvm-project-20170507 that referenced this issue May 14, 2018
Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722
chapuni pushed a commit to llvm-project/llvm-project-submodule that referenced this issue May 14, 2018
Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722
jyknight pushed a commit to jyknight/llvm-monorepo that referenced this issue May 14, 2018
Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722

llvm-svn=332302
earl pushed a commit to earl/llvm-mirror that referenced this issue May 14, 2018
Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332302 91177308-0d34-0410-b5e6-96231b3b80d8
@vchuravy
Copy link
Member

@vchuravy vchuravy commented May 18, 2018

Will be part of the next BB release and I will create a PR for this repo as well.

vchuravy added a commit to staticfloat/LLVMBuilder that referenced this issue May 19, 2018
vchuravy added a commit that referenced this issue May 20, 2018
Adds patches for:
- #27055
- #27080
- #27032
vchuravy added a commit that referenced this issue May 20, 2018
Adds patches for:
- #27055
- #27080
- #27032
vchuravy added a commit that referenced this issue May 22, 2018
Adds patches for:
- #27055
- #27080
- #27032
vchuravy added a commit that referenced this issue May 22, 2018
Adds patches for:
- #27055
- #27080
- #27032
vchuravy added a commit that referenced this issue May 23, 2018
Adds patches for:
- #27055
- #27080
- #27032
vchuravy added a commit that referenced this issue May 24, 2018
Adds patches for:
- #27055
- #27080
- #27032
jyknight pushed a commit to jyknight/llvm-monorepo that referenced this issue May 29, 2018
------------------------------------------------------------------------
r332302 | kfischer | 2018-05-14 15:05:01 -0700 (Mon, 14 May 2018) | 15 lines

[InstCombine] fix crash due to ignored addrspacecast

Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722
------------------------------------------------------------------------

llvm-svn=333477
chapuni pushed a commit to llvm-project/llvm that referenced this issue May 30, 2018
------------------------------------------------------------------------
r332302 | kfischer | 2018-05-14 15:05:01 -0700 (Mon, 14 May 2018) | 15 lines

[InstCombine] fix crash due to ignored addrspacecast

Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@333477 91177308-0d34-0410-b5e6-96231b3b80d8
vchuravy added a commit that referenced this issue Jun 3, 2018
Adds patches for:
- #27055
- #27080
- #27032
vchuravy added a commit that referenced this issue Jun 7, 2018
Adds patches for:
- #27055
- #27080
- #27032
vchuravy added a commit that referenced this issue Jun 15, 2018
Adds patches for:
- #27055
- #27080
- #27032

furthermore this adds the ability to use assertion builds on CI.
Currently turned of on AppVeyor since we are triggering an assertion
there.
chapuni pushed a commit to llvm-project/llvm-project-20170507 that referenced this issue Jun 17, 2018
------------------------------------------------------------------------
r332302 | kfischer | 2018-05-14 15:05:01 -0700 (Mon, 14 May 2018) | 15 lines

[InstCombine] fix crash due to ignored addrspacecast

Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722
------------------------------------------------------------------------
chapuni pushed a commit to llvm-project/llvm-project-submodule that referenced this issue Jun 17, 2018
------------------------------------------------------------------------
r332302 | kfischer | 2018-05-14 15:05:01 -0700 (Mon, 14 May 2018) | 15 lines

[InstCombine] fix crash due to ignored addrspacecast

Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722
------------------------------------------------------------------------
vchuravy added a commit that referenced this issue Jun 19, 2018
Adds patches for:
- #27055
- #27080
- #27032

furthermore this adds the ability to use assertion builds on CI.
Which is used on OSX and Windows.
vchuravy added a commit that referenced this issue Jun 19, 2018
Adds patches for:
- #27055
- #27080
- #27032

furthermore this adds the ability to use assertion builds on CI.
Which is used on OSX and Windows.
@vchuravy vchuravy closed this Jun 19, 2018
llvm-git-migration pushed a commit to llvm-git-prototype/llvm that referenced this issue Nov 6, 2018
------------------------------------------------------------------------
r332302 | kfischer | 2018-05-14 15:05:01 -0700 (Mon, 14 May 2018) | 15 lines

[InstCombine] fix crash due to ignored addrspacecast

Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722
------------------------------------------------------------------------

llvm-svn=333477
llvm-git-migration pushed a commit to llvm-git-prototype/llvm that referenced this issue Jan 4, 2019
------------------------------------------------------------------------
r332302 | kfischer | 2018-05-14 15:05:01 -0700 (Mon, 14 May 2018) | 15 lines

[InstCombine] fix crash due to ignored addrspacecast

Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722
------------------------------------------------------------------------

llvm-svn: 333477
JohnHolmesII pushed a commit to JohnHolmesII/llvm-project that referenced this issue Oct 12, 2020
Summary:
Part of the InstCombine code for simplifying GEPs looks through
addrspacecasts. However, this was done by updating a variable
also used by the next transformation, for marking GEPs as
inbounds. This led to replacing a GEP with a similar instruction
in a different addrspace, which caused an assertion failure in RAUW.

This caused julia issue JuliaLang/julia#27055

Patch by Jeff Bezanson <jeff@juliacomputing.com>

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D46722

llvm-svn: 332302
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants