[SCEV] Don't crash on pointer comparisons
authorSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 28 Sep 2015 21:14:32 +0000 (21:14 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 28 Sep 2015 21:14:32 +0000 (21:14 +0000)
commit31d74407b94b178f70726993b8cd74d894987181
tree8779010cf59010a049efd53ca4b50a01c00ef095
parente706695c2f184cbe35bd2149453f1bdaea5d671c
[SCEV] Don't crash on pointer comparisons

`ScalarEvolution::isImpliedCondOperandsViaNoOverflow` tries to cast the
operand type of the comparison it is given to an `IntegerType`.  This is
incorrect because it could actually be simplifying a comparison between
two pointers.  Switch it to using `getTypeSizeInBits` instead, which
does the right thing for both pointers and integers.

Fixed PR24956.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248743 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
test/Transforms/IndVarSimplify/pr24956.ll [new file with mode: 0644]