Skip to content

Commit 1702190

Browse files
aratajewigcbot
authored andcommitted
Avoid emitting the same instruction twice
Cmp sources were emitted twice, due to unnecessary call to `GetSource` function.
1 parent 2f4b9ba commit 1702190

File tree

3 files changed

+1
-11
lines changed

3 files changed

+1
-11
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13943,8 +13943,6 @@ void EmitPass::emitAtomicCounter(llvm::GenIntrinsicInst* pInsn)
1394313943

1394413944
void EmitPass::CmpBoolOp(Pattern* cmpPattern,
1394513945
llvm::BinaryOperator* inst,
13946-
llvm::CmpInst::Predicate predicate,
13947-
const SSource cmpSources[2],
1394813946
const SSource& bitSource,
1394913947
const DstModifier& modifier)
1395013948
{

IGC/Compiler/CISACodeGen/EmitVISAPass.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ class EmitPass : public llvm::FunctionPass
101101
void BinaryUnary(llvm::Instruction* inst, const SSource source[2], const DstModifier& modifier);
102102
void CmpBoolOp(Pattern* cmpPattern,
103103
llvm::BinaryOperator* inst,
104-
llvm::CmpInst::Predicate predicate,
105-
const SSource source[2],
106104
const SSource& bitSource,
107105
const DstModifier& modifier);
108106
void emitAluConditionMod(Pattern* aluPattern, llvm::Instruction* alu, llvm::CmpInst* cmp, int aluOprdNum);

IGC/Compiler/CISACodeGen/PatternMatchPass.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4109,12 +4109,10 @@ namespace IGC
41094109
{
41104110
Pattern* cmpPattern;
41114111
llvm::BinaryOperator* boolOp;
4112-
llvm::CmpInst::Predicate predicate;
4113-
SSource cmpSource[2];
41144112
SSource binarySource;
41154113
virtual void Emit(EmitPass* pass, const DstModifier& modifier)
41164114
{
4117-
pass->CmpBoolOp(cmpPattern, boolOp, predicate, cmpSource, binarySource, modifier);
4115+
pass->CmpBoolOp(cmpPattern, boolOp, binarySource, modifier);
41184116
}
41194117
};
41204118

@@ -4130,12 +4128,8 @@ namespace IGC
41304128
if (I.getOperand(1 - i)->hasOneUse())
41314129
{
41324130
BoolOpPattern* pattern = new (m_allocator) BoolOpPattern();
4133-
bool supportsMod = SupportsModifier(cmp);
41344131
pattern->cmpPattern = Match(*cmp);
41354132
pattern->boolOp = &I;
4136-
pattern->predicate = cmp->getPredicate();
4137-
pattern->cmpSource[0] = GetSource(cmp->getOperand(0), supportsMod, false);
4138-
pattern->cmpSource[1] = GetSource(cmp->getOperand(1), supportsMod, false);
41394133
pattern->binarySource = GetSource(I.getOperand(1 - i), false, false);
41404134
AddPattern(pattern);
41414135
found = true;

0 commit comments

Comments
 (0)