HomePhabricator

Reapply [ConstantFold] Handle vectors in ConstantFoldLoadThroughBitcast()

Authored by nikic on Mar 6 2021, 3:14 AM.

Description

Reapply [ConstantFold] Handle vectors in ConstantFoldLoadThroughBitcast()

There seems to be an impedance mismatch between what the type
system considers an aggregate (structs and arrays) and what
constants consider an aggregate (structs, arrays and vectors).

Adjust the type check to consider vectors as well. The previous
version of the patch dropped the type check entirely, but it
turns out that getAggregateElement() does require the constant
to be an aggregate in some edge cases: For Poison/Undef the
getNumElements() API is called, without checking in advance that
we're dealing with an aggregate. Possibly the implementation should
avoid doing that, but for now I'm adding an assert so the next
person doesn't fall into this trap.

Details

Committed
nikicMar 21 2021, 9:48 AM
Parents
rG59dbf4d516b1: [InstSimplify] Add load of undef aggregate test (NFC)
Branches
Unknown
Tags
Unknown