Skip to content

Commit bb2d6c3

Browse files
zuban32sys_zuul
authored and
sys_zuul
committed
[Autobackout][FuncReg]Revert of change: 47e82b9
Consider SIMD mask while constfolding Change-Id: I0900bac6b5e4e54779e360d7bacbeee0753ab412
1 parent 79dd38a commit bb2d6c3

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

IGC/VectorCompiler/lib/GenXOpts/CMAnalysis/ConstantFoldingGenX.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ static Constant *constantFoldWrRegion(Type *RetTy,
135135
const CMRegion &R, const DataLayout &DL) {
136136
Constant *OldValue = Operands[GenXIntrinsic::GenXRegion::OldValueOperandNum];
137137
Constant *NewValue = Operands[GenXIntrinsic::GenXRegion::NewValueOperandNum];
138-
Constant *Mask = Operands[GenXIntrinsic::GenXRegion::PredicateOperandNum];
139138
// The inputs can be ConstantExpr if we are being called from
140139
// CallAnalyzer.
141140
if (isa<ConstantExpr>(OldValue) || isa<ConstantExpr>(NewValue))
@@ -148,8 +147,7 @@ static Constant *constantFoldWrRegion(Type *RetTy,
148147

149148
const int RetElemSize = DL.getTypeSizeInBits(RetTy->getScalarType()) / 8;
150149
unsigned Offset = OffsetC->getSExtValue() / RetElemSize;
151-
if (isa<UndefValue>(OldValue) && R.isContiguous() && Offset == 0 &&
152-
Mask->isAllOnesValue()) {
150+
if (isa<UndefValue>(OldValue) && R.isContiguous() && (Offset == 0)) {
153151
// If old value is undef and new value is splat, and the result vector
154152
// is no bigger than 2 GRFs, then just return a splat of the right type.
155153
Constant *Splat = NewValue;
@@ -174,7 +172,7 @@ static Constant *constantFoldWrRegion(Type *RetTy,
174172
return UndefValue::get(RetTy); // out of range index
175173
if (!isa<VectorType>(NewValue->getType()))
176174
Values[Offset] = NewValue;
177-
else if (!Mask->isZeroValue()) {
175+
else {
178176
unsigned RowIdx = Offset;
179177
unsigned Idx = RowIdx;
180178
unsigned NextRow = R.Width;
@@ -187,10 +185,7 @@ static Constant *constantFoldWrRegion(Type *RetTy,
187185
if (Idx >= WholeNumElements)
188186
// return collected values even if idx is out of bounds
189187
return ConstantVector::get(Values);
190-
if (Mask->isAllOnesValue() ||
191-
(Mask->getType()->isVectorTy() &&
192-
!cast<ConstantVector>(Mask)->getAggregateElement(i)->isZeroValue()))
193-
Values[Idx] = NewValue->getAggregateElement(i);
188+
Values[Idx] = NewValue->getAggregateElement(i);
194189
Idx += R.Stride;
195190
}
196191
}

0 commit comments

Comments
 (0)