Add tests to reproduce pointer/index width confusion crashes
authorKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Thu, 23 Feb 2023 21:47:48 +0000 (21:47 +0000)
committerKrzysztof Drewniak <Krzysztof.Drewniak@amd.com>
Thu, 23 Feb 2023 22:50:43 +0000 (22:50 +0000)
commit5a4f193afa0d73f7ec459648d8f02535577dd604
treec8e72258e729179edb7c9ba294e07bb47572a433
parentf78c34346635e25919e2777b1b1cbb9627d5ad43
Add tests to reproduce pointer/index width confusion crashes

Some calls to GEPOperator::accumulateConstantOffset(APInt) passed the
pointer bitwidth as the width of the APInt, while the function asserts
that the width of its argument is equal to the index width of the GEP
pointer input. These values are almost always the same, so mixing up
which call to use doesn't usually cause issues. However, when dealing
with data layouts where these values are different, the passes tested
here can crash.

This will be fixed in D143437 .

Differential Revision: https://reviews.llvm.org/D144673
llvm/test/Transforms/LowerTypeTests/distinct-index-width-crash.ll [new file with mode: 0644]
llvm/test/Transforms/MergeFunc/different-index-width-gep-crash.ll [new file with mode: 0644]
llvm/test/Transforms/MergeICmps/X86/distinct-index-width-crash.ll [new file with mode: 0644]