[PATCH] D87149: [InstCombine] erase instructions leading up to unreachable
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 10:54:08 PDT 2020
spatel added a comment.
In D87149#2282232 <https://reviews.llvm.org/D87149#2282232>, @lebedev.ri wrote:
> Unreachable BB's were the obvious potential source for non-empty use-count, but i thought instcombine didn't combine instructions in unreachable blocks.
> Maybe that is the bug?
Instcombine tries to remove instructions in unreachable blocks, but we can create circular dependencies that instcombine can't reduce because it doesn't change the CFG. Here's a reduced version of the test (not sure if it's minimal):
define void @main(i16 %x) {
entry:
br label %for.cond
for.cond:
%p = phi double [ %conv, %g.exit ], [ undef, %entry ]
br i1 undef, label %for.end, label %for.body
for.body:
%conv = sitofp i16 %x to double
unreachable
g.exit:
br label %for.cond
for.end:
store double %p, double* undef
ret void
}
I guess we could try to eliminate phi operands if an incoming block (g.exit) is unreachable? But simplifycfg should do that already, so I don't know if we want instcombine trying to do that too.
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