OSDN Git Service

[ConstantFolding] Fix assertion failure on non-power-of-two vector load.
authorJay Foad <jay.foad@gmail.com>
Wed, 19 Jun 2019 10:28:48 +0000 (10:28 +0000)
committerJay Foad <jay.foad@gmail.com>
Wed, 19 Jun 2019 10:28:48 +0000 (10:28 +0000)
commitc54dc662182f94283a280845516126af96b29751
tree8f49f2f99e683ff48052e77cb19b470d2170d184
parenta40de1884c10929b523e9919b0da04db44f8cfc2
[ConstantFolding] Fix assertion failure on non-power-of-two vector load.

Summary:
The test case does an (out of bounds) load from a global constant with
type <3 x float>. InstSimplify tried to turn this into an integer load
of the whole alloc size of the vector, which is 128 bits due to
alignment padding, and then bitcast this to <3 x vector> which failed
an assertion due to the type size mismatch.

The fix is to do an integer load of the normal size of the vector, with
no alignment padding.

Reviewers: tpr, arsenm, majnemer, dstuttard

Reviewed By: arsenm

Subscribers: hfinkel, wdng, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63375

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363784 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ConstantFolding.cpp
test/Transforms/InstSimplify/load.ll