Skip to content

Commit 687b076

Browse files
[OpenMPIRBuilderTest] Fix trip count test (#16)
Update trip count check in LLVM unit test.
1 parent 839c02d commit 687b076

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,8 +2299,14 @@ TEST_F(OpenMPIRBuilderTest, StaticWorkshareLoopTarget) {
22992299
// Check that no variables except for loop counter are used in loop body
23002300
EXPECT_EQ(Constant::getNullValue(Builder.getPtrTy()),
23012301
WorkshareLoopRuntimeCall->getArgOperand(2));
2302-
// Check loop trip count argument
2303-
EXPECT_EQ(TripCount, WorkshareLoopRuntimeCall->getArgOperand(3));
2302+
// Check loop trip count argument.
2303+
ConstantInt *TripCountConstInt = dyn_cast<ConstantInt>(TripCount);
2304+
EXPECT_NE(TripCountConstInt, nullptr);
2305+
ConstantInt *WorkshareLoopRuntimeCallTripCount =
2306+
dyn_cast<ConstantInt>(WorkshareLoopRuntimeCall->getArgOperand(3));
2307+
EXPECT_NE(WorkshareLoopRuntimeCallTripCount, nullptr);
2308+
EXPECT_EQ(WorkshareLoopRuntimeCallTripCount->getSExtValue() + 1,
2309+
TripCountConstInt->getSExtValue());
23042310
}
23052311

23062312
TEST_F(OpenMPIRBuilderTest, StaticWorkShareLoop) {

0 commit comments

Comments
 (0)