[PATCH] D104928: [OMPIRBuilder] add minimalist reduction support

Alex Zinenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 29 00:42:37 PDT 2021


ftynse added inline comments.


================
Comment at: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp:2625-2626
+  // Store initial values of reductions into global variables.
+  Builder.CreateStore(ConstantFP::get(Builder.getFloatTy(), 0.0), SumReduced);
+  Builder.CreateStore(Builder.getInt32(1), XorReduced);
+
----------------
Meinersbur wrote:
> Could you give these a name just such they are easier to identifier in the dump?
We can't set names on store instructions, can we?


================
Comment at: llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp:2695-2710
+  auto SumReduction = [&](InsertPointTy IP, Value *LHS, Value *RHS,
+                          Value *&Result) {
+    IRBuilderBase::InsertPointGuard Guard(Builder);
+    Builder.restoreIP(IP);
+    Result = Builder.CreateFAdd(LHS, RHS, "red.add");
+    return Builder.saveIP();
+  };
----------------
Meinersbur wrote:
> Should OMPIRBuilder provide a set of standard reduction callbacks so users don't have to declare them?
Would be nice to have, but I'd prefer not to scope creep this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104928



More information about the llvm-commits mailing list