[llvm] a3113df - [SCEV] PtrToInt on non-integral pointers is allowed

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 00:25:09 PDT 2021


Author: Roman Lebedev
Date: 2021-06-16T10:24:25+03:00
New Revision: a3113df21994fafd87d623e13364321659f4585c

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

LOG: [SCEV] PtrToInt on non-integral pointers is allowed

As per (committed without review) @reames's rGac81cb7e6dde9b0890ee1780eae94ab96743569b change,
we are now allowed to produce `ptrtoint` for non-integral pointers.
This will unblock further unbreaking of SCEV regarding int-vs-pointer type confusion.

Reviewed By: mkazantsev

Differential Revision: https://reviews.llvm.org/D104322

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 275fad4acb2b..0dd7be566ad4 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -1060,9 +1060,6 @@ const SCEV *ScalarEvolution::getLosslessPtrToIntExpr(const SCEV *Op,
   if (!Op->getType()->isPointerTy())
     return Op;
 
-  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