[PATCH] D101836: [LoopVectorize] Enable strict reductions when allowReordering() returns false

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 06:30:20 PDT 2021


sdesmalen added inline comments.


================
Comment at: llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h:140
 
   bool allowReordering() const {
     // When enabling loop hints are provided we allow the vectorizer to change
----------------
I'd suggest moving the implementation of `allowReordering` to `LoopVectorizationLegality.cpp`, so that you don't need to add the extern+include above.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp:874-875
+
+  if (!EnableStrictReductions)
+    return false;
+
----------------
nit: can you fold this into the condition below:

  if (!EnableStrictReductions || any_of(...))
    return false;


================
Comment at: llvm/test/Transforms/LoopVectorize/AArch64/strict-fadd.ll:3
+; RUN: opt < %s -loop-vectorize -mtriple aarch64-unknown-linux-gnu -enable-strict-reductions=false -hints-allow-reordering=true  -S 2>%t | FileCheck %s --check-prefix=CHECK-UNORDERED
+; RUN: opt < %s -loop-vectorize -mtriple aarch64-unknown-linux-gnu -enable-strict-reductions=true  -hints-allow-reordering=false -S 2>%t | FileCheck %s --check-prefix=CHECK-ORDERED
 
----------------
Can you also add a RUN line for `-enable-strict-reductions=true  -hints-allow-reordering=true` (which I think can reuse prefix CHECK-UNORDERED)


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

https://reviews.llvm.org/D101836



More information about the llvm-commits mailing list