[InstCombine] check alloc size in bitcast of geps fold (PR44321)
authorSanjay Patel <spatel@rotateright.com>
Sat, 21 Dec 2019 15:31:21 +0000 (10:31 -0500)
committerSanjay Patel <spatel@rotateright.com>
Sat, 21 Dec 2019 15:31:21 +0000 (10:31 -0500)
commit79c7fa31f3aafba77862325cdc70a3ece7f71950
treee3b6de07d420479eb5162731ef5187e122411c28
parent19f9f374d9afe3efd33dc1943d3d7fd2c54fba76
[InstCombine] check alloc size in bitcast of geps fold (PR44321)

We missed a constraint in D44833
when folding a bitcast into a GEP with vector/array types.
If the alloc sizes specified by the datalayout don't match,
this could miscompile as shown in:
https://bugs.llvm.org/show_bug.cgi?id=44321

Differential Revision: https://reviews.llvm.org/D71771
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/gep-vector.ll