Skip to content

Commit 4941db7

Browse files
Krish GuptaKrish Gupta
authored andcommitted
Fix Windows build error and apply code formatting
- Fix unit test to pass AtomicOpValue& instead of Value* to createAtomicRead - Apply clang-format to fix code style violations - Remove trailing whitespace and fix indentation
1 parent 9f08eda commit 4941db7

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5473,7 +5473,8 @@ OpenMPIRBuilder::collapseLoops(DebugLoc DL, ArrayRef<CanonicalLoopInfo *> Loops,
54735473
}
54745474

54755475
// TODO: Enable UndefinedSanitizer to diagnose an overflow here.
5476-
CollapsedTripCount = Builder.CreateNUWMul(CollapsedTripCount, OrigTripCount);
5476+
CollapsedTripCount =
5477+
Builder.CreateNUWMul(CollapsedTripCount, OrigTripCount);
54775478
}
54785479

54795480
// Create the collapsed loop control flow.
@@ -9579,7 +9580,7 @@ Expected<std::pair<Value *, Value *>> OpenMPIRBuilder::emitAtomicUpdate(
95799580
OldVal->setAtomic(AO);
95809581
// CurBB
95819582
// | /---\
9582-
// ContBB |
9583+
// ContBB |
95839584
// | \---/
95849585
// ExitBB
95859586
BasicBlock *CurBB = Builder.GetInsertBlock();

llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4548,16 +4548,16 @@ TEST_F(OpenMPIRBuilderTest, OMPAtomicRWStructType) {
45484548
EntryBB->getFirstInsertionPt());
45494549

45504550
LLVMContext &Ctx = M->getContext();
4551-
4551+
45524552
// Create a struct type {double, double} to simulate complex(8) - 16 bytes
45534553
StructType *Complex8Ty = StructType::create(
45544554
Ctx, {Type::getDoubleTy(Ctx), Type::getDoubleTy(Ctx)}, "complex");
4555-
4555+
45564556
AllocaInst *XVal = Builder.CreateAlloca(Complex8Ty);
45574557
XVal->setName("AtomicVar");
45584558
OpenMPIRBuilder::AtomicOpValue X = {XVal, Complex8Ty, false, false};
45594559
AtomicOrdering AO = AtomicOrdering::SequentiallyConsistent;
4560-
4560+
45614561
// Create value to write: {1.0, 1.0}
45624562
Constant *Real = ConstantFP::get(Type::getDoubleTy(Ctx), 1.0);
45634563
Constant *Imag = ConstantFP::get(Type::getDoubleTy(Ctx), 1.0);
@@ -4571,10 +4571,8 @@ TEST_F(OpenMPIRBuilderTest, OMPAtomicRWStructType) {
45714571
AllocaInst *VVal = Builder.CreateAlloca(Complex8Ty);
45724572
VVal->setName("ReadDest");
45734573
OpenMPIRBuilder::AtomicOpValue V = {VVal, Complex8Ty, false, false};
4574-
Value *ReadResult = nullptr;
4575-
4576-
Builder.restoreIP(
4577-
OMPBuilder.createAtomicRead(Loc, X, ReadResult, AO, AllocaIP));
4574+
4575+
Builder.restoreIP(OMPBuilder.createAtomicRead(Loc, X, V, AO, AllocaIP));
45784576

45794577
Builder.CreateRetVoid();
45804578
OMPBuilder.finalize();
@@ -4583,7 +4581,7 @@ TEST_F(OpenMPIRBuilderTest, OMPAtomicRWStructType) {
45834581
// Verify that __atomic_store and __atomic_load are called with size 16
45844582
bool FoundAtomicStore = false;
45854583
bool FoundAtomicLoad = false;
4586-
4584+
45874585
for (Function &Fn : *M) {
45884586
if (Fn.getName().starts_with("__atomic_store")) {
45894587
// Check that first call to __atomic_store has size argument = 16
@@ -4610,7 +4608,7 @@ TEST_F(OpenMPIRBuilderTest, OMPAtomicRWStructType) {
46104608
}
46114609
}
46124610
}
4613-
4611+
46144612
EXPECT_TRUE(FoundAtomicStore) << "Did not find __atomic_store call";
46154613
EXPECT_TRUE(FoundAtomicLoad) << "Did not find __atomic_load call";
46164614
}
@@ -7657,8 +7655,7 @@ TEST_F(OpenMPIRBuilderTest, CreateTaskgroup) {
76577655
// Checking the general structure of the IR generated is same as expected.
76587656
Instruction *GeneratedStoreInst = TaskgroupCall->getNextNode();
76597657
EXPECT_EQ(GeneratedStoreInst, InternalStoreInst);
7660-
Instruction *GeneratedLoad32 =
7661-
GeneratedStoreInst->getNextNode();
7658+
Instruction *GeneratedLoad32 = GeneratedStoreInst->getNextNode();
76627659
EXPECT_EQ(GeneratedLoad32, InternalLoad32);
76637660
Instruction *GeneratedLoad128 = GeneratedLoad32->getNextNode();
76647661
EXPECT_EQ(GeneratedLoad128, InternalLoad128);

0 commit comments

Comments
 (0)