Skip to content

Early-CSE is not idempotent #9363

@llvmbot

Description

@llvmbot
Bugzilla Link 8991
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @lattner

Extended Description

Running the Early-CSE several times in succession results in more
simplifications than running it once, for example:

$ opt -disable-output -stats gcc.bc -early-cse
===-------------------------------------------------------------------------===
... Statistics Collected ...
===-------------------------------------------------------------------------===

24 early-cse    - Number of call instructions CSE'd

190990 early-cse - Number of instructions CSE'd
68115 early-cse - Number of instructions simplified or DCE'd
44538 early-cse - Number of load instructions CSE'd
140 early-cse - Number of trivial dead stores removed
2 instsimplify - Number of expansions
31 instsimplify - Number of reassociations

$ opt -disable-output -stats gcc.bc -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse -early-cse
===-------------------------------------------------------------------------===
... Statistics Collected ...
===-------------------------------------------------------------------------===

24 early-cse    - Number of call instructions CSE'd

190993 early-cse - Number of instructions CSE'd
70166 early-cse - Number of instructions simplified or DCE'd
44587 early-cse - Number of load instructions CSE'd
176 early-cse - Number of trivial dead stores removed
18 instsimplify - Number of expansions
271 instsimplify - Number of reassociations

That's about a 3% increase in "Number of instructions simplified or DCE'd"
and a 25% increase in "Number of trivial dead stores removed".

My guess is that when an instruction is CSE'd/simplified, its uses are not
being revisited/recursively CSE'd/simplified. I think this can only occur
in loops when uses occur before the instruction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions