[llvm] [TargetLowering][COFF] Allow GlobalAlias in lowerRelativeReference (PR #220674)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 20:55:04 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index caf32e1c3..2756ea19f 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -2119,16 +2119,15 @@ const MCExpr *TargetLoweringObjectFileCOFF::lowerRelativeReference(
     return nullptr;
 
   const auto *GA = dyn_cast<GlobalAlias>(LHS);
-  const GlobalObject *GO =
-      GA ? dyn_cast_or_null<GlobalObject>(GA->getAliasee())
-         : dyn_cast<GlobalObject>(LHS);
+  const GlobalObject *GO = GA ? dyn_cast_or_null<GlobalObject>(GA->getAliasee())
+                              : dyn_cast<GlobalObject>(LHS);
 
   // Both ptrtoint instructions must wrap global objects:
   // - Only dso_local global variables/functions (or direct aliases thereof) are
   //   eligible for image relative relocations.
-  // - The subtrahend refers to the special symbol __ImageBase, a GlobalVariable.
-  // We expect __ImageBase to be a global variable without a section, externally
-  // defined.
+  // - The subtrahend refers to the special symbol __ImageBase, a
+  // GlobalVariable. We expect __ImageBase to be a global variable without a
+  // section, externally defined.
   //
   // It should look something like this: @__ImageBase = external constant i8
   if (!GO || !TM.shouldAssumeDSOLocal(LHS) || GO->isThreadLocal() ||

``````````

</details>


https://github.com/llvm/llvm-project/pull/220674


More information about the llvm-commits mailing list