[PATCH] D122485: [SimplifyCFG] Fold mutil cases to And mask

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 06:20:09 PDT 2022


spatel added a comment.

In D122485#3448273 <https://reviews.llvm.org/D122485#3448273>, @bcl5980 wrote:

> In D122485#3448240 <https://reviews.llvm.org/D122485#3448240>, @spatel wrote:
>
>> Let's add the baseline tests as an NFC commit now, so it is easier to see the diffs.
>>
>> The order of the transforms creates an interesting trade-off, so we need a test like this (and probably even more tests):
>>
>>   define i8 @same_value_two_case(i32 %i) {
>>   entry:
>>     switch i32 %i, label %default [
>>     i32 -3, label %end
>>     i32 5, label %end
>>     ]
>>   
>>   default:
>>     br label %end
>>   
>>   end:
>>     %t0 = phi i8 [ 42, %default ], [ 3, %entry ], [ 3, %entry ]
>>     ret i8 %t0
>>   }
>
> I'm sorry but what's the difference between this test with switch_to_and0 ? For the negative offset?

Ah, you're correct - I did not see that test diff. But we might want to include a test with negative offset, so we have coverage for that too.


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

https://reviews.llvm.org/D122485



More information about the llvm-commits mailing list