OSDN Git Service

[ConstantFolding, ValueTracking] Fold constants involving bitcasts of ConstantVector
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 4 May 2016 06:13:33 +0000 (06:13 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 4 May 2016 06:13:33 +0000 (06:13 +0000)
commitc454f3e11164b3fa66154a8c29cfc5dad3065240
treecd96c17c2ed8108a4de9d86d28c30d901f082490
parent125d646f2da676af2be6189c5eec8e0c0bb1ef24
[ConstantFolding, ValueTracking] Fold constants involving bitcasts of ConstantVector

We assumed that ConstantVectors would be rather uninteresting from the
perspective of analysis.  However, this is not the case due to a quirk
of how LLVM handles vectors of i1.  Vectors of i1 are not
ConstantDataVectors like vectors of i8, i16, i32 or i64 because i1's
SizeInBits differs from it's StoreSizeInBytes.  This leads to it being
categorized as a ConstantVector instead of a ConstantDataVector.

Instead, treat ConstantVector more uniformly.

This fixes PR27591.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268479 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ConstantFolding.cpp
lib/Analysis/ValueTracking.cpp
test/Transforms/InstCombine/pr20678.ll [new file with mode: 0644]