[llvm] [polly] [SCEV] Use SCEVPtrToAddr instead of SCEVPtrToInt in SCEV. (PR #180244)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 7 17:35:26 PST 2026


================
@@ -1155,10 +1116,22 @@ const SCEV *ScalarEvolution::getPtrToAddrExpr(const SCEV *Op) {
 const SCEV *ScalarEvolution::getPtrToIntExpr(const SCEV *Op, Type *Ty) {
   assert(Ty->isIntegerTy() && "Target type must be an integer type!");
 
-  const SCEV *IntOp = getLosslessPtrToIntExpr(Op);
-  if (isa<SCEVCouldNotCompute>(IntOp))
-    return IntOp;
+  // It isn't legal for optimizations to construct new ptrtoint expressions
+  // for non-integral pointers.
+  if (getDataLayout().isNonIntegralPointerType(Op->getType()))
----------------
arichardson wrote:

This restriction should only be needed for pointers with unstable value representation. But we can also do this relaxation as a follow-up change seeing as this is just updating existing code. 

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


More information about the llvm-commits mailing list