[flang] [llvm] [OpenMP][Flang] Fix atomic operations on complex types (PR #165366)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 28 12:23:53 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
index c49e69ae2..8d2382f88 100644
--- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -4548,16 +4548,16 @@ TEST_F(OpenMPIRBuilderTest, OMPAtomicRWStructType) {
EntryBB->getFirstInsertionPt());
LLVMContext &Ctx = M->getContext();
-
+
// Create a struct type {double, double} to simulate complex(8) - 16 bytes
StructType *Complex8Ty = StructType::create(
Ctx, {Type::getDoubleTy(Ctx), Type::getDoubleTy(Ctx)}, "complex");
-
+
AllocaInst *XVal = Builder.CreateAlloca(Complex8Ty);
XVal->setName("AtomicVar");
OpenMPIRBuilder::AtomicOpValue X = {XVal, Complex8Ty, false, false};
AtomicOrdering AO = AtomicOrdering::SequentiallyConsistent;
-
+
// Create value to write: {1.0, 1.0}
Constant *Real = ConstantFP::get(Type::getDoubleTy(Ctx), 1.0);
Constant *Imag = ConstantFP::get(Type::getDoubleTy(Ctx), 1.0);
@@ -4572,7 +4572,7 @@ TEST_F(OpenMPIRBuilderTest, OMPAtomicRWStructType) {
VVal->setName("ReadDest");
OpenMPIRBuilder::AtomicOpValue V = {VVal, Complex8Ty, false, false};
Value *ReadResult = nullptr;
-
+
Builder.restoreIP(
OMPBuilder.createAtomicRead(Loc, X, ReadResult, AO, AllocaIP));
@@ -4583,7 +4583,7 @@ TEST_F(OpenMPIRBuilderTest, OMPAtomicRWStructType) {
// Verify that __atomic_store and __atomic_load are called with size 16
bool FoundAtomicStore = false;
bool FoundAtomicLoad = false;
-
+
for (Function &Fn : *M) {
if (Fn.getName().starts_with("__atomic_store")) {
// Check that first call to __atomic_store has size argument = 16
@@ -4610,7 +4610,7 @@ TEST_F(OpenMPIRBuilderTest, OMPAtomicRWStructType) {
}
}
}
-
+
EXPECT_TRUE(FoundAtomicStore) << "Did not find __atomic_store call";
EXPECT_TRUE(FoundAtomicLoad) << "Did not find __atomic_load call";
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/165366
More information about the llvm-commits
mailing list