Skip to content

Commit 3419137

Browse files
jgu222igcbot
authored andcommitted
Less add3
Only benefit of add3 is less instructions. For now, simply skip if there are more than one use of the second add as it is not guaranteed to be removed. This is to try if this scheme works. If not, a better approach has to be developed.
1 parent 878c2a9 commit 3419137

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

IGC/Compiler/CISACodeGen/PatternMatchPass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4191,6 +4191,10 @@ namespace IGC
41914191
return false;
41924192
}
41934193

4194+
// For simplicity, do not do add3 if 'Add2' has more than one use.
4195+
if (!Add2->hasOneUse())
4196+
return false;
4197+
41944198
// If source operand corresponding to first add instruction
41954199
// has many uses the add3 pattern match is unlikely to be profitable,
41964200
// as it increases register pressure and makes register bank

0 commit comments

Comments
 (0)