[PATCH] D112562: [SLP]Fix logical and/or reductions.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 26 13:41:45 PDT 2021


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:8019
+        return Builder.CreateSelect(LHS, Builder.getTrue(), RHS, Name);
+      LLVM_FALLTHROUGH;
     case RecurKind::And:
----------------
RKSimon wrote:
> I'm not sure if I like the double fallthrough tbh, and I'd expect static analyzers to warn about the repeated if() - are adding extra 'return Builder.CreateBinOp' that bad?
Yes - we already have that structure for min/max below here, so we might as well do the same for these cases.


================
Comment at: llvm/test/Transforms/SLPVectorizer/X86/reduction-logical.ll:477
 
 define i1 @logical_and_icmp_extra_op(<4 x i32> %x, <4 x i32> %y, i1 %c) {
 ; CHECK-LABEL: @logical_and_icmp_extra_op(
----------------
We should also have a 'logical-or' test so we have coverage for that path.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112562



More information about the llvm-commits mailing list