[PATCH] D105013: [InstCombine] try to fold the expression "(A & ~B) + B" to "A | B"

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 29 04:37:54 PDT 2021


spatel added inline comments.


================
Comment at: llvm/test/Analysis/ValueTracking/known-non-common-bits.ll:5
+
+define dso_local i32 @_Z11and_to_xor1ii(i32 %0, i32 %1) {
+; CHECK-LABEL: @_Z11and_to_xor1ii(
----------------
There are 4 commuted variations of this pattern, so we should have a test for each. Other transforms will try to normalize the code structure, so the tests will have to overcome that to provide full coverage. 

Search for "thwart complexity-based canonicalization" in the test dir for examples.

You may vary the value types across those 4 tests for more coverage as well (try unusual widths or vectors).




================
Comment at: llvm/test/Analysis/ValueTracking/known-non-common-bits.ll:5
+
+define dso_local i32 @_Z11and_to_xor1ii(i32 %0, i32 %1) {
+; CHECK-LABEL: @_Z11and_to_xor1ii(
----------------
spatel wrote:
> There are 4 commuted variations of this pattern, so we should have a test for each. Other transforms will try to normalize the code structure, so the tests will have to overcome that to provide full coverage. 
> 
> Search for "thwart complexity-based canonicalization" in the test dir for examples.
> 
> You may vary the value types across those 4 tests for more coverage as well (try unusual widths or vectors).
> 
> 
Remove "dso_local" and mangling artifacts from the function name.

It's easier to read the tests if the values are named the same as in the code comment ("A" and "B" in this case).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105013/new/

https://reviews.llvm.org/D105013



More information about the llvm-commits mailing list