This is an archive of the discontinued LLVM Phabricator instance.

[DSE][NFC] Rename Later->Killing, Earlier->Dead
ClosedPublic

Authored by ebrevnov on Jul 28 2021, 4:46 AM.

Details

Summary

First (and biggest) change is to use "Killing/Dead" in place of "Later/Earlier" base for names in DSE. For example, [Maybe]DeadLoc - is a location killed by KillingI instruction. I believe such names are more descriptive and easy to understand than current ones.

Second, there are inconsistencies in naming where different names are used for the same thing. Fixed that too.

Third, reordered parameters of isPartialOverwrite, tryToMergePartialOverlappingStores, isOverwrite to make them consistent between each other. This greatly reduces potential mistakes.

Diff Detail

Event Timeline

ebrevnov created this revision.Jul 28 2021, 4:46 AM
ebrevnov requested review of this revision.Jul 28 2021, 4:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2021, 4:46 AM
ebrevnov retitled this revision from [DSE] Rename Later->Killing, Earlier->Killed to [DSE][WIP] Rename Later->Killing, Earlier->Killed.
ebrevnov retitled this revision from [DSE][WIP] Rename Later->Killing, Earlier->Killed to [DSE][NFC] Rename Later->Killing, Earlier->Killed.Jul 29 2021, 1:23 AM
ebrevnov edited the summary of this revision. (Show Details)
ebrevnov added a reviewer: fhahn.
fhahn added a comment.Aug 13 2021, 1:23 AM

Hm, the current names are not great, but at least for some functions, we are not sure yet if the passed in instructions actually 'kill' the earlier one, so using Killed/Killing may be a bit confusing in its own right?

Hm, the current names are not great, but at least for some functions, we are not sure yet if the passed in instructions actually 'kill' the earlier one, so using Killed/Killing may be a bit confusing in its own right?

English is not my native language so I may be mistaken. Google translate gives "killed" for adverb with the meaning of not yet completed action. Maybe there is another form for that?
Even though I like Killing/Killed pair more than Earlier/Later that's not the biggest deal. Biggest problem for me is inconsistency in naming. Sometimes It is hard to follow what is what. So I can go with Earlier/Later taken it is used consistently across source code.

English is not my native language so I may be mistaken. Google translate gives "killed" for adverb with the meaning of not yet completed action. Maybe there is another form for that?
Even though I like Killing/Killed pair more than Earlier/Later that's not the biggest deal. Biggest problem for me is inconsistency in naming. Sometimes It is hard to follow what is what. So I can go with Earlier/Later taken it is used consistently across source code.

Thanks for tackling the inconsistencies in the naming! I'm also not a native speaker so I am also not entirely sure about the subtleties. I've added a few other people who worked on DSE and may have additional thoughts/suggestions how to name the arguments as clearly as possible.

ebrevnov updated this revision to Diff 367164.Aug 18 2021, 3:46 AM

Resbase + Formatting

Thank you for doing this cleanup!
I agree the new names are more descriptive, but my feedback is that the code becomes very hard to read. I for one have a hard time following where in the code it says Killing and where Killed after the refactoring.
May I suggest using Killing and Dead (or variations of PotentiallyDead/MaybeDead etc)? Happy to hear other suggestions of names that have different "root" not just different declension.
Disclaimer: I'm not a native speaker either, just giving some thoughts :-).

Thank you for doing this cleanup!
I agree the new names are more descriptive, but my feedback is that the code becomes very hard to read. I for one have a hard time following where in the code it says Killing and where Killed after the refactoring.
May I suggest using Killing and Dead (or variations of PotentiallyDead/MaybeDead etc)? Happy to hear other suggestions of names that have different "root" not just different declension.
Disclaimer: I'm not a native speaker either, just giving some thoughts :-).

"Killing" and "Dead" looks OK for me. "Maybe" prefix already reserved for Optional values in the code. If there are no other suggestions in next few days I will go with this variant. Thanks!

fhahn added a comment.Sep 6 2021, 3:45 AM

Thank you for doing this cleanup!
I agree the new names are more descriptive, but my feedback is that the code becomes very hard to read. I for one have a hard time following where in the code it says Killing and where Killed after the refactoring.
May I suggest using Killing and Dead (or variations of PotentiallyDead/MaybeDead etc)? Happy to hear other suggestions of names that have different "root" not just different declension.
Disclaimer: I'm not a native speaker either, just giving some thoughts :-).

"Killing" and "Dead" looks OK for me. "Maybe" prefix already reserved for Optional values in the code. If there are no other suggestions in next few days I will go with this variant. Thanks!

Killing/Dead makes it easier to differentiate the two I think in general and looks good.

I think there are some places where the killing/dead terminology is a bit inaccurate for intermediate steps, e.g the first changed comment // 1. Get the next dominating clobbering MemoryDef (KilledAccess) by walking. At this point, it is not yet known whether the access is dead/killed. It is just a subtle difference in wording, but I think it might be worth to try to encode it in the name. Using MaybeDead/PotentiallyDead as suggested by @asbirlea in such cases seem good options. IMO the Maybe prefix is easier to follow and more compact and personally I am not too worried about it also being used for Optional.

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
1342–1343

comment here needs also updating

ebrevnov updated this revision to Diff 371033.Sep 7 2021, 4:12 AM
ebrevnov marked an inline comment as done.

Used MaybeDead* prefix in those places where it matters the most (in the first comment and in getDomMemoryDef). In all other places Dead* prefix is used.

[This may be beyond something to address in this patch] I'm wondering if there should be some consistency between isPartialOverwrite and isCompleteOverwrite. Both could use "Def" and "Use" naming, or "[Maybe]Dead" and "Killing" naming.

I'm good with the renaming, leaving @fhahn give the green light.

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
339

s/DeadII/DeadI

I think there are some places where the killing/dead terminology is a bit inaccurate for intermediate steps, e.g the first changed comment // 1. Get the next dominating clobbering MemoryDef (KilledAccess) by walking. At this point, it is not yet known whether the access is dead/killed. It is just a subtle difference in wording, but I think it might be worth to try to encode it in the name. Using MaybeDead/PotentiallyDead as suggested by @asbirlea in such cases seem good options. IMO the Maybe prefix is easier to follow and more compact and personally I am not too worried about it also being used for Optional.

Please take a look now.

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
339

Fixed. Thanks for noting.

fhahn accepted this revision.Sep 13 2021, 2:01 AM

LGTM with a few small nits. Thanks!

llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
339

Looks like this is still DeadII?

356–357

KillingI's mask?

366

a dead (big) store?

439–447

a dead store

444

a dead load.

This revision is now accepted and ready to land.Sep 13 2021, 2:01 AM
ebrevnov marked 5 inline comments as done.Sep 13 2021, 5:45 AM
ebrevnov added inline comments.
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
339

It was fixed locally. Uploading now.

ebrevnov marked an inline comment as done.Sep 13 2021, 5:52 AM

Please note that this change has dependence(s). Even though dependences are not strong I still would like to avoid extra work rebasing patches. Please take a look at D105105. Thank you!

ebrevnov updated this revision to Diff 373591.Sep 20 2021, 7:56 AM

Rebase on top of current tip

ebrevnov retitled this revision from [DSE][NFC] Rename Later->Killing, Earlier->Killed to [DSE][NFC] Rename Later->Killing, Earlier->Dead.Sep 20 2021, 10:14 PM
ebrevnov edited the summary of this revision. (Show Details)
This revision was landed with ongoing or failed builds.Sep 20 2021, 11:44 PM
This revision was automatically updated to reflect the committed changes.