mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-17 08:57:34 +00:00
Fix another infinite loop in Reassociate caused by Constant::isZero().
Not all zero vectors are ConstantDataVector's. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253723 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2d2aadfa70
commit
108258ac78
@ -53,6 +53,11 @@ bool Constant::isNegativeZeroValue() const {
|
||||
if (SplatCFP && SplatCFP->isZero() && SplatCFP->isNegative())
|
||||
return true;
|
||||
|
||||
if (const ConstantVector *CV = dyn_cast<ConstantVector>(this))
|
||||
if (ConstantFP *SplatCFP = dyn_cast_or_null<ConstantFP>(CV->getSplatValue()))
|
||||
if (SplatCFP && SplatCFP->isZero() && SplatCFP->isNegative())
|
||||
return true;
|
||||
|
||||
// We've already handled true FP case; any other FP vectors can't represent -0.0.
|
||||
if (getType()->isFPOrFPVectorTy())
|
||||
return false;
|
||||
@ -74,6 +79,11 @@ bool Constant::isZeroValue() const {
|
||||
if (SplatCFP && SplatCFP->isZero())
|
||||
return true;
|
||||
|
||||
if (const ConstantVector *CV = dyn_cast<ConstantVector>(this))
|
||||
if (ConstantFP *SplatCFP = dyn_cast_or_null<ConstantFP>(CV->getSplatValue()))
|
||||
if (SplatCFP && SplatCFP->isZero())
|
||||
return true;
|
||||
|
||||
// Otherwise, just use +0.0.
|
||||
return isNullValue();
|
||||
}
|
||||
|
@ -12,6 +12,19 @@ define void @test1() {
|
||||
ret void
|
||||
}
|
||||
|
||||
define half @test2() {
|
||||
; CHECK-LABEL: @test2
|
||||
; CHECK: fsub
|
||||
; CHECK: fsub
|
||||
; CHECK: fadd
|
||||
%tmp15 = fsub fast half undef, undef
|
||||
%tmp17 = fsub fast half undef, %tmp15
|
||||
%tmp18 = fadd fast half undef, %tmp17
|
||||
ret half %tmp18
|
||||
}
|
||||
|
||||
|
||||
|
||||
; Function Attrs: optsize
|
||||
declare <4 x float> @blam()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user