[PATCH] D86395: InstCombine transform pattern "(~A & B) ^ A -> (A | B)" added

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 09:11:47 PDT 2020


spatel added a comment.

In D86395#2242098 <https://reviews.llvm.org/D86395#2242098>, @Jac1494 wrote:

> In D86395#2234640 <https://reviews.llvm.org/D86395#2234640>, @spatel wrote:
>
>> The tests should be pre-committed with current CHECK lines (ie, without this patch), so we just see the diffs - and can confirm that the tests actually represent the patterns shown in the test comments.
>
> I have created IR and assembly files like below (without this patch), And I am not getting "%x = add i32 %p, 42 ; thwart complexity-based canonicalization"
> But it is there in assembly.

Assembly is irrelevant. This is an IR to IR patch.
You are proposing to transform 4 commuted variations of a pattern, but your tests do not provide coverage for those variants. My test suggestion would hopefully provide that coverage. 
This might be clearer if you create the tests before this code patch and step through the transforms in a debugger. Look for InstCombinerImpl::SimplifyAssociativeOrCommutative() and getComplexity().


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

https://reviews.llvm.org/D86395



More information about the llvm-commits mailing list