[BasicAA] Make sure types match in constant offset heuristic
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 28 Mar 2021 19:20:50 +0000 (21:20 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 28 Mar 2021 19:38:09 +0000 (21:38 +0200)
commitce066da81c3e6175a02fa7ae831931b5e4126a2b
treefa645934a16e2832ec198aa49dd59eb4e872f221
parent36b5d09b079bd15edad8fcad122141f999ddd2f9
[BasicAA] Make sure types match in constant offset heuristic

This can only happen if offset types that are larger than the
pointer size are involved. The previous implementation did not
assert in this case because it initialized the APInts to the
width of one of the variables -- though I strongly suspect it
did not compute correct results in this case.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32621
reported by fhahn.
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Analysis/BasicAA/q.bad.ll