[llvm] 4307446 - [SCEV] Fix -Wunused-variable warning (NFC)

Yang Fan via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 21 01:02:26 PDT 2021


Author: Yang Fan
Date: 2021-04-21T16:01:46+08:00
New Revision: 4307446e9fba75c8dd9a36576f1f972c5b5ccc4c

URL: https://github.com/llvm/llvm-project/commit/4307446e9fba75c8dd9a36576f1f972c5b5ccc4c
DIFF: https://github.com/llvm/llvm-project/commit/4307446e9fba75c8dd9a36576f1f972c5b5ccc4c.diff

LOG: [SCEV] Fix -Wunused-variable warning (NFC)

GCC warning:
```
/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp: In member function ‘const llvm::SCEV* llvm::ScalarEvolution::getLosslessPtrToIntExpr(const llvm::SCEV*, unsigned int)::SCEVPtrToIntSinkingRewriter::visitUnknown(const llvm::SCEVUnknown*)’:
/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:1152:13: warning: unused variable ‘ExprPtrTy’ [-Wunused-variable]
 1152 |       Type *ExprPtrTy = Expr->getType();
      |             ^~~~~~~~~
```

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 9e4814398b6b..498acfe2df85 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -1149,8 +1149,7 @@ const SCEV *ScalarEvolution::getLosslessPtrToIntExpr(const SCEV *Op,
     }
 
     const SCEV *visitUnknown(const SCEVUnknown *Expr) {
-      Type *ExprPtrTy = Expr->getType();
-      assert(ExprPtrTy->isPointerTy() &&
+      assert(Expr->getType()->isPointerTy() &&
              "Should only reach pointer-typed SCEVUnknown's.");
       return SE.getLosslessPtrToIntExpr(Expr, /*Depth=*/1);
     }


        


More information about the llvm-commits mailing list