[llvm] 02eb381 - [SCEVExpander] Remove unused variable [NFC]

Mikael Holmen via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 01:38:03 PDT 2023


Author: Mikael Holmen
Date: 2023-09-29T10:35:59+02:00
New Revision: 02eb38119eda7c060a6b96a1169fd2b98992b617

URL: https://github.com/llvm/llvm-project/commit/02eb38119eda7c060a6b96a1169fd2b98992b617
DIFF: https://github.com/llvm/llvm-project/commit/02eb38119eda7c060a6b96a1169fd2b98992b617.diff

LOG: [SCEVExpander] Remove unused variable [NFC]

gcc warned about it:
 ../lib/Transforms/Utils/ScalarEvolutionExpander.cpp: In lambda function:
 ../lib/Transforms/Utils/ScalarEvolutionExpander.cpp:2104:22: warning: unused variable 'ARPtrTy' [-Wunused-variable]
  2104 |     if (PointerType *ARPtrTy = dyn_cast<PointerType>(ARTy)) {
       |                      ^~~~~~~
Fix the warning by removing the variable and turn dyn_cast into isa.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
index 40faee5ecd97c85..5c976d574854283 100644
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -2101,7 +2101,7 @@ Value *SCEVExpander::generateOverflowCheck(const SCEVAddRecExpr *AR,
     bool NeedPosCheck = !SE.isKnownNegative(Step);
     bool NeedNegCheck = !SE.isKnownPositive(Step);
 
-    if (PointerType *ARPtrTy = dyn_cast<PointerType>(ARTy)) {
+    if (isa<PointerType>(ARTy)) {
       Value *NegMulV = Builder.CreateNeg(MulV);
       if (NeedPosCheck)
         Add = Builder.CreateGEP(Builder.getInt8Ty(), StartValue, MulV);


        


More information about the llvm-commits mailing list