Files
clang-p2996/llvm/test/Transforms/SLPVectorizer/AArch64/slp-or-reduction.ll
Philip Reames 7d6e8f2a96 [slp] Delete dead scalar instructions feeding vectorized instructions
If we vectorize a e.g. store, we leave around a bunch of getelementptrs for the individual scalar stores which we removed. We can go ahead and delete them as well.

This is purely for test output quality and readability. It should have no effect in any sane pipeline.

Differential Revision: https://reviews.llvm.org/D122493
2022-03-28 20:10:13 -07:00

70 lines
3.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -S -mtriple=aarch64 -slp-vectorizer | FileCheck %s
%struct.buf = type { [8 x i8] }
define i8 @reduce_or(%struct.buf* %a, %struct.buf* %b) {
; CHECK-LABEL: @reduce_or(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_BUF:%.*]], %struct.buf* [[A:%.*]], i64 0, i32 0, i64 0
; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds [[STRUCT_BUF]], %struct.buf* [[B:%.*]], i64 0, i32 0, i64 0
; CHECK-NEXT: [[TMP0:%.*]] = bitcast i8* [[ARRAYIDX]] to <8 x i8>*
; CHECK-NEXT: [[TMP1:%.*]] = load <8 x i8>, <8 x i8>* [[TMP0]], align 1
; CHECK-NEXT: [[TMP2:%.*]] = bitcast i8* [[ARRAYIDX3]] to <8 x i8>*
; CHECK-NEXT: [[TMP3:%.*]] = load <8 x i8>, <8 x i8>* [[TMP2]], align 1
; CHECK-NEXT: [[TMP4:%.*]] = xor <8 x i8> [[TMP3]], [[TMP1]]
; CHECK-NEXT: [[TMP5:%.*]] = call i8 @llvm.vector.reduce.or.v8i8(<8 x i8> [[TMP4]])
; CHECK-NEXT: ret i8 [[TMP5]]
;
entry:
%arrayidx = getelementptr inbounds %struct.buf, %struct.buf* %a, i64 0, i32 0, i64 0
%0 = load i8, i8* %arrayidx, align 1
%arrayidx3 = getelementptr inbounds %struct.buf, %struct.buf* %b, i64 0, i32 0, i64 0
%1 = load i8, i8* %arrayidx3, align 1
%xor12 = xor i8 %1, %0
%arrayidx.1 = getelementptr inbounds %struct.buf, %struct.buf* %a, i64 0, i32 0, i64 1
%2 = load i8, i8* %arrayidx.1, align 1
%arrayidx3.1 = getelementptr inbounds %struct.buf, %struct.buf* %b, i64 0, i32 0, i64 1
%3 = load i8, i8* %arrayidx3.1, align 1
%xor12.1 = xor i8 %3, %2
%or13.1 = or i8 %xor12.1, %xor12
%arrayidx.2 = getelementptr inbounds %struct.buf, %struct.buf* %a, i64 0, i32 0, i64 2
%4 = load i8, i8* %arrayidx.2, align 1
%arrayidx3.2 = getelementptr inbounds %struct.buf, %struct.buf* %b, i64 0, i32 0, i64 2
%5 = load i8, i8* %arrayidx3.2, align 1
%xor12.2 = xor i8 %5, %4
%or13.2 = or i8 %xor12.2, %or13.1
%arrayidx.3 = getelementptr inbounds %struct.buf, %struct.buf* %a, i64 0, i32 0, i64 3
%6 = load i8, i8* %arrayidx.3, align 1
%arrayidx3.3 = getelementptr inbounds %struct.buf, %struct.buf* %b, i64 0, i32 0, i64 3
%7 = load i8, i8* %arrayidx3.3, align 1
%xor12.3 = xor i8 %7, %6
%or13.3 = or i8 %xor12.3, %or13.2
%arrayidx.4 = getelementptr inbounds %struct.buf, %struct.buf* %a, i64 0, i32 0, i64 4
%8 = load i8, i8* %arrayidx.4, align 1
%arrayidx3.4 = getelementptr inbounds %struct.buf, %struct.buf* %b, i64 0, i32 0, i64 4
%9 = load i8, i8* %arrayidx3.4, align 1
%xor12.4 = xor i8 %9, %8
%or13.4 = or i8 %xor12.4, %or13.3
%arrayidx.5 = getelementptr inbounds %struct.buf, %struct.buf* %a, i64 0, i32 0, i64 5
%10 = load i8, i8* %arrayidx.5, align 1
%arrayidx3.5 = getelementptr inbounds %struct.buf, %struct.buf* %b, i64 0, i32 0, i64 5
%11 = load i8, i8* %arrayidx3.5, align 1
%xor12.5 = xor i8 %11, %10
%or13.5 = or i8 %xor12.5, %or13.4
%arrayidx.6 = getelementptr inbounds %struct.buf, %struct.buf* %a, i64 0, i32 0, i64 6
%12 = load i8, i8* %arrayidx.6, align 1
%arrayidx3.6 = getelementptr inbounds %struct.buf, %struct.buf* %b, i64 0, i32 0, i64 6
%13 = load i8, i8* %arrayidx3.6, align 1
%xor12.6 = xor i8 %13, %12
%or13.6 = or i8 %xor12.6, %or13.5
%arrayidx.7 = getelementptr inbounds %struct.buf, %struct.buf* %a, i64 0, i32 0, i64 7
%14 = load i8, i8* %arrayidx.7, align 1
%arrayidx3.7 = getelementptr inbounds %struct.buf, %struct.buf* %b, i64 0, i32 0, i64 7
%15 = load i8, i8* %arrayidx3.7, align 1
%xor12.7 = xor i8 %15, %14
%or13.7 = or i8 %xor12.7, %or13.6
ret i8 %or13.7
}