mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-21 18:22:53 +01:00
[IR] Handle constant expressions in containsUndefinedElement()
If the constant is a constant expression, then getAggregateElement() will return null. Guard against this before calling HasFn(). (cherry picked from commit af382b93831ae6a58bce8bc075458cfd056e3976)
This commit is contained in:
parent
bedf13b1a7
commit
7d56483207
@ -315,9 +315,11 @@ containsUndefinedElement(const Constant *C,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (unsigned i = 0, e = cast<FixedVectorType>(VTy)->getNumElements();
|
for (unsigned i = 0, e = cast<FixedVectorType>(VTy)->getNumElements();
|
||||||
i != e; ++i)
|
i != e; ++i) {
|
||||||
if (HasFn(C->getAggregateElement(i)))
|
if (Constant *Elem = C->getAggregateElement(i))
|
||||||
return true;
|
if (HasFn(Elem))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -87,6 +87,15 @@ define i32 @add_poison1() {
|
|||||||
ret i32 %x
|
ret i32 %x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define i32 @add_constexpr() {
|
||||||
|
; CHECK-LABEL: @add_constexpr(
|
||||||
|
; CHECK-NEXT: [[X:%.*]] = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> bitcast (<4 x i64> <i64 0, i64 1, i64 2, i64 3> to <8 x i32>))
|
||||||
|
; CHECK-NEXT: ret i32 [[X]]
|
||||||
|
;
|
||||||
|
%x = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> bitcast (<4 x i64> <i64 0, i64 1, i64 2, i64 3> to <8 x i32>))
|
||||||
|
ret i32 %x
|
||||||
|
}
|
||||||
|
|
||||||
define i32 @mul_0() {
|
define i32 @mul_0() {
|
||||||
; CHECK-LABEL: @mul_0(
|
; CHECK-LABEL: @mul_0(
|
||||||
; CHECK-NEXT: ret i32 0
|
; CHECK-NEXT: ret i32 0
|
||||||
|
Loading…
Reference in New Issue
Block a user