Skip to content

Commit 8c72397

Browse files
authored
[InstCombine] Update contributor guide for commuted tests (NFC) (#155574)
As we have removed complexity-based canonicalization, the "thwart" pattern is no longer relevant. Also clarify that we do not expect commuted tests for constant operands.
1 parent 024618b commit 8c72397

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

llvm/docs/InstCombineContributorGuide.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,9 @@ may be omitted.
9696
If the transform involves commutative operations, add tests with commuted
9797
(swapped) operands.
9898

99-
Make sure that the operand order stays intact in the CHECK lines of your
100-
pre-commited tests. You should not see something like this:
101-
102-
```llvm
103-
; CHECK-NEXT: [[OR:%.*]] = or i8 [[X]], [[Y]]
104-
; ...
105-
%or = or i8 %y, %x
106-
```
107-
108-
If this happens, you may need to change one of the operands to have higher
109-
complexity (include the "thwart" comment in that case):
110-
111-
```llvm
112-
%y2 = mul i8 %y, %y ; thwart complexity-based canonicalization
113-
%or = or i8 %y, %x
114-
```
99+
As an exception, it is not necessary to test commutation if one of the operands
100+
is a constant: In this case, the constant operand is always canonicalized to
101+
the right.
115102

116103
### Add vector tests
117104

0 commit comments

Comments
 (0)