If globals-aa is enabled, because of the deletion of memory instructions, there
may be call instruction that is not in ModOrRefSet but is a MemoryUseOrDef.
This causes the crash in the process of cloning uses and defs.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Thanks for the patch. it would also be great if you could mention the patch at the bug report, so people know there's a fix in the works.
Comment Actions
- Replace NULL as a actual address.
- Add function(loop-mssa(loop-simplifycfg)) in passes. Only if MemorySSA is constructed before recomputing globalsaa, the crash happens.
| llvm/test/Transforms/SimpleLoopUnswitch/pr58719.ll | ||
|---|---|---|
| 2 | Yes. InstCombine will delete the load instruction in function f. | |
Comment Actions
I'm a bit unsure about the approach used here. Might it make more sense to relax the assertion instead? AA returning better (or worse!) results as a result of other transforms is pretty normal, so it seems fragile if code has to go out of the way to drop no longer needed MemoryAccesses to avoid assertion failures.
| llvm/lib/Analysis/MemorySSA.cpp | ||
|---|---|---|
| 1768 ↗ | (On Diff #474173) | Could you add: if (!Def && Use != UseCheck) {
// New access should not have more power than template access
assert(!UseCheck && "Invalid template");
} |
is instcombine needed here?