[llvm] 41c22ac - [NFC][SCEV] Assert that we don't try to create SCEVPtrToIntExpr of a non-integral pointer
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 19 08:39:24 PDT 2021
Author: Roman Lebedev
Date: 2021-04-19T18:38:38+03:00
New Revision: 41c22acc22a54ceb78dc863470b8819052d31d77
URL: https://github.com/llvm/llvm-project/commit/41c22acc22a54ceb78dc863470b8819052d31d77
DIFF: https://github.com/llvm/llvm-project/commit/41c22acc22a54ceb78dc863470b8819052d31d77.diff
LOG: [NFC][SCEV] Assert that we don't try to create SCEVPtrToIntExpr of a non-integral pointer
ptr<->int casts are only valid for integral pointes,
defensively assert that we don't try to break that here.
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index f92cccd44816..cb820dfde632 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -1053,6 +1053,9 @@ const SCEV *ScalarEvolution::getPtrToIntExpr(const SCEV *Op, Type *Ty,
if (!Op->getType()->isPointerTy())
return getTruncateOrZeroExtend(Op, Ty);
+ assert(!getDataLayout().isNonIntegralPointerType(Op->getType()) &&
+ "Source pointer type must be integral for ptrtoint!");
+
// What would be an ID for such a SCEV cast expression?
FoldingSetNodeID ID;
ID.AddInteger(scPtrToInt);
More information about the llvm-commits
mailing list