Skip to content

Commit 7733ced

Browse files
piotrkiraigcbot
authored andcommitted
Fix type conversion
1 parent 8661d26 commit 7733ced

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

IGC/Compiler/CISACodeGen/PatternMatchPass.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2972,16 +2972,22 @@ namespace IGC
29722972
pattern->instruction = &I;
29732973
uint nbSources = GetNbSources(I);
29742974

2975-
bool supportModifer = SupportsModifier(&I);
2975+
bool supportModiferSrc0 = SupportsModifier(&I);
29762976
bool supportRegioning = SupportsRegioning(&I);
2977-
pattern->sources[0] = GetSource(I.getOperand(0), supportModifer && SupportSrc0Mod, supportRegioning);
2978-
if (nbSources > 1)
2979-
{
2980-
pattern->sources[1] = GetSource(I.getOperand(1), supportModifer, supportRegioning);
2977+
llvm::Instruction* src0Inst = llvm::dyn_cast<llvm::Instruction>(I.getOperand(0));
2978+
if (I.getOpcode() == llvm::Instruction::UDiv && src0Inst && src0Inst->getOpcode() == llvm::Instruction::Sub) {
2979+
supportModiferSrc0 = false;
29812980
}
2982-
2981+
pattern->sources[0] = GetSource(I.getOperand(0), supportModiferSrc0 && SupportSrc0Mod, supportRegioning);
29832982
if (nbSources > 1)
29842983
{
2984+
bool supportModiferSrc1 = SupportsModifier(&I);
2985+
llvm::Instruction* src1Inst = llvm::dyn_cast<llvm::Instruction>(I.getOperand(1));
2986+
if (I.getOpcode() == llvm::Instruction::UDiv && src1Inst && src1Inst->getOpcode() == llvm::Instruction::Sub) {
2987+
supportModiferSrc1 = false;
2988+
}
2989+
pattern->sources[1] = GetSource(I.getOperand(1), supportModiferSrc1, supportRegioning);
2990+
29852991
// add df imm to constant pool for binary/ternary inst
29862992
// we do 64-bit int imm bigger than 32 bits, since smaller may fit in D/W
29872993
for (int i = 0, numSrc = (int)nbSources; i < numSrc; ++i)

0 commit comments

Comments
 (0)