[PATCH] D87149: [InstCombine] erase instructions leading up to unreachable
Mikael Holmén via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 00:32:25 PDT 2020
uabelho added a comment.
Hi!
We've run into a case where instcombine crashes with this patch:
opt -o /dev/null bbi-47401.ll -instcombine
on
@c = external global i16*, align 1
define void @main() {
entry:
br label %for.cond
for.cond: ; preds = %g.exit, %entry
%conv1 = phi double [ %conv, %g.exit ], [ undef, %entry ]
br i1 undef, label %for.end, label %for.body
for.body: ; preds = %for.cond
%0 = load i16*, i16** @c, align 1
%1 = load i16, i16* %0, align 1
%conv = sitofp i16 %1 to double
unreachable
g.exit: ; No predecessors!
br label %for.cond
for.end: ; preds = %for.cond
%conv1.lcssa = phi double [ %conv1, %for.cond ]
store double %conv1.lcssa, double* undef, align 1
ret void
}
results in
opt: ../lib/Transforms/InstCombine/InstCombineInternal.h:448: virtual llvm::Instruction *llvm::InstCombinerImpl::eraseInstFromFunction(llvm::Instruction &): Assertion `I.use_empty() && "Cannot erase instruction that is used!"' failed.
I suppose it's the dead block %g.exit that messes up things.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87149/new/
https://reviews.llvm.org/D87149
More information about the llvm-commits
mailing list