[llvm] [Scalar] Remove an unnecessary cast (NFC) (PR #151849)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 2 23:47:44 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

LoadType is already of Type *.


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


1 Files Affected:

- (modified) llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp b/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
index 6bdf76f789a49..a8839981e5478 100644
--- a/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
@@ -117,7 +117,7 @@ struct StoreToLoadForwardingCandidate {
     if (std::abs(StrideLoad) != 1)
       return false;
 
-    unsigned TypeByteSize = DL.getTypeAllocSize(const_cast<Type *>(LoadType));
+    unsigned TypeByteSize = DL.getTypeAllocSize(LoadType);
 
     auto *LoadPtrSCEV = cast<SCEVAddRecExpr>(PSE.getSCEV(LoadPtr));
     auto *StorePtrSCEV = cast<SCEVAddRecExpr>(PSE.getSCEV(StorePtr));

``````````

</details>


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


More information about the llvm-commits mailing list