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

[SimpleLoopUnswitch][LICM] Assertion `NewAccess != nullptr && "Tried to create a memory access for a " "non-memory touching instruction"' #116809

Closed
DianQK opened this issue Nov 19, 2024 · 0 comments · Fixed by #116813
Assignees
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:analysis llvm:transforms

Comments

@DianQK
Copy link
Member

DianQK commented Nov 19, 2024

The following IR triggers the assertion mentioned in the title:

; opt -passes='loop-mssa(simple-loop-unswitch<nontrivial>,licm)'
define i32 @foo(i1 %arg, ptr %arg1) {
bb:
  br label %bb2

bb2:                                              ; preds = %bb2, %bb
  %i = select i1 %arg, ptr %arg1, ptr @bar
  %i3 = call i32 %i()
  br i1 %arg, label %bb2, label %bb4

bb4:                                              ; preds = %bb2
  ret i32 %i3
}

declare i32 @bar() nounwind willreturn memory(none)

https://llvm.godbolt.org/z/bj79jxo8x

@DianQK DianQK self-assigned this Nov 19, 2024
@EugeneZelenko EugeneZelenko added loopoptim crash Prefer [crash-on-valid] or [crash-on-invalid] and removed llvm:crash labels Nov 19, 2024
DianQK added a commit that referenced this issue Nov 20, 2024
Fixes #116809.

After running some passes (SimpleLoopUnswitch, LoopInstSimplify, etc.),
MemorySSA might be outdated, and the instruction `I` may have become a
non-memory touching instruction.

LICM has already handled this, but it does not pass
`CreationMustSucceed=false` to `createDefinedAccess`.
DianQK added a commit to llvmbot/llvm-project that referenced this issue Nov 21, 2024
Fixes llvm#116809.

After running some passes (SimpleLoopUnswitch, LoopInstSimplify, etc.),
MemorySSA might be outdated, and the instruction `I` may have become a
non-memory touching instruction.

LICM has already handled this, but it does not pass
`CreationMustSucceed=false` to `createDefinedAccess`.

(cherry picked from commit 18b02bb)
DianQK added a commit to llvmbot/llvm-project that referenced this issue Nov 21, 2024
Fixes llvm#116809.

After running some passes (SimpleLoopUnswitch, LoopInstSimplify, etc.),
MemorySSA might be outdated, and the instruction `I` may have become a
non-memory touching instruction.

LICM has already handled this, but it does not pass
`CreationMustSucceed=false` to `createDefinedAccess`.

(cherry picked from commit 18b02bb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:analysis llvm:transforms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants