[llvm] 15b6871 - [SCEV] Remove unnecessary cast code (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 01:38:20 PDT 2023


Author: Nikita Popov
Date: 2023-09-29T10:38:12+02:00
New Revision: 15b687131f52ad3cc4fcb93abe73b77e680b79bf

URL: https://github.com/llvm/llvm-project/commit/15b687131f52ad3cc4fcb93abe73b77e680b79bf
DIFF: https://github.com/llvm/llvm-project/commit/15b687131f52ad3cc4fcb93abe73b77e680b79bf.diff

LOG: [SCEV] Remove unnecessary cast code (NFC)

The types should always match here. Possibly this is a leftover
from pre-opaque-pointers times.

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 5a994ae2ea4f458..7c234fa309a0c29 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -9941,10 +9941,7 @@ const SCEV *ScalarEvolution::computeSCEVAtScope(const SCEV *V, const Loop *L) {
       Constant *C = BuildConstantFromSCEV(OpV);
       if (!C)
         return V;
-      if (C->getType() != Op->getType())
-        C = ConstantExpr::getCast(
-            CastInst::getCastOpcode(C, false, Op->getType(), false), C,
-            Op->getType());
+      assert(C->getType() == Op->getType() && "Type mismatch");
       Operands.push_back(C);
     }
 


        


More information about the llvm-commits mailing list