[PATCH] D132089: [BOLT][NFC] Simplify handleRelocation

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 20:41:30 PDT 2022


Amir added inline comments.


================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:2428-2429
   if (!IsSectionRelocation) {
-    if (BinaryFunction *BF =
-            BC->getBinaryFunctionContainingAddress(SymbolAddress)) {
+    BinaryFunction *BF = BC->getBinaryFunctionContainingAddress(SymbolAddress);
+    if (BF) {
       if (BF != ReferencedBF) {
----------------
rafauler wrote:
> I think it's better to have BinaryFunction *BF inside the if clause, so it's clear that the scope of the BF variable does not extend past this if. Unless I'm missing something else.
Sure. I've made the change because there's no scope difference as there's no code past the if clause (here and below with RogueBF), but let's keep it explicit that the scope is restricted to the if clause.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132089/new/

https://reviews.llvm.org/D132089



More information about the llvm-commits mailing list