[PATCH] D126184: [InstCombine] bitcast(logic(bitcast(X), bitcast(Y))) --> bitcast'(logic(bitcast'(X), Y))

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 09:21:01 PDT 2022


spatel added a comment.

This seems fine, but we should improve the tests.



================
Comment at: llvm/test/Transforms/InstCombine/bitcast.ll:133
 
-; The destination must have an integer element type.
-; FIXME: We can still eliminate one bitcast in this test by doing the logic op
-; in the type of the input that has an integer element type.
-
 define <4 x float> @bitcasts_and_bitcast_to_fp(<4 x float> %a, <8 x i16> %b) {
 ; CHECK-LABEL: @bitcasts_and_bitcast_to_fp(
----------------
This is exactly the same test as the one in the earlier file? We should change it to provide more coverage. Vary the types, commute the operands, use `xor`, etc.

```
define <4 x float> @bitcasts_xor_bitcast_to_fp(<2 x double> %a, <8 x i16> %b) {
  %bc1 = bitcast <8 x i16> %b to <2 x i64>
  %bc2 = bitcast <2 x double> %a to <2 x i64>
  %xor = xor <2 x i64> %bc2, %bc1
  %bc3 = bitcast <2 x i64> %xor to <4 x float>
  ret <4 x float> %bc3
}

```
If we do not have (negative) tests with extra uses, please add those too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126184



More information about the llvm-commits mailing list