mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 14:10:41 +00:00
[ConstantFolding] Handle bitcasts of undef fp vector elements
We used the wrong type for constructing a zero vector element which led to type mismatches. This fixes PR28771. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277197 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b2cc749171
commit
7e8508b6e6
@ -187,7 +187,7 @@ Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) {
|
||||
for (unsigned j = 0; j != Ratio; ++j) {
|
||||
Constant *Src = C->getAggregateElement(SrcElt++);
|
||||
if (Src && isa<UndefValue>(Src))
|
||||
Src = Constant::getNullValue(SrcEltTy);
|
||||
Src = Constant::getNullValue(C->getType()->getVectorElementType());
|
||||
else
|
||||
Src = dyn_cast_or_null<ConstantInt>(Src);
|
||||
if (!Src) // Reject constantexpr elements.
|
||||
|
@ -1386,3 +1386,10 @@ define i32 @test89() {
|
||||
; CHECK-NEXT: ret i32 393216
|
||||
ret i32 bitcast (<2 x i16> <i16 6, i16 undef> to i32)
|
||||
}
|
||||
|
||||
define <2 x i32> @test90() {
|
||||
; CHECK-LABEL: @test90(
|
||||
; CHECK: ret <2 x i32> <i32 0, i32 15360>
|
||||
%tmp6 = bitcast <4 x half> <half undef, half undef, half undef, half 0xH3C00> to <2 x i32>
|
||||
ret <2 x i32> %tmp6
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user