This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][NFC] Builder InsertionGuard::saveInsertionPoint -> savedInsertionPoint
AbandonedPublic

Authored by bondhugula on Apr 11 2020, 12:43 AM.

Details

Summary

Change misleading method name. This isn't saving an insertion point but
returning the saved insertion point.

Diff Detail

Event Timeline

bondhugula created this revision.Apr 11 2020, 12:43 AM
Herald added a project: Restricted Project. · View Herald Transcript
rriddle requested changes to this revision.EditedApr 11 2020, 12:48 AM

I'm not +1 on this change. The function is a verb, i.e. it is requesting that the builder "save" the current insertion point inside of an InsertionPoint and return it.

This revision now requires changes to proceed.Apr 11 2020, 12:48 AM

Verbifying the function name would be better, i.e. getSavedInsertionPoint.

But I still don't see a reason to change.

This also matches the same verbiage in other parts of LLVM, IRBuilder::saveIP/llvm::SaveAndRestore/etc.

I'm not +1 on this change. The function is a verb, i.e. it is requesting that the builder "save" the current insertion point inside of an InsertionPoint and return it.

Hmm... but it's not saving the current insertion point. It's only returning the saved one. It's the InsertionGuard ctor that's saving the insertion point. Am I missing something?

This also matches the same verbiage in other parts of LLVM, IRBuilder::saveIP/llvm::SaveAndRestore/etc.

Oh I see - the saveInsertionPoint here is used to refer to the insertion point to use for saving?

This also matches the same verbiage in other parts of LLVM, IRBuilder::saveIP/llvm::SaveAndRestore/etc.

Oh I see - the saveInsertionPoint here is used to refer to the insertion point to use for saving?

Yeah, sorry about the short replies. The way that it is intended to be read is that you are saving the current insertion point of the builder and storing it somewhere else. That is why there is the companion restore method, so that you can restore a previously saved insertion point. The reason why "saved" sounds weird is that the builder isn't saving an insertion point, it just has one.

bondhugula abandoned this revision.Apr 11 2020, 5:57 AM