[llvm] [GlobalISel] Remove an unnecessary cast (NFC) (PR #146249)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 28 18:08:41 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-globalisel

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

Idx is already of unsigned.


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


1 Files Affected:

- (modified) llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp b/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
index 1c4150127a908..b2f84351c9a95 100644
--- a/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LoadStoreOpt.cpp
@@ -458,7 +458,7 @@ bool LoadStoreOpt::processMergeCandidate(StoreMergeCandidate &C) {
     for (auto AliasInfo : reverse(C.PotentialAliases)) {
       MachineInstr *PotentialAliasOp = AliasInfo.first;
       unsigned PreCheckedIdx = AliasInfo.second;
-      if (static_cast<unsigned>(Idx) < PreCheckedIdx) {
+      if (Idx < PreCheckedIdx) {
         // Once our store index is lower than the index associated with the
         // potential alias, we know that we've already checked for this alias
         // and all of the earlier potential aliases too.

``````````

</details>


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


More information about the llvm-commits mailing list