Skip to content

Commit de53183

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: 09dd7ec: llvm-16: Implement lost functionality from instcombine
Add two additional peephole in GenXSimplify: %1 = bitcast <32 x i1> %in1 to i32 %2 = bitcast <32 x i1> %in2 to i32 %binop = binop i32 %1, %2 %3 = bitcast i32 %binop to <32 x i1> And %1 = trunc <32 x i16> %in1 to <32 x i1> %2 = trunc <32 x i16> %in2 to <32 x i1> %binop = binop <32 x i1> %1, %2 %3 = zext <32 x i1> %binop to <32 x i16> To: %binop = binop <32 x i16> %in1, %in2
1 parent 9081e8d commit de53183

File tree

2 files changed

+3
-120
lines changed

2 files changed

+3
-120
lines changed

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

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*========================== begin_copyright_notice ============================
22
3-
Copyright (C) 2017-2025 Intel Corporation
3+
Copyright (C) 2017-2024 Intel Corporation
44
55
SPDX-License-Identifier: MIT
66
@@ -183,70 +183,13 @@ static Value *simplifyMulDDQ(BinaryOperator &Mul) {
183183
return Result;
184184
}
185185

186-
static inline bool isBitcastFits(BitCastInst *BC) {
187-
return BC->getSrcTy()->isVectorTy() && BC->getDestTy()->isIntegerTy();
188-
}
189-
190-
static inline bool isTrunkFits(TruncInst *TC) {
191-
return TC->getSrcTy()->isVectorTy() &&
192-
TC->getDestTy()->isVectorTy() &&
193-
TC->getDestTy()->getScalarType()->isIntegerTy(1);
194-
}
195-
196-
static inline bool simplifyBinOp(BinaryOperator *BinOp) {
197-
bool Changed = false;
198-
199-
auto *Bitcast1 = dyn_cast<BitCastInst>(BinOp->getOperand(0));
200-
auto *Bitcast2 = dyn_cast<BitCastInst>(BinOp->getOperand(1));
201-
if (Bitcast1 && Bitcast2 && (Bitcast1->getSrcTy() == Bitcast2->getSrcTy())) {
202-
if (isBitcastFits(Bitcast1) && isBitcastFits(Bitcast2)) {
203-
for (auto *User : BinOp->users()) {
204-
if (auto *BitcastBack = dyn_cast<BitCastInst>(User)) {
205-
if (BitcastBack->getDestTy()->isVectorTy()) {
206-
IRBuilder<> Builder(BinOp);
207-
auto *NewOp =
208-
Builder.CreateBinOp(BinOp->getOpcode(), Bitcast1->getOperand(0),
209-
Bitcast2->getOperand(0));
210-
BitcastBack->replaceAllUsesWith(NewOp);
211-
Changed = true;
212-
BinOp = cast<BinaryOperator>(NewOp);
213-
break;
214-
}
215-
}
216-
}
217-
}
218-
}
219-
auto *Trunc1 = dyn_cast<TruncInst>(BinOp->getOperand(0));
220-
auto *Trunc2 = dyn_cast<TruncInst>(BinOp->getOperand(1));
221-
if (Trunc1 && Trunc2 && (Trunc1->getSrcTy() == Trunc2->getSrcTy())) {
222-
if (isTrunkFits(Trunc1) && isTrunkFits(Trunc2)) {
223-
for (auto *User : BinOp->users()) {
224-
if (auto *ZextInst = dyn_cast<ZExtInst>(User)) {
225-
if (auto *DestVecType = dyn_cast<VectorType>(ZextInst->getDestTy())) {
226-
if (DestVecType->getElementType()->isIntegerTy()) {
227-
IRBuilder<> Builder(BinOp);
228-
auto *NewOp =
229-
Builder.CreateBinOp(BinOp->getOpcode(), Trunc1->getOperand(0),
230-
Trunc2->getOperand(0));
231-
ZextInst->replaceAllUsesWith(NewOp);
232-
Changed = true;
233-
break;
234-
}
235-
}
236-
}
237-
}
238-
}
239-
}
240-
return Changed;
241-
}
242-
243186
static Value *GenXSimplifyInstruction(llvm::Instruction *Inst) {
244187
IGC_ASSERT(Inst);
245188
if (!GenXEnablePeepholes)
246189
return nullptr;
247-
if (Inst->getOpcode() == Instruction::Mul)
190+
if (Inst->getOpcode() == Instruction::Mul) {
248191
return simplifyMulDDQ(*cast<BinaryOperator>(Inst));
249-
192+
}
250193
return nullptr;
251194
}
252195

@@ -563,8 +506,6 @@ bool GenXSimplify::runOnFunction(Function &F) {
563506
Changed |= replaceWithNewValue(*Inst, *V);
564507
continue;
565508
}
566-
if (auto *BO = dyn_cast<BinaryOperator>(Inst))
567-
Changed |= simplifyBinOp(BO);
568509
}
569510
}
570511

IGC/VectorCompiler/test/GenXSimplify/llvm_16_combine.ll

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)