[llvm] [LV] Remove common extends and selects in CSE (PR #147731)

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 05:41:06 PDT 2025


================
@@ -804,6 +804,10 @@ int FunctionComparator::cmpOperations(const Instruction *L,
         return Res;
     }
   }
+  if (const CastInst *Cast = dyn_cast<CastInst>(L)) {
+    const CastInst *CastR = cast<CastInst>(R);
+    return cmpTypes(Cast->getDestTy(), CastR->getDestTy());
----------------
SamTebbs33 wrote:

Removed because it's caught by
```  
if (int Res = cmpTypes(L->getType(), R->getType()))
    return Res;
```
and I've added a test to make sure.

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


More information about the llvm-commits mailing list