llvm-project/llvm/test/Transforms/SLPVectorizer/const-bool-logical-or-reduction.ll
Alexey Bataev b9ad72ba05 [SLP]Fix PR66176: SLP incorrectly reorders select operands.
On the very first iteration for the reductions, when trying to build
reduction for boolean logic operations, no need to compare LHS/RHS with
the Reduction(VectorizedTree), need to compare with actual parameters of
the reduction operations.
2023-09-15 03:57:36 -07:00

17 lines
595 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
; RUN: opt -passes=slp-vectorizer -S < %s | FileCheck %s
define i1 @test(i32 %inc) {
; CHECK-LABEL: define i1 @test(
; CHECK-SAME: i32 [[INC:%.*]]) {
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[INC]], 3
; CHECK-NEXT: [[OP_RDX:%.*]] = select i1 [[CMP]], i1 true, i1 poison
; CHECK-NEXT: ret i1 [[OP_RDX]]
;
%cmp = icmp ult i32 %inc, 3
%sel1 = select i1 %cmp, i1 true, i1 poison
%sel2 = select i1 %sel1, i1 true, i1 poison
%sel3 = select i1 %sel2, i1 true, i1 poison
ret i1 %sel3
}