This is an archive of the discontinued LLVM Phabricator instance.

[NewGVN] Fold equivalent freeze instructions
ClosedPublic

Authored by foad on Jun 9 2023, 5:48 AM.

Diff Detail

Event Timeline

foad created this revision.Jun 9 2023, 5:48 AM
foad requested review of this revision.Jun 9 2023, 5:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2023, 5:48 AM
nikic accepted this revision.Jun 9 2023, 5:50 AM

LGTM

This revision is now accepted and ready to land.Jun 9 2023, 5:50 AM
foad updated this revision to Diff 529967.Jun 9 2023, 7:41 AM

Rebase on fixed test case.

aqjune added a comment.Jun 9 2023, 8:47 AM

To check, does NewGVN fully replace one instruction with another, it they are considered equivalent?

This is to ensure that partial replacements like this doesn't happen:

a = freeze(x)
b = freeze(x)
use(a)
use(b)
use(b)
=/=>
use(a)
use(a)
use(b) // this is wrong; this also must be use(a).

b in this example must be fully replaced with a to be correct.

To check, does NewGVN fully replace one instruction with another, it they are considered equivalent?

I am not 100% sure. Do we have any NewGVN experts?

kmitropoulou added a comment.EditedJun 9 2023, 9:44 AM

To check, does NewGVN fully replace one instruction with another, it they are considered equivalent?

I am not 100% sure. Do we have any NewGVN experts?

The operands of the two freeze instructions are the same. So, the two freeze instructions are equivalent. Therefore, all the uses of b will be replaced with a.

foad added a comment.Jun 9 2023, 10:43 AM

To check, does NewGVN fully replace one instruction with another, it they are considered equivalent?

I am not 100% sure. Do we have any NewGVN experts?

The operands of the two freeze instructions are the same. So, the two freeze instructions are equivalent. Therefore, all the uses of b will be replaced with a.

Thanks! That's good enough for me.

aqjune accepted this revision.Jun 9 2023, 10:50 AM

Thanks for a reply!

This revision was landed with ongoing or failed builds.Jun 9 2023, 1:03 PM
This revision was automatically updated to reflect the committed changes.