[clang] [llvm] [CodeGenPrepare] Failure to hoist bitcast to legal type causes register splitting (PR #207568)

via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 5 07:12: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/CodeGenPrepare.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/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 16d6a5da5..76d860cdc 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -8993,12 +8993,12 @@ bool CodeGenPrepare::optimizeInst(Instruction *I, ModifyDT &ModifiedDT) {
     // evaluation in a block other than then one that uses it (e.g. to hoist
     // the address of globals out of a loop).  If this is the case, we don't
     // want to forward-subst the cast.
-    
+
     if (auto *BCI = dyn_cast<BitCastInst>(CI)) {
       // Hoist bitcasts of illegal types to reduce cross-block register pressure
       // and prevent register splitting.
       if (optimizeBitCast(BCI, *TLI, *DL)) {
-        return true;        
+        return true;
       }
     }
 

``````````

</details>


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


More information about the cfe-commits mailing list