[llvm] 8c72397 - [InstCombine] Update contributor guide for commuted tests (NFC) (#155574)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Aug 27 06:03:14 PDT 2025
    
    
  
Author: Nikita Popov
Date: 2025-08-27T15:03:11+02:00
New Revision: 8c72397f159a83097fbc4a2c8e493283cc6317c0
URL: https://github.com/llvm/llvm-project/commit/8c72397f159a83097fbc4a2c8e493283cc6317c0
DIFF: https://github.com/llvm/llvm-project/commit/8c72397f159a83097fbc4a2c8e493283cc6317c0.diff
LOG: [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.
Added: 
    
Modified: 
    llvm/docs/InstCombineContributorGuide.md
Removed: 
    
################################################################################
diff  --git a/llvm/docs/InstCombineContributorGuide.md b/llvm/docs/InstCombineContributorGuide.md
index cee0a7ce446a6..12567fc36f1d1 100644
--- a/llvm/docs/InstCombineContributorGuide.md
+++ b/llvm/docs/InstCombineContributorGuide.md
@@ -96,22 +96,9 @@ may be omitted.
 If the transform involves commutative operations, add tests with commuted
 (swapped) operands.
 
-Make sure that the operand order stays intact in the CHECK lines of your
-pre-commited tests. You should not see something like this:
-
-```llvm
-; CHECK-NEXT: [[OR:%.*]] = or i8 [[X]], [[Y]]
-; ...
-%or = or i8 %y, %x
-```
-
-If this happens, you may need to change one of the operands to have higher
-complexity (include the "thwart" comment in that case):
-
-```llvm
-%y2 = mul i8 %y, %y ; thwart complexity-based canonicalization
-%or = or i8 %y, %x
-```
+As an exception, it is not necessary to test commutation if one of the operands
+is a constant: In this case, the constant operand is always canonicalized to
+the right.
 
 ### Add vector tests
 
        
    
    
More information about the llvm-commits
mailing list