This is an archive of the discontinued LLVM Phabricator instance.

[GVN] Fold equivalent freeze instructions
ClosedPublic

Authored by aqjune on Feb 28 2020, 10:01 PM.

Details

Summary

This patch defines two freeze instructions to have the same value number if they are equivalent.

This is allowed because GVN replaces all uses of a duplicated instruction with another.

If it partially rewrites use, it is not allowed. e.g)

a = freeze(x)
b = freeze(x)
use(a)
use(a)
use(b)
=>
use(a)
use(b) // This is not allowed!
use(b)

Diff Detail

Event Timeline

aqjune created this revision.Feb 28 2020, 10:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2020, 10:01 PM

What about NewGVN?

What about NewGVN?

I'll add support for NewGVN in a separate patch - a bit of time for studying how NewGVN works is needed.

fhahn accepted this revision.Feb 29 2020, 7:49 AM

LGTM, thanks.

Could you add a bit more complex test cases before committing, including multiple users and equivalent freeze instructions that do not dominate each other?

This revision is now accepted and ready to land.Feb 29 2020, 7:49 AM
aqjune updated this revision to Diff 247463.Feb 29 2020, 2:28 PM

Add multi-use/non-dominating cases to the test

aqjune updated this revision to Diff 247464.Feb 29 2020, 2:31 PM

Update the test

This revision was automatically updated to reflect the committed changes.