[PATCH] D124710: [InstCombine] Fold ((A&B)^C)|B

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 05:54:02 PDT 2022


nikic added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/add.ll:1580
 ; CHECK-NEXT:    [[Y:%.*]] = udiv i8 42, [[_Y:%.*]]
 ; CHECK-NEXT:    [[AND:%.*]] = and i8 [[Y]], [[X:%.*]]
 ; CHECK-NEXT:    call void @use(i8 [[AND]])
----------------
spatel wrote:
> This commuted, so it's not testing the pattern that was intended - it became identical to "commuted3". We need another "thwart" instruction to make it stay in the order that was written?
> 
> The extra use is a bit distracting in these tests. As long as we have that extra use in any 1 test, that provides coverage to account for that pattern.
Thanks, I've fixed these two tests in https://github.com/llvm/llvm-project/commit/032cc74d6918116e51b9f0df1d61d3b26733151f.

The extra use here is unfortunately necessary to prevent the a different fold from applying first (and we can't test commutation with constant operands).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124710



More information about the llvm-commits mailing list