[ConstantFold] Use getMinSignedBits for APInt in isIndexInRangeOfArrayType.
authorFlorian Hahn <flo@fhahn.com>
Wed, 12 Dec 2018 18:55:14 +0000 (18:55 +0000)
committerFlorian Hahn <flo@fhahn.com>
Wed, 12 Dec 2018 18:55:14 +0000 (18:55 +0000)
commit81a22d32f7c0318284d755187b417012c58e53e2
tree07fc3829b52f206f0ff2f00856b57fc6c1069244
parent5864ab2dc0b4e9866b59748484c20bb13bfbf214
[ConstantFold] Use getMinSignedBits for APInt in isIndexInRangeOfArrayType.

Indices for getelementptr can be signed so we should use
getMinSignedBits instead of getActiveBits here. The function later calls
getSExtValue to get the int64_t value, which also checks
getMinSignedBits.

This fixes  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11647.

Reviewers: mssimpso, efriedma, davide

Reviewed By: efriedma

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

llvm-svn: 348957
llvm/lib/IR/ConstantFold.cpp
llvm/test/Transforms/SCCP/apint-bigint2.ll