Skip to content

Conversation

@paschalis-mpeis
Copy link
Member

@paschalis-mpeis paschalis-mpeis commented Jul 11, 2024

createDummyReturnFunction is not creating a function but instead only
a function body that is simply a return statement.
This patch renames it to: createReturnInstructionList


Stacked on top of:

@paschalis-mpeis paschalis-mpeis marked this pull request as ready for review July 11, 2024 08:42
@llvmbot llvmbot added the BOLT label Jul 11, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 11, 2024

@llvm/pr-subscribers-bolt

Author: Paschalis Mpeis (paschalis-mpeis)

Changes

createDummyReturnFunction is not creating a function but instead only a function body
that is simply a return statement.

This patch renames it to createReturnBody


Stacked on top of:

  • #96626

Full diff: https://github.com/llvm/llvm-project/pull/98448.diff

2 Files Affected:

  • (modified) bolt/include/bolt/Core/MCPlusBuilder.h (+1-1)
  • (modified) bolt/lib/Passes/Instrumentation.cpp (+1-1)
diff --git a/bolt/include/bolt/Core/MCPlusBuilder.h b/bolt/include/bolt/Core/MCPlusBuilder.h
index 885d627f7b64f..c20b0edc36499 100644
--- a/bolt/include/bolt/Core/MCPlusBuilder.h
+++ b/bolt/include/bolt/Core/MCPlusBuilder.h
@@ -2044,7 +2044,7 @@ class MCPlusBuilder {
   /// Returns a function body that contains only a return instruction. An
   /// example usage is a workaround for the '__bolt_fini_trampoline' of
   // Instrumentation.
-  virtual InstructionListType createDummyReturnFunction(MCContext *Ctx) const {
+  virtual InstructionListType createReturnBody(MCContext *Ctx) const {
     InstructionListType Insts(1);
     createReturn(Insts[0]);
     return Insts;
diff --git a/bolt/lib/Passes/Instrumentation.cpp b/bolt/lib/Passes/Instrumentation.cpp
index e824a42d82696..805e7a7434f8f 100644
--- a/bolt/lib/Passes/Instrumentation.cpp
+++ b/bolt/lib/Passes/Instrumentation.cpp
@@ -754,7 +754,7 @@ void Instrumentation::createAuxiliaryFunctions(BinaryContext &BC) {
       // with unknown symbol in runtime library. E.g. for static PIE
       // executable
       createSimpleFunction("__bolt_fini_trampoline",
-                           BC.MIB->createDummyReturnFunction(BC.Ctx.get()));
+                           BC.MIB->createReturnBody(BC.Ctx.get()));
     }
   }
 }

Copy link
Contributor

@aaupov aaupov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: createReturnInstructionList

Copy link
Contributor

@samolisov samolisov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@paschalis-mpeis paschalis-mpeis force-pushed the users/paschalis-mpeis/bolt-create-dummy-return branch 2 times, most recently from 19e7cb3 to fa4ded3 Compare July 12, 2024 08:53
@paschalis-mpeis paschalis-mpeis force-pushed the users/paschalis-mpeis/nfc-rename-createDummyReturnFunction branch from b564185 to 2e9d663 Compare July 12, 2024 09:08
@paschalis-mpeis paschalis-mpeis changed the title [NFC][BOLT] Rename createDummyReturnFunction to createReturnBody NFC][BOLT] Rename createDummyReturnFunction to createReturnInstructionList Jul 12, 2024
@paschalis-mpeis paschalis-mpeis changed the title NFC][BOLT] Rename createDummyReturnFunction to createReturnInstructionList NFC][BOLT] Rename createDummyReturnFunction to createReturnInstructi.. Jul 12, 2024
@paschalis-mpeis
Copy link
Member Author

Rebased on top of the updated #96626
Thanks for suggesting createReturnInstructionList; I think it's better so I used it.

Base automatically changed from users/paschalis-mpeis/bolt-create-dummy-return to main July 15, 2024 06:20
@paschalis-mpeis paschalis-mpeis force-pushed the users/paschalis-mpeis/nfc-rename-createDummyReturnFunction branch from 2e9d663 to 62d9398 Compare July 15, 2024 07:00
…onList

createDummyReturnFunction is not creating a function but instead only
a function body that is simply a return statement.
This patch renames it to:
createReturnInstructionList
@paschalis-mpeis paschalis-mpeis force-pushed the users/paschalis-mpeis/nfc-rename-createDummyReturnFunction branch from 62d9398 to 8c147e0 Compare July 15, 2024 07:03
@paschalis-mpeis
Copy link
Member Author

Forced-pushed to rebase and re-trigger tests. Will merge by EOD.

@paschalis-mpeis paschalis-mpeis merged commit deff3af into main Jul 15, 2024
@paschalis-mpeis paschalis-mpeis deleted the users/paschalis-mpeis/nfc-rename-createDummyReturnFunction branch July 15, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants