[BasicAA] Correct handle implicit sext in decomposition
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 27 Mar 2021 14:15:47 +0000 (15:15 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 27 Mar 2021 14:15:47 +0000 (15:15 +0100)
commitb981bc30bf1a21c753a07bbb6f4e40140cdec3c4
treee68ae9de88aaddb771844e46580aed351e050376
parent60f3e8fbe44f12ea28760c2771f8bf48dc08abe8
[BasicAA] Correct handle implicit sext in decomposition

While explicit sext instructions were handled correctly, the
implicit sext that occurs if the offset is smaller than the
pointer size blindly assumed that sext(X * Scale + Offset) is the
same as sext(X) * Scale + Offset, which is obviously not correct.

Fix this by extracting the code that handles linear expression
extension and reusing it for the implicit sext as well.
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Analysis/BasicAA/gep-modulo.ll
llvm/test/Analysis/BasicAA/zext.ll