Fix incorrect GEP bitwidth in areNonOverlapSameBaseLoadAndStore()
authorAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Tue, 28 Sep 2021 14:10:39 +0000 (15:10 +0100)
committerAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Tue, 28 Sep 2021 16:57:36 +0000 (17:57 +0100)
commit3c51b9e270bac26fdec1b06ae8dd72960a2353a3
treee0830755ed06fd87ffdf97acbbafb95f6a66afaf
parent547e5e4ae613cf5ae3727abef84d5ac0334d9987
Fix incorrect GEP bitwidth in areNonOverlapSameBaseLoadAndStore()

When using a datalayout that has pointer index width != pointer size this
code triggers an assertion in Value::stripAndAccumulateConstantOffsets().
I encountered this this while compiling FreeBSD for CHERI-RISC-V.
Also update LoadsTest.cpp to use a DataLayout with index width != pointer
width to ensure this case is tested.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D110406
llvm/lib/Analysis/Loads.cpp
llvm/unittests/Analysis/LoadsTest.cpp