llvm-project/llvm/test/CodeGen/BPF/CORE
Yonghong Song 29bc5dd194 [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering
Currently, isTruncateFree() and isZExtFree() callbacks return false
as they are not implemented in BPF backend. This may cause suboptimal
code generation. For example, if the load in the context of zero extension
has more than one use, the pattern zextload{i8,i16,i32} will
not be generated. Rather, the load will be matched first and
then the result is zero extended.

For example, in the test together with this commit, we have
   I1: %0 = load i32, i32* %data_end1, align 4, !tbaa !2
   I2: %conv = zext i32 %0 to i64
   ...
   I3: %2 = load i32, i32* %data, align 4, !tbaa !7
   I4: %conv2 = zext i32 %2 to i64
   ...
   I5: %4 = trunc i64 %sub.ptr.lhs.cast to i32
   I6: %conv13 = sub i32 %4, %2
   ...

The I1 and I2 will match to one zextloadi32 DAG node, where SUBREG_TO_REG is
used to convert a 32bit register to 64bit one. During code generation,
SUBREG_TO_REG is a noop.

The %2 in I3 is used in both I4 and I6. If isTruncateFree() is false,
the current implementation will generate a SLL_ri and SRL_ri
for the zext part during lowering.

This patch implement isTruncateFree() in the BPF backend, so for the
above example, I3 and I4 will generate a zextloadi32 DAG node with
SUBREG_TO_REG is generated during lowering to Machine IR.

isZExtFree() is also implemented as it should help code gen as well.

This patch also enables the change in https://reviews.llvm.org/D73985
since it won't kick in generates MOV_32_64 machine instruction.

Differential Revision: https://reviews.llvm.org/D74101
2020-02-11 09:59:19 -08:00
..
field-reloc-alu32.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
field-reloc-bitfield-1.ll [BPF] Fix CO-RE bugs with bitfields 2019-11-04 20:08:05 -08:00
field-reloc-bitfield-2.ll [BPF] Fix CO-RE bugs with bitfields 2019-11-04 20:08:05 -08:00
intrinsic-array.ll Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"="all" as cleanups after D56351 2019-12-24 15:57:33 -08:00
intrinsic-fieldinfo-byte-size-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-byte-size-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-byte-size-3.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-byte-size-4.ll [BPF] fix a bug in __builtin_preserve_field_info() with FIELD_BYTE_SIZE 2019-11-03 08:18:28 -08:00
intrinsic-fieldinfo-existence-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-existence-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-existence-3.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-lshift-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-lshift-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-rshift-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-rshift-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-rshift-3.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-signedness-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-signedness-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-fieldinfo-signedness-3.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
intrinsic-struct.ll Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"="all" as cleanups after D56351 2019-12-24 15:57:33 -08:00
intrinsic-transforms.ll [Transforms] Do not drop !preserve.access.index metadata 2019-08-03 23:41:26 +00:00
intrinsic-union.ll Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"="all" as cleanups after D56351 2019-12-24 15:57:33 -08:00
no-elf-ama-symbol.ll [BPF] add "llvm." prefix to BPF internally created globals 2019-11-25 21:34:46 -08:00
no-narrow-load.ll [BPF] disable ReduceLoadWidth during SelectionDag phase 2020-02-04 18:37:43 -08:00
offset-reloc-access-str.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-basic.ll [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs 2020-01-10 09:06:31 -08:00
offset-reloc-cast-array-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-cast-array-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-cast-struct-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-cast-struct-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-cast-struct-3.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-cast-union-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-cast-union-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-end-load.ll [BPF] Enable relocation location for load/store/shifts 2019-12-26 09:07:39 -08:00
offset-reloc-end-ret.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-fieldinfo-1.ll [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering 2020-02-11 09:59:19 -08:00
offset-reloc-fieldinfo-2.ll [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering 2020-02-11 09:59:19 -08:00
offset-reloc-global-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-global-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-global-3.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-ignore.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-middle-chain.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-multi-array-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-multi-array-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-multilevel.ll [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs 2020-01-10 09:06:31 -08:00
offset-reloc-pointer-1.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-pointer-2.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-struct-anonymous.ll [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs 2020-01-10 09:06:31 -08:00
offset-reloc-struct-array.ll [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs 2020-01-10 09:06:31 -08:00
offset-reloc-typedef-array.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-typedef-struct-2.ll [BPF] handle typedef of struct/union for CO-RE relocations 2020-02-04 08:53:03 -08:00
offset-reloc-typedef-struct.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-typedef-union-2.ll [BPF] handle typedef of struct/union for CO-RE relocations 2020-02-04 08:53:03 -08:00
offset-reloc-typedef-union.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-typedef.ll [BPF] fix a CO-RE issue with -mattr=+alu32 2019-10-25 14:27:25 -07:00
offset-reloc-union.ll [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs 2020-01-10 09:06:31 -08:00