Skip to content

[InstCombine] We need to recursively enqueue users of instructions whose use-count changed #46582

@LebedevRI

Description

@LebedevRI
Bugzilla Link 47238
Version trunk
OS Linux
Attachments anoter testcase
CC @fhahn,@nikic,@rotateright

Extended Description

And i think we've finally found a fundamental issue :S
https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20200817/821034.html

While so far we've managed to get out of all the extra iterations by consistently
enqueueing all the operands to be revisited, i'm not sure it's really that simple.

Here, we have basically the following:

%i0 = cmp with non-canonical pred
%i1 = not %i0
%i2 = some-op %i0

First time around, we don't manage to fold the %i1 (by flipping cmp predicate),
because %i0 has other uses, but manage to fold away %i2, reducing use count of %i0.
We do enqueue %i0, but that does us no good, because we need to revisit %i1,
which we don't during this iteration.

So basically, not only do we need to enqueue the values whose use-count changed,
we also need to recursively enqueue users of these instructions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillallvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions