luxufan 3053a323c7 [MemorySSA] Relax assert condition in createDefinedAccess
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.

Fixes https://github.com/llvm/llvm-project/issues/58719

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D137553
2022-11-17 23:43:20 +08:00

22 lines
719 B
LLVM

; RUN: opt -passes="require<globals-aa>,cgscc(instcombine),function(loop-mssa(loop-simplifycfg)),recompute-globalsaa,function(loop-mssa(simple-loop-unswitch<nontrivial>),print<memoryssa>)" -disable-output < %s
; Check that don't crash if the Alias Analysis returns better results than
; before when cloning loop's memoryssa.
define void @f(ptr %p) {
entry:
%0 = load i16, ptr %p, align 1
ret void
}
define void @g(i1 %tobool.not) {
entry:
br label %for.cond
for.cond: ; preds = %if.then, %for.cond, %entry
br i1 %tobool.not, label %if.then, label %for.cond
if.then: ; preds = %for.cond
call void @f()
br label %for.cond
}