diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -877,7 +877,7 @@ } } else if (auto *CstPtr = dyn_cast(this)) { if (auto *CstInt = dyn_cast_or_null(ConstantExpr::getPtrToInt( - const_cast(CstPtr), DL.getIntPtrType(getType()), + const_cast(CstPtr), DL.getIndexType(getType()), /*OnlyIfReduced=*/true))) { size_t TrailingZeros = CstInt->getValue().countTrailingZeros(); // While the actual alignment may be large, elsewhere we have