Skip to content

Commit 31d398d

Browse files
committed
Approved by Chris:
$ svn merge -c 113146 https://llvm.org/svn/llvm-project/llvm/trunk --- Merging r113146 into '.': U test/Transforms/LICM/crash.ll U lib/Transforms/Scalar/LICM.cpp Log: fix PR8067, an over-aggressive assertion in LICM. llvm-svn: 113152
1 parent 4217ff2 commit 31d398d

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

llvm/lib/Transforms/Scalar/LICM.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -696,10 +696,10 @@ void LICM::PromoteAliasSet(AliasSet &AS) {
696696
// it.
697697
if (isa<LoadInst>(Use))
698698
assert(!cast<LoadInst>(Use)->isVolatile() && "AST broken");
699-
else if (isa<StoreInst>(Use))
700-
assert(!cast<StoreInst>(Use)->isVolatile() &&
701-
Use->getOperand(0) != ASIV && "AST broken");
702-
else
699+
else if (isa<StoreInst>(Use)) {
700+
assert(!cast<StoreInst>(Use)->isVolatile() && "AST broken");
701+
if (Use->getOperand(0) == ASIV) return;
702+
} else
703703
return; // Not a load or store.
704704

705705
if (!GuaranteedToExecute)

llvm/test/Transforms/LICM/crash.ll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,17 @@ for.cond.for.end10_crit_edge: ; preds = %for.cond
2525
for.end10: ; preds = %for.cond.for.end10_crit_edge, %entry
2626
ret void
2727
}
28+
29+
; PR8067
30+
@g_8 = external global i32, align 4
31+
32+
define void @test2() noreturn nounwind ssp {
33+
entry:
34+
br label %for.body
35+
36+
for.body: ; preds = %for.body, %entry
37+
%tmp7 = load i32* @g_8, align 4
38+
store i32* @g_8, i32** undef, align 16
39+
store i32 undef, i32* @g_8, align 4
40+
br label %for.body
41+
}

0 commit comments

Comments
 (0)