346 changes: 346 additions & 0 deletions clang/test/SemaOpenACC/loop-construct-vector-ast.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,346 @@
// RUN: %clang_cc1 %s -fopenacc -ast-dump | FileCheck %s

// Test this with PCH.
// RUN: %clang_cc1 %s -fopenacc -emit-pch -o %t %s
// RUN: %clang_cc1 %s -fopenacc -include-pch %t -ast-dump-all | FileCheck %s
#ifndef PCH_HELPER
#define PCH_HELPER

template<unsigned I, typename ConvertsToInt, typename Int>
void TemplUses(ConvertsToInt CTI, Int IsI) {
// CHECK: FunctionTemplateDecl{{.*}}TemplUses
// CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'unsigned int' depth 0 index 0 I
// CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 1 ConvertsToInt
// CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 2 Int
// CHECK-NEXT: FunctionDecl{{.*}}TemplUses 'void (ConvertsToInt, Int)'
// CHECK-NEXT: ParmVarDecl{{.*}}CTI 'ConvertsToInt'
// CHECK-NEXT: ParmVarDecl{{.*}}IsI 'Int'
// CHECK-NEXT: CompoundStmt

// CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan>
// CHECK-NEXT: vector clause
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc loop vector
for(;;);

// CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan>
// CHECK-NEXT: vector clause
// CHECK-NEXT: DeclRefExpr{{.*}}'unsigned int' NonTypeTemplateParm{{.*}}'I' 'unsigned int'
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc loop vector(I)
for(;;);

// CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan>
// CHECK-NEXT: vector clause
// CHECK-NEXT: DeclRefExpr{{.*}}'ConvertsToInt' lvalue ParmVar{{.*}}'CTI' 'ConvertsToInt'
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc loop vector(length:CTI)
for(;;);

// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} parallel
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: DeclRefExpr{{.*}}'Int' lvalue ParmVar{{.*}}'IsI' 'Int'
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc parallel
#pragma acc loop vector(length:IsI)
for(;;);

// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} serial
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc serial
#pragma acc loop vector
for(;;);

// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: DeclRefExpr{{.*}}'Int' lvalue ParmVar{{.*}}'IsI' 'Int'
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc kernels
#pragma acc loop vector(length:IsI)
for(;;);


// Instantiations:
// CHECK-NEXT: FunctionDecl{{.*}} TemplUses 'void (Converts, int)' implicit_instantiation
// CHECK-NEXT: TemplateArgument integral '3U'
// CHECK-NEXT: TemplateArgument type 'Converts'
// CHECK-NEXT: RecordType{{.*}}'Converts'
// CHECK-NEXT: CXXRecord{{.*}}'Converts
// CHECK-NEXT: TemplateArgument type 'int'
// CHECK-NEXT: BuiltinType{{.*}}'int'
// CHECK-NEXT: ParmVarDecl{{.*}} CTI 'Converts'
// CHECK-NEXT: ParmVarDecl{{.*}} IsI 'int'
// CHECK-NEXT: CompoundStmt

// CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan>
// CHECK-NEXT: vector clause
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
//
// CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan>
// CHECK-NEXT: vector clause
// CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'unsigned int'
// CHECK-NEXT: NonTypeTemplateParmDecl{{.*}}'unsigned int' depth 0 index 0 I
// CHECK-NEXT: IntegerLiteral{{.*}} 'unsigned int' 3
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
//
// CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan>
// CHECK-NEXT: vector clause
// CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <UserDefinedConversion>
// CHECK-NEXT: CXXMemberCallExpr{{.*}}'int'
// CHECK-NEXT: MemberExpr{{.*}} .operator int
// CHECK-NEXT: DeclRefExpr{{.*}}'Converts' lvalue ParmVar{{.*}}'CTI' 'Converts'
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
//
// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} parallel
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}}'IsI' 'int'
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
//
// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} serial
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
//
// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}}'IsI' 'int'
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt


}

struct Converts{
operator int();
};

void uses() {
// CHECK: FunctionDecl{{.*}} uses
// CHECK-NEXT: CompoundStmt

// CHECK-NEXT: CallExpr
// CHECK-NEXT: ImplicitCastExpr{{.*}}'void (*)(Converts, int)' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr{{.*}} 'void (Converts, int)' lvalue Function{{.*}} 'TemplUses' 'void (Converts, int)'
// CHECK-NEXT: CXXFunctionalCastExpr{{.*}} 'Converts' functional cast to Converts <NoOp>
// CHECK-NEXT: InitListExpr
// CHECK-NEXT: IntegerLiteral{{.*}} 'int' 5
TemplUses<3>(Converts{}, 5);

// CHECK-NEXT: DeclStmt
// CHECK-NEXT: VarDecl{{.*}}
int i;
// CHECK-NEXT: DeclStmt
// CHECK-NEXT: VarDecl{{.*}}
// CHECK-NEXT: CXXConstructExpr
Converts C;

// CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan>
// CHECK-NEXT: vector clause
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc loop vector
for(;;);

// CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan>
// CHECK-NEXT: vector clause
// CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc loop vector(i)
for(;;);

// CHECK-NEXT: OpenACCLoopConstruct{{.*}}<orphan>
// CHECK-NEXT: vector clause
// CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <UserDefinedConversion>
// CHECK-NEXT: CXXMemberCallExpr{{.*}}'int'
// CHECK-NEXT: MemberExpr{{.*}} .operator int
// CHECK-NEXT: DeclRefExpr{{.*}}'Converts' lvalue Var{{.*}}'C' 'Converts'
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc loop vector(length:C)
for(;;);

// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} parallel
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc parallel
#pragma acc loop vector
for(;;);

// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} parallel
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <UserDefinedConversion>
// CHECK-NEXT: CXXMemberCallExpr{{.*}}'int'
// CHECK-NEXT: MemberExpr{{.*}} .operator int
// CHECK-NEXT: DeclRefExpr{{.*}}'Converts' lvalue Var{{.*}}'C' 'Converts'
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc parallel
#pragma acc loop vector(C)
for(;;);

// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} parallel
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc parallel
#pragma acc loop vector(length:i)
for(;;);

// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc kernels
#pragma acc loop vector
for(;;);

// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <UserDefinedConversion>
// CHECK-NEXT: CXXMemberCallExpr{{.*}}'int'
// CHECK-NEXT: MemberExpr{{.*}} .operator int
// CHECK-NEXT: DeclRefExpr{{.*}}'Converts' lvalue Var{{.*}}'C' 'Converts'
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc kernels
#pragma acc loop vector(C)
for(;;);

// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} kernels
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ImplicitCastExpr{{.*}}'int' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc kernels
#pragma acc loop vector(length:i)
for(;;);

// CHECK-NEXT: OpenACCComputeConstruct 0x[[COMPUTE_ADDR:[0-9a-f]+]]{{.*}} serial
// CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: 0x[[COMPUTE_ADDR]]
// CHECK-NEXT: vector clause
// CHECK-NEXT: ForStmt
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: <<<NULL>>>
// CHECK-NEXT: NullStmt
#pragma acc serial
#pragma acc loop vector
for(;;);
}
#endif // PCH_HELPER
136 changes: 136 additions & 0 deletions clang/test/SemaOpenACC/loop-construct-vector-clause.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
// RUN: %clang_cc1 %s -fopenacc -verify

template<typename Int, typename NotInt, typename ConvertsToInt>
void TemplUses(Int I, NotInt NI, ConvertsToInt CTI) {
#pragma acc loop vector(I)
for(;;);

#pragma acc parallel
#pragma acc loop vector(length: I)
for(;;);

#pragma acc kernels
#pragma acc loop vector(CTI)
for(;;);

// expected-error@+2{{OpenACC clause 'vector' requires expression of integer type ('NoConvert' invalid)}}
#pragma acc kernels
#pragma acc loop vector(length: NI)
for(;;);

// expected-error@+2{{'num' argument on 'vector' clause is not permitted on a 'loop' construct associated with a 'serial' compute construct}}
#pragma acc serial
#pragma acc loop vector(length: I)
for(;;);

// expected-error@+3{{'num' argument to 'vector' clause not allowed on a 'loop' construct associated with a 'kernels' construct that has a 'vector_length' clause}}
// expected-note@+1{{previous clause is here}}
#pragma acc kernels vector_length(I)
#pragma acc loop vector(length: CTI)
for(;;);

#pragma acc loop vector
for(;;) {
for(;;);
// expected-error@+2{{loop with a 'vector' clause may not exist in the region of a 'vector' clause}}
// expected-note@-4{{previous clause is here}}
#pragma acc loop vector
for(;;);
for(;;);
}

#pragma acc loop vector
for(;;) {
for(;;);
// expected-error@+4{{loop with a 'vector' clause may not exist in the region of a 'vector' clause}}
// expected-error@+3{{loop with a 'worker' clause may not exist in the region of a 'vector' clause}}
// expected-error@+2{{loop with a 'gang' clause may not exist in the region of a 'vector' clause}}
// expected-note@-6 3{{previous clause is here}}
#pragma acc loop vector, worker, gang
for(;;);
for(;;);
}

#pragma acc loop vector
for(;;) {
#pragma acc serial
#pragma acc loop vector
for(;;);
}
}

struct NoConvert{};
struct Converts{
operator int();
};

void uses() {
TemplUses(5, NoConvert{}, Converts{}); // expected-note{{in instantiation of function template specialization}}

unsigned i;
NoConvert NI;
Converts CTI;

#pragma acc loop vector(i)
for(;;);

#pragma acc parallel
#pragma acc loop vector(length: i)
for(;;);

#pragma acc kernels
#pragma acc loop vector(CTI)
for(;;);

// expected-error@+2{{OpenACC clause 'vector' requires expression of integer type ('NoConvert' invalid)}}
#pragma acc kernels
#pragma acc loop vector(length: NI)
for(;;);

// expected-error@+2{{'num' argument on 'vector' clause is not permitted on a 'loop' construct associated with a 'serial' compute construct}}
#pragma acc serial
#pragma acc loop vector(length: i)
for(;;);

// expected-error@+3{{'num' argument to 'vector' clause not allowed on a 'loop' construct associated with a 'kernels' construct that has a 'vector_length' clause}}
// expected-note@+1{{previous clause is here}}
#pragma acc kernels vector_length(i)
#pragma acc loop vector(length: i)
for(;;);

#pragma acc loop vector
for(;;) {
for(;;);
// expected-error@+2{{loop with a 'vector' clause may not exist in the region of a 'vector' clause}}
// expected-note@-4{{previous clause is here}}
#pragma acc loop vector
for(;;);
for(;;);
}

#pragma acc loop vector
for(;;) {
#pragma acc serial
#pragma acc loop vector
for(;;);
}

#pragma acc loop vector
for(;;) {
for(;;);
// expected-error@+4{{loop with a 'vector' clause may not exist in the region of a 'vector' clause}}
// expected-error@+3{{loop with a 'worker' clause may not exist in the region of a 'vector' clause}}
// expected-error@+2{{loop with a 'gang' clause may not exist in the region of a 'vector' clause}}
// expected-note@-6 3{{previous clause is here}}
#pragma acc loop vector, worker, gang
for(;;);
for(;;);
}

#pragma acc loop vector
for(;;) {
#pragma acc serial
#pragma acc loop vector, worker, gang
for(;;);
}
}
6 changes: 6 additions & 0 deletions clang/tools/libclang/CIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2893,6 +2893,12 @@ void OpenACCClauseEnqueue::VisitWorkerClause(const OpenACCWorkerClause &C) {
if (C.hasIntExpr())
Visitor.AddStmt(C.getIntExpr());
}

void OpenACCClauseEnqueue::VisitVectorClause(const OpenACCVectorClause &C) {
if (C.hasIntExpr())
Visitor.AddStmt(C.getIntExpr());
}

void OpenACCClauseEnqueue::VisitWaitClause(const OpenACCWaitClause &C) {
if (const Expr *DevNumExpr = C.getDevNumExpr())
Visitor.AddStmt(DevNumExpr);
Expand Down
5 changes: 0 additions & 5 deletions clang/unittests/Format/TokenAnnotatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,6 @@ TEST_F(TokenAnnotatorTest, UnderstandsUsesOfStarAndAmp) {
EXPECT_TOKEN(Tokens[3], tok::star, TT_PointerOrReference);
EXPECT_TOKEN(Tokens[4], tok::amp, TT_PointerOrReference);

Tokens = annotate("if (Foo *&foo{a})");
ASSERT_EQ(Tokens.size(), 11u) << Tokens;
EXPECT_TOKEN(Tokens[3], tok::star, TT_PointerOrReference);
EXPECT_TOKEN(Tokens[4], tok::amp, TT_PointerOrReference);

FormatStyle Style = getLLVMStyle();
Style.TypeNames.push_back("MYI");
Tokens = annotate("if (MYI *p{nullptr})", Style);
Expand Down
6 changes: 3 additions & 3 deletions compiler-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ if(COMPILER_RT_USE_LLVM_UNWINDER)
if (COMPILER_RT_ENABLE_STATIC_UNWINDER)
list(APPEND COMPILER_RT_UNWINDER_LINK_LIBS "$<TARGET_LINKER_FILE:unwind_static>")
else()
list(APPEND COMPILER_RT_UNWINDER_LINK_LIBS "$<TARGET_LINKER_FILE:$<IF:$<TARGET_EXISTS:unwind_shared>,unwind_shared,unwind_static>>")
list(APPEND COMPILER_RT_UNWINDER_LINK_LIBS "$<TARGET_LINKER_FILE:$<IF:$<BOOL:${LIBUNWIND_ENABLE_SHARED}>,unwind_shared,unwind_static>>")
endif()
endif()

Expand All @@ -634,7 +634,7 @@ if (COMPILER_RT_CXX_LIBRARY STREQUAL "libcxx")
if (COMPILER_RT_STATIC_CXX_LIBRARY)
set(COMPILER_RT_CXX_LINK_LIBS "$<TARGET_LINKER_FILE:cxx_static>")
else()
set(COMPILER_RT_CXX_LINK_LIBS "$<TARGET_LINKER_FILE:$<IF:$<TARGET_EXISTS:cxx_shared>,cxx_shared,cxx_static>>")
set(COMPILER_RT_CXX_LINK_LIBS "$<TARGET_LINKER_FILE:$<IF:$<BOOL:${LIBCXX_ENABLE_SHARED}>,cxx_shared,cxx_static>>")
endif()
elseif (COMPILER_RT_CXX_LIBRARY STREQUAL "none")
# We aren't using any C++ standard library so avoid including the default one.
Expand Down Expand Up @@ -676,7 +676,7 @@ if (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libc++")
if (SANITIZER_USE_STATIC_TEST_CXX)
list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<TARGET_LINKER_FILE:cxx_static>")
else()
list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<TARGET_LINKER_FILE:$<IF:$<TARGET_EXISTS:cxx_shared>,cxx_shared,cxx_static>>")
list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<TARGET_LINKER_FILE:$<IF:$<BOOL:${LIBCXX_ENABLE_SHARED}>,cxx_shared,cxx_static>>")
endif()
# We are using the in tree libc++ so avoid including the default one.
append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ COMPILER_RT_UNITTEST_CFLAGS)
Expand Down
37 changes: 37 additions & 0 deletions compiler-rt/include/sanitizer/common_interface_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,43 @@ void SANITIZER_CDECL __sanitizer_annotate_double_ended_contiguous_container(
const void *old_container_beg, const void *old_container_end,
const void *new_container_beg, const void *new_container_end);

/// Copies memory annotations from a source storage region to a destination
/// storage region. After the operation, the destination region has the same
/// memory annotations as the source region, as long as sanitizer limitations
/// allow it (more bytes may be unpoisoned than in the source region, resulting
/// in more false negatives, but never false positives). If the source and
/// destination regions overlap, only the minimal required changes are made to
/// preserve the correct annotations. Old storage bytes that are not in the new
/// storage should have the same annotations, as long as sanitizer limitations
/// allow it.
///
/// This function is primarily designed to be used when moving trivially
/// relocatable objects that may have poisoned memory, making direct copying
/// problematic under sanitizer. However, this function does not move memory
/// content itself, only annotations.
///
/// A contiguous container is a container that keeps all of its elements in a
/// contiguous region of memory. The container owns the region of memory
/// <c>[src_begin, src_end)</c> and <c>[dst_begin, dst_end)</c>. The memory
/// within these regions may be alternately poisoned and non-poisoned, with
/// possibly smaller poisoned and unpoisoned regions.
///
/// If this function fully poisons a granule, it is marked as "container
/// overflow".
///
/// Argument requirements: The destination container must have the same size as
/// the source container, which is inferred from the beginning and end of the
/// source region. Addresses may be granule-unaligned, but this may affect
/// performance.
///
/// \param src_begin Begin of the source container region.
/// \param src_end End of the source container region.
/// \param dst_begin Begin of the destination container region.
/// \param dst_end End of the destination container region.
void SANITIZER_CDECL __sanitizer_copy_contiguous_container_annotations(
const void *src_begin, const void *src_end, const void *dst_begin,
const void *dst_end);

/// Returns true if the contiguous container <c>[beg, end)</c> is properly
/// poisoned.
///
Expand Down
14 changes: 14 additions & 0 deletions compiler-rt/lib/asan/asan_errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,20 @@ void ErrorBadParamsToAnnotateDoubleEndedContiguousContainer::Print() {
ReportErrorSummary(scariness.GetDescription(), stack);
}

void ErrorBadParamsToCopyContiguousContainerAnnotations::Print() {
Report(
"ERROR: AddressSanitizer: bad parameters to "
"__sanitizer_copy_contiguous_container_annotations:\n"
" src_storage_beg : %p\n"
" src_storage_end : %p\n"
" dst_storage_beg : %p\n"
" new_storage_end : %p\n",
(void *)old_storage_beg, (void *)old_storage_end, (void *)new_storage_beg,
(void *)new_storage_end);
stack->Print();
ReportErrorSummary(scariness.GetDescription(), stack);
}

void ErrorODRViolation::Print() {
Decorator d;
Printf("%s", d.Error());
Expand Down
19 changes: 19 additions & 0 deletions compiler-rt/lib/asan/asan_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,24 @@ struct ErrorBadParamsToAnnotateDoubleEndedContiguousContainer : ErrorBase {
void Print();
};

struct ErrorBadParamsToCopyContiguousContainerAnnotations : ErrorBase {
const BufferedStackTrace *stack;
uptr old_storage_beg, old_storage_end, new_storage_beg, new_storage_end;

ErrorBadParamsToCopyContiguousContainerAnnotations() = default; // (*)
ErrorBadParamsToCopyContiguousContainerAnnotations(
u32 tid, BufferedStackTrace *stack_, uptr old_storage_beg_,
uptr old_storage_end_, uptr new_storage_beg_, uptr new_storage_end_)
: ErrorBase(tid, 10,
"bad-__sanitizer_annotate_double_ended_contiguous_container"),
stack(stack_),
old_storage_beg(old_storage_beg_),
old_storage_end(old_storage_end_),
new_storage_beg(new_storage_beg_),
new_storage_end(new_storage_end_) {}
void Print();
};

struct ErrorODRViolation : ErrorBase {
__asan_global global1, global2;
u32 stack_id1, stack_id2;
Expand Down Expand Up @@ -421,6 +439,7 @@ struct ErrorGeneric : ErrorBase {
macro(StringFunctionSizeOverflow) \
macro(BadParamsToAnnotateContiguousContainer) \
macro(BadParamsToAnnotateDoubleEndedContiguousContainer) \
macro(BadParamsToCopyContiguousContainerAnnotations) \
macro(ODRViolation) \
macro(InvalidPointerPair) \
macro(Generic)
Expand Down
180 changes: 180 additions & 0 deletions compiler-rt/lib/asan/asan_poisoning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "asan_report.h"
#include "asan_stack.h"
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_interface_internal.h"
#include "sanitizer_common/sanitizer_libc.h"
Expand Down Expand Up @@ -576,6 +577,185 @@ void __sanitizer_annotate_double_ended_contiguous_container(
}
}

// Marks the specified number of bytes in a granule as accessible or
// poisones the whole granule with kAsanContiguousContainerOOBMagic value.
static void SetContainerGranule(uptr ptr, u8 n) {
constexpr uptr granularity = ASAN_SHADOW_GRANULARITY;
u8 s = (n == granularity) ? 0 : (n ? n : kAsanContiguousContainerOOBMagic);
*(u8 *)MemToShadow(ptr) = s;
}

// Performs a byte-by-byte copy of ASan annotations (shadow memory values).
// Result may be different due to ASan limitations, but result cannot lead
// to false positives (more memory than requested may get unpoisoned).
static void SlowCopyContainerAnnotations(uptr src_beg, uptr src_end,
uptr dst_beg, uptr dst_end) {
constexpr uptr granularity = ASAN_SHADOW_GRANULARITY;
uptr dst_end_down = RoundDownTo(dst_end, granularity);
uptr src_ptr = src_beg;
uptr dst_ptr = dst_beg;

while (dst_ptr < dst_end) {
uptr granule_beg = RoundDownTo(dst_ptr, granularity);
uptr granule_end = granule_beg + granularity;
uptr unpoisoned_bytes = 0;

uptr end = Min(granule_end, dst_end);
for (; dst_ptr != end; ++dst_ptr, ++src_ptr)
if (!AddressIsPoisoned(src_ptr))
unpoisoned_bytes = dst_ptr - granule_beg + 1;

if (dst_ptr == dst_end && dst_end != dst_end_down &&
!AddressIsPoisoned(dst_end))
continue;

if (unpoisoned_bytes != 0 || granule_beg >= dst_beg)
SetContainerGranule(granule_beg, unpoisoned_bytes);
else if (!AddressIsPoisoned(dst_beg))
SetContainerGranule(granule_beg, dst_beg - granule_beg);
}
}

// Performs a byte-by-byte copy of ASan annotations (shadow memory values),
// going through bytes in reversed order, but not reversing annotations.
// Result may be different due to ASan limitations, but result cannot lead
// to false positives (more memory than requested may get unpoisoned).
static void SlowReversedCopyContainerAnnotations(uptr src_beg, uptr src_end,
uptr dst_beg, uptr dst_end) {
constexpr uptr granularity = ASAN_SHADOW_GRANULARITY;
uptr dst_end_down = RoundDownTo(dst_end, granularity);
uptr src_ptr = src_end;
uptr dst_ptr = dst_end;

while (dst_ptr > dst_beg) {
uptr granule_beg = RoundDownTo(dst_ptr - 1, granularity);
uptr unpoisoned_bytes = 0;

uptr end = Max(granule_beg, dst_beg);
for (; dst_ptr != end; --dst_ptr, --src_ptr)
if (unpoisoned_bytes == 0 && !AddressIsPoisoned(src_ptr - 1))
unpoisoned_bytes = dst_ptr - granule_beg;

if (dst_ptr >= dst_end_down && !AddressIsPoisoned(dst_end))
continue;

if (granule_beg == dst_ptr || unpoisoned_bytes != 0)
SetContainerGranule(granule_beg, unpoisoned_bytes);
else if (!AddressIsPoisoned(dst_beg))
SetContainerGranule(granule_beg, dst_beg - granule_beg);
}
}

// A helper function for __sanitizer_copy_contiguous_container_annotations,
// has assumption about begin and end of the container.
// Should not be used stand alone.
static void CopyContainerFirstGranuleAnnotation(uptr src_beg, uptr dst_beg) {
constexpr uptr granularity = ASAN_SHADOW_GRANULARITY;
// First granule
uptr src_beg_down = RoundDownTo(src_beg, granularity);
uptr dst_beg_down = RoundDownTo(dst_beg, granularity);
if (dst_beg_down == dst_beg)
return;
if (!AddressIsPoisoned(src_beg))
*(u8 *)MemToShadow(dst_beg_down) = *(u8 *)MemToShadow(src_beg_down);
else if (!AddressIsPoisoned(dst_beg))
SetContainerGranule(dst_beg_down, dst_beg - dst_beg_down);
}

// A helper function for __sanitizer_copy_contiguous_container_annotations,
// has assumption about begin and end of the container.
// Should not be used stand alone.
static void CopyContainerLastGranuleAnnotation(uptr src_end, uptr dst_end) {
constexpr uptr granularity = ASAN_SHADOW_GRANULARITY;
// Last granule
uptr src_end_down = RoundDownTo(src_end, granularity);
uptr dst_end_down = RoundDownTo(dst_end, granularity);
if (dst_end_down == dst_end || !AddressIsPoisoned(dst_end))
return;
if (AddressIsPoisoned(src_end))
*(u8 *)MemToShadow(dst_end_down) = *(u8 *)MemToShadow(src_end_down);
else
SetContainerGranule(dst_end_down, src_end - src_end_down);
}

// This function copies ASan memory annotations (poisoned/unpoisoned states)
// from one buffer to another.
// It's main purpose is to help with relocating trivially relocatable objects,
// which memory may be poisoned, without calling copy constructor.
// However, it does not move memory content itself, only annotations.
// If the buffers aren't aligned (the distance between buffers isn't
// granule-aligned)
// // src_beg % granularity != dst_beg % granularity
// the function handles this by going byte by byte, slowing down performance.
// The old buffer annotations are not removed. If necessary,
// user can unpoison old buffer with __asan_unpoison_memory_region.
void __sanitizer_copy_contiguous_container_annotations(const void *src_beg_p,
const void *src_end_p,
const void *dst_beg_p,
const void *dst_end_p) {
if (!flags()->detect_container_overflow)
return;

VPrintf(3, "contiguous_container_src: %p %p\n", src_beg_p, src_end_p);
VPrintf(3, "contiguous_container_dst: %p %p\n", dst_beg_p, dst_end_p);

uptr src_beg = reinterpret_cast<uptr>(src_beg_p);
uptr src_end = reinterpret_cast<uptr>(src_end_p);
uptr dst_beg = reinterpret_cast<uptr>(dst_beg_p);
uptr dst_end = reinterpret_cast<uptr>(dst_end_p);

constexpr uptr granularity = ASAN_SHADOW_GRANULARITY;

if (src_beg > src_end || (dst_end - dst_beg) != (src_end - src_beg)) {
GET_STACK_TRACE_FATAL_HERE;
ReportBadParamsToCopyContiguousContainerAnnotations(
src_beg, src_end, dst_beg, dst_end, &stack);
}

if (src_beg == src_end || src_beg == dst_beg)
return;
// Due to support for overlapping buffers, we may have to copy elements
// in reversed order, when destination buffer starts in the middle of
// the source buffer (or shares first granule with it).
//
// When buffers are not granule-aligned (or distance between them,
// to be specific), annotatios have to be copied byte by byte.
//
// The only remaining edge cases involve edge granules,
// when the container starts or ends within a granule.
uptr src_beg_up = RoundUpTo(src_beg, granularity);
uptr src_end_up = RoundUpTo(src_end, granularity);
bool copy_in_reversed_order = src_beg < dst_beg && dst_beg <= src_end_up;
if (src_beg % granularity != dst_beg % granularity ||
RoundDownTo(dst_end - 1, granularity) <= dst_beg) {
if (copy_in_reversed_order)
SlowReversedCopyContainerAnnotations(src_beg, src_end, dst_beg, dst_end);
else
SlowCopyContainerAnnotations(src_beg, src_end, dst_beg, dst_end);
return;
}

// As buffers are granule-aligned, we can just copy annotations of granules
// from the middle.
uptr dst_beg_up = RoundUpTo(dst_beg, granularity);
uptr dst_end_down = RoundDownTo(dst_end, granularity);
if (copy_in_reversed_order)
CopyContainerLastGranuleAnnotation(src_end, dst_end);
else
CopyContainerFirstGranuleAnnotation(src_beg, dst_beg);

if (dst_beg_up < dst_end_down) {
internal_memmove((u8 *)MemToShadow(dst_beg_up),
(u8 *)MemToShadow(src_beg_up),
(dst_end_down - dst_beg_up) / granularity);
}

if (copy_in_reversed_order)
CopyContainerFirstGranuleAnnotation(src_beg, dst_beg);
else
CopyContainerLastGranuleAnnotation(src_end, dst_end);
}

static const void *FindBadAddress(uptr begin, uptr end, bool poisoned) {
CHECK_LE(begin, end);
constexpr uptr kMaxRangeToCheck = 32;
Expand Down
10 changes: 10 additions & 0 deletions compiler-rt/lib/asan/asan_report.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,16 @@ void ReportBadParamsToAnnotateDoubleEndedContiguousContainer(
in_report.ReportError(error);
}

void ReportBadParamsToCopyContiguousContainerAnnotations(
uptr old_storage_beg, uptr old_storage_end, uptr new_storage_beg,
uptr new_storage_end, BufferedStackTrace *stack) {
ScopedInErrorReport in_report;
ErrorBadParamsToCopyContiguousContainerAnnotations error(
GetCurrentTidOrInvalid(), stack, old_storage_beg, old_storage_end,
new_storage_beg, new_storage_end);
in_report.ReportError(error);
}

void ReportODRViolation(const __asan_global *g1, u32 stack_id1,
const __asan_global *g2, u32 stack_id2) {
ScopedInErrorReport in_report;
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/lib/asan/asan_report.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ void ReportBadParamsToAnnotateDoubleEndedContiguousContainer(
uptr storage_beg, uptr storage_end, uptr old_container_beg,
uptr old_container_end, uptr new_container_beg, uptr new_container_end,
BufferedStackTrace *stack);
void ReportBadParamsToCopyContiguousContainerAnnotations(
uptr old_storage_beg, uptr old_storage_end, uptr new_storage_beg,
uptr new_storage_end, BufferedStackTrace *stack);

void ReportODRViolation(const __asan_global *g1, u32 stack_id1,
const __asan_global *g2, u32 stack_id2);
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/lib/hwasan/hwasan_platform_interceptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@
#undef SANITIZER_INTERCEPT_CLOCK_GETCPUCLOCKID
#define SANITIZER_INTERCEPT_CLOCK_GETCPUCLOCKID 0

#undef SANITIZER_INTERCEPT_TIMER_CREATE
#define SANITIZER_INTERCEPT_TIMER_CREATE 0

#undef SANITIZER_INTERCEPT_GETITIMER
#define SANITIZER_INTERCEPT_GETITIMER 0

Expand Down
23 changes: 23 additions & 0 deletions compiler-rt/lib/msan/tests/msan_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4881,4 +4881,27 @@ TEST(MemorySanitizer, throw_catch) {
// pass
}
}

#if defined(__linux__)
TEST(MemorySanitizer, timer_create) {
timer_t timer;
EXPECT_POISONED(timer);
int res = timer_create(CLOCK_REALTIME, nullptr, &timer);
ASSERT_EQ(0, res);
EXPECT_NOT_POISONED(timer);

// Make sure the timer is usable.
struct itimerspec cur_value {};
cur_value.it_value.tv_sec = 1;
EXPECT_EQ(0, timer_settime(timer, 0, &cur_value, nullptr));

timer_t timer2;
EXPECT_POISONED(timer2);
// Use an invalid clock_id to make timer_create fail.
res = timer_create(INT_MAX, nullptr, &timer2);
ASSERT_EQ(-1, res);
EXPECT_POISONED(timer2);
timer_delete(timer);
}
#endif
} // namespace
19 changes: 19 additions & 0 deletions compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2289,6 +2289,24 @@ INTERCEPTOR(int, pthread_getcpuclockid, uptr thread,
#define INIT_CLOCK_GETCPUCLOCKID
#endif

#if SANITIZER_INTERCEPT_TIMER_CREATE
INTERCEPTOR(int, timer_create, __sanitizer_clockid_t clockid, void *sevp,
__sanitizer_timer_t *timer) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, timer_create, clockid, sevp, timer);
int res = REAL(timer_create)(clockid, sevp, timer);
if (!res && timer) {
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, timer, sizeof *timer);
}
return res;
}

# define INIT_TIMER_CREATE \
COMMON_INTERCEPT_FUNCTION_GLIBC_VER_MIN(timer_create, "GLIBC_2.3.3");
#else
# define INIT_TIMER_CREATE
#endif

#if SANITIZER_INTERCEPT_GETITIMER
INTERCEPTOR(int, getitimer, int which, void *curr_value) {
void *ctx;
Expand Down Expand Up @@ -10266,6 +10284,7 @@ static void InitializeCommonInterceptors() {
INIT_SETPWENT;
INIT_CLOCK_GETTIME;
INIT_CLOCK_GETCPUCLOCKID;
INIT_TIMER_CREATE;
INIT_GETITIMER;
INIT_TIME;
INIT_GLOB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
INTERFACE_FUNCTION(__sanitizer_acquire_crash_state)
INTERFACE_FUNCTION(__sanitizer_annotate_contiguous_container)
INTERFACE_FUNCTION(__sanitizer_annotate_double_ended_contiguous_container)
INTERFACE_FUNCTION(__sanitizer_copy_contiguous_container_annotations)
INTERFACE_FUNCTION(__sanitizer_contiguous_container_find_bad_address)
INTERFACE_FUNCTION(
__sanitizer_double_ended_contiguous_container_find_bad_address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ void __sanitizer_annotate_double_ended_contiguous_container(
const void *old_container_beg, const void *old_container_end,
const void *new_container_beg, const void *new_container_end);
SANITIZER_INTERFACE_ATTRIBUTE
void __sanitizer_copy_contiguous_container_annotations(const void *src_begin,
const void *src_end,
const void *dst_begin,
const void *dst_end);
SANITIZER_INTERFACE_ATTRIBUTE
int __sanitizer_verify_contiguous_container(const void *beg, const void *mid,
const void *end);
SANITIZER_INTERFACE_ATTRIBUTE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@
(SI_FREEBSD || SI_NETBSD || SI_LINUX || SI_SOLARIS)
#define SANITIZER_INTERCEPT_CLOCK_GETCPUCLOCKID \
(SI_LINUX || SI_FREEBSD || SI_NETBSD)
// TODO: This should be SI_POSIX, adding Linux first until I have time
// to verify all timer_t typedefs on other platforms.
#define SANITIZER_INTERCEPT_TIMER_CREATE SI_LINUX
#define SANITIZER_INTERCEPT_GETITIMER SI_POSIX
#define SANITIZER_INTERCEPT_TIME SI_POSIX
#define SANITIZER_INTERCEPT_GLOB (SI_GLIBC || SI_SOLARIS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,10 @@ extern const int si_SEGV_ACCERR;

#define SIGACTION_SYMNAME sigaction

# if SANITIZER_LINUX
typedef void *__sanitizer_timer_t;
# endif

#endif // SANITIZER_LINUX || SANITIZER_APPLE

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

// Before Solaris 11.4, <procfs.h> doesn't work in a largefile environment.
#undef _FILE_OFFSET_BITS

// Avoid conflict between `_TIME_BITS` defined vs. `_FILE_OFFSET_BITS`
// undefined in some Linux configurations.
#undef _TIME_BITS
#include "sanitizer_platform.h"
#if SANITIZER_SOLARIS
# include <fcntl.h>
Expand Down
9 changes: 8 additions & 1 deletion compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ SignalContext::WriteFlag SignalContext::GetWriteFlag() const {

void SignalContext::DumpAllRegisters(void *context) {
CONTEXT *ctx = (CONTEXT *)context;
# if defined(__M_X64)
# if defined(_M_X64)
Report("Register values:\n");
Printf("rax = %llx ", ctx->Rax);
Printf("rbx = %llx ", ctx->Rbx);
Expand Down Expand Up @@ -1068,6 +1068,13 @@ void SignalContext::DumpAllRegisters(void *context) {
Printf("ebp = %lx ", ctx->Ebp);
Printf("esp = %lx ", ctx->Esp);
Printf("\n");
# elif defined(_M_ARM64)
Report("Register values:\n");
for (int i = 0; i <= 30; i++) {
Printf("x%d%s = %llx", i < 10 ? " " : "", ctx->X[i]);
if (i % 4 == 3)
Printf("\n");
}
# else
// TODO
(void)ctx;
Expand Down
5 changes: 4 additions & 1 deletion compiler-rt/lib/scudo/standalone/primary64.h
Original file line number Diff line number Diff line change
Expand Up @@ -1492,8 +1492,11 @@ template <typename Config> class SizeClassAllocator64 {
}

const uptr PushedBytesDelta = BytesInBG - BG->BytesInBGAtLastCheckpoint;
if (PushedBytesDelta < getMinReleaseAttemptSize(BlockSize))
if (PushedBytesDelta < getMinReleaseAttemptSize(BlockSize)) {
Prev = BG;
BG = BG->Next;
continue;
}

// Given the randomness property, we try to release the pages only if the
// bytes used by free blocks exceed certain proportion of group size. Note
Expand Down
172 changes: 172 additions & 0 deletions compiler-rt/test/asan/TestCases/copy_container_annotations.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
// RUN: %clangxx_asan -fexceptions -O %s -o %t && %env_asan_opts=detect_stack_use_after_return=0 %run %t
//
// Test __sanitizer_copy_contiguous_container_annotations.

#include <algorithm>
#include <iostream>
#include <memory>
#include <numeric>
#include <vector>

#include <assert.h>
#include <sanitizer/asan_interface.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static constexpr size_t kGranularity = 8;

template <class T> static constexpr T RoundDown(T x) {
return reinterpret_cast<T>(reinterpret_cast<uintptr_t>(x) &
~(kGranularity - 1));
}
template <class T> static constexpr T RoundUp(T x) {
return reinterpret_cast<T>(
RoundDown(reinterpret_cast<uintptr_t>(x) + kGranularity - 1));
}

static std::vector<int> GetPoisonedState(char *begin, char *end) {
std::vector<int> result;
for (char *ptr = begin; ptr != end; ++ptr) {
result.push_back(__asan_address_is_poisoned(ptr));
}
return result;
}

static void RandomPoison(char *beg, char *end) {
assert(beg == RoundDown(beg));
assert(end == RoundDown(end));
__asan_poison_memory_region(beg, end - beg);
for (beg = RoundUp(beg); beg < end; beg += kGranularity) {
__asan_unpoison_memory_region(beg, rand() % (kGranularity + 1));
}
}

template <bool benchmark>
static void Test(size_t capacity, size_t off_src, size_t off_dst,
char *src_buffer_beg, char *src_buffer_end,
char *dst_buffer_beg, char *dst_buffer_end) {
size_t dst_buffer_size = dst_buffer_end - dst_buffer_beg;
char *src_beg = src_buffer_beg + off_src;
char *src_end = src_beg + capacity;

char *dst_beg = dst_buffer_beg + off_dst;
char *dst_end = dst_beg + capacity;
if (benchmark) {
__sanitizer_copy_contiguous_container_annotations(src_beg, src_end, dst_beg,
dst_end);
return;
}

std::vector<int> src_poison_states =
GetPoisonedState(src_buffer_beg, src_buffer_end);
std::vector<int> dst_poison_before =
GetPoisonedState(dst_buffer_beg, dst_buffer_end);
__sanitizer_copy_contiguous_container_annotations(src_beg, src_end, dst_beg,
dst_end);
std::vector<int> dst_poison_after =
GetPoisonedState(dst_buffer_beg, dst_buffer_end);

// Create ideal copy of src over dst.
std::vector<int> dst_poison_exp = dst_poison_before;
for (size_t cur = 0; cur < capacity; ++cur)
dst_poison_exp[off_dst + cur] = src_poison_states[off_src + cur];

// Unpoison prefixes of Asan granules.
for (size_t cur = dst_buffer_size - 1; cur > 0; --cur) {
if (cur % kGranularity != 0 && !dst_poison_exp[cur])
dst_poison_exp[cur - 1] = 0;
}

if (dst_poison_after != dst_poison_exp) {
std::cerr << "[" << off_dst << ", " << off_dst + capacity << ")\n";
for (size_t i = 0; i < dst_poison_after.size(); ++i) {
std::cerr << i << ":\t" << dst_poison_before[i] << "\t"
<< dst_poison_after[i] << "\t" << dst_poison_exp[i] << "\n";
}
std::cerr << "----------\n";

assert(dst_poison_after == dst_poison_exp);
}
}

template <bool benchmark>
static void TestNonOverlappingContainers(size_t capacity, size_t off_src,
size_t off_dst) {
// Test will copy [off_src, off_src + capacity) to [off_dst, off_dst + capacity).
// Allocate buffers to have additional granule before and after tested ranges.
off_src += kGranularity;
off_dst += kGranularity;
size_t src_buffer_size = RoundUp(off_src + capacity) + kGranularity;
size_t dst_buffer_size = RoundUp(off_dst + capacity) + kGranularity;

std::unique_ptr<char[]> src_buffer =
std::make_unique<char[]>(src_buffer_size);
std::unique_ptr<char[]> dst_buffer =
std::make_unique<char[]>(dst_buffer_size);

char *src_buffer_beg = src_buffer.get();
char *src_buffer_end = src_buffer_beg + src_buffer_size;
assert(RoundDown(src_buffer_beg) == src_buffer_beg);

char *dst_buffer_beg = dst_buffer.get();
char *dst_buffer_end = dst_buffer_beg + dst_buffer_size;
assert(RoundDown(dst_buffer_beg) == dst_buffer_beg);

for (int i = 0; i < 35; i++) {
if (!benchmark || !i) {
RandomPoison(src_buffer_beg, src_buffer_end);
RandomPoison(dst_buffer_beg, dst_buffer_end);
}

Test<benchmark>(capacity, off_src, off_dst, src_buffer_beg, src_buffer_end,
dst_buffer_beg, dst_buffer_end);
}

__asan_unpoison_memory_region(src_buffer_beg, src_buffer_size);
__asan_unpoison_memory_region(dst_buffer_beg, dst_buffer_size);
}

template <bool benchmark>
static void TestOverlappingContainers(size_t capacity, size_t off_src,
size_t off_dst) {
// Test will copy [off_src, off_src + capacity) to [off_dst, off_dst + capacity).
// Allocate buffers to have additional granule before and after tested ranges.
off_src += kGranularity;
off_dst += kGranularity;
size_t buffer_size =
RoundUp(std::max(off_src, off_dst) + capacity) + kGranularity;

// Use unique_ptr with a custom deleter to manage the buffer
std::unique_ptr<char[]> buffer = std::make_unique<char[]>(buffer_size);

char *buffer_beg = buffer.get();
char *buffer_end = buffer_beg + buffer_size;
assert(RoundDown(buffer_beg) == buffer_beg);

for (int i = 0; i < 35; i++) {
if (!benchmark || !i)
RandomPoison(buffer_beg, buffer_end);
Test<benchmark>(capacity, off_src, off_dst, buffer_beg, buffer_end,
buffer_beg, buffer_end);
}

__asan_unpoison_memory_region(buffer_beg, buffer_size);
}

int main(int argc, char **argv) {
int n = argc == 1 ? 64 : atoi(argv[1]);
for (size_t off_src = 0; off_src < kGranularity; off_src++) {
for (size_t off_dst = 0; off_dst < kGranularity; off_dst++) {
for (int capacity = 0; capacity <= n; capacity++) {
if (n < 1024) {
TestNonOverlappingContainers<false>(capacity, off_src, off_dst);
TestOverlappingContainers<false>(capacity, off_src, off_dst);
} else {
TestNonOverlappingContainers<true>(capacity, off_src, off_dst);
TestOverlappingContainers<true>(capacity, off_src, off_dst);
}
}
}
}
}
33 changes: 0 additions & 33 deletions compiler-rt/test/asan/Unit/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,6 @@ import shlex
# Load common config for all compiler-rt unit tests.
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/unittests/lit.common.unit.configured")

def push_ld_library_path(config, new_path):
new_ld_library_path = os.path.pathsep.join(
(new_path, config.environment.get('LD_LIBRARY_PATH', '')))
config.environment['LD_LIBRARY_PATH'] = new_ld_library_path

if platform.system() == 'FreeBSD':
new_ld_32_library_path = os.path.pathsep.join(
(new_path, config.environment.get('LD_32_LIBRARY_PATH', '')))
config.environment['LD_32_LIBRARY_PATH'] = new_ld_32_library_path

if platform.system() == 'SunOS':
new_ld_library_path_32 = os.path.pathsep.join(
(new_path, config.environment.get('LD_LIBRARY_PATH_32', '')))
config.environment['LD_LIBRARY_PATH_32'] = new_ld_library_path_32

new_ld_library_path_64 = os.path.pathsep.join(
(new_path, config.environment.get('LD_LIBRARY_PATH_64', '')))
config.environment['LD_LIBRARY_PATH_64'] = new_ld_library_path_64

# Setup config name.
config.name = 'AddressSanitizer-Unit'

Expand All @@ -48,19 +29,5 @@ config.test_exec_root = os.path.join("@COMPILER_RT_BINARY_DIR@",

config.test_source_root = config.test_exec_root

# When LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on, the initial value of
# config.compiler_rt_libdir (COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR) has the
# host triple as the trailing path component. The value is incorrect for i386
# tests on x86_64 hosts and vice versa. Adjust config.compiler_rt_libdir
# accordingly.
if config.enable_per_target_runtime_dir:
if config.target_arch == 'i386':
config.compiler_rt_libdir = re.sub(r'/x86_64(?=-[^/]+$)', '/i386', config.compiler_rt_libdir)
elif config.target_arch == 'x86_64':
config.compiler_rt_libdir = re.sub(r'/i386(?=-[^/]+$)', '/x86_64', config.compiler_rt_libdir)

# Set LD_LIBRARY_PATH to pick dynamic runtime up properly.
push_ld_library_path(config, config.compiler_rt_libdir)

if not config.parallelism_group:
config.parallelism_group = 'shadow-memory'
4 changes: 2 additions & 2 deletions compiler-rt/test/fuzzer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ endmacro()

test_fuzzer("default")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
if(TARGET cxx_shared)
if(LIBCXX_ENABLE_SHARED)
test_fuzzer("libc++" DEPS cxx_shared)
endif()
if(TARGET cxx_static)
if(LIBCXX_ENABLE_STATIC)
test_fuzzer("static-libc++" DEPS cxx_static)
endif()
endif()
Expand Down
18 changes: 13 additions & 5 deletions compiler-rt/test/lit.common.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,26 @@ def push_dynamic_library_lookup_path(config, new_path):

# When LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on, the initial value of
# config.compiler_rt_libdir (COMPILER_RT_RESOLVED_LIBRARY_OUTPUT_DIR) has the
# triple as the trailing path component. The value is incorrect for -m32/-m64.
# Adjust config.compiler_rt accordingly.
# host triple as the trailing path component. The value is incorrect for 32-bit
# tests on 64-bit hosts and vice versa. Adjust config.compiler_rt_libdir
# accordingly.
if config.enable_per_target_runtime_dir:
if "-m32" in shlex.split(config.target_cflags):
if config.target_arch == "i386":
config.compiler_rt_libdir = re.sub(
r"/x86_64(?=-[^/]+$)", "/i386", config.compiler_rt_libdir
)
elif "-m64" in shlex.split(config.target_cflags):
elif config.target_arch == "x86_64":
config.compiler_rt_libdir = re.sub(
r"/i386(?=-[^/]+$)", "/x86_64", config.compiler_rt_libdir
)

if config.target_arch == "sparc":
config.compiler_rt_libdir = re.sub(
r"/sparcv9(?=-[^/]+$)", "/sparc", config.compiler_rt_libdir
)
elif config.target_arch == "sparcv9":
config.compiler_rt_libdir = re.sub(
r"/sparc(?=-[^/]+$)", "/sparcv9", config.compiler_rt_libdir
)

# Check if the test compiler resource dir matches the local build directory
# (which happens with -DLLVM_ENABLE_PROJECTS=clang;compiler-rt) or if we are
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Check that sanitizer prints registers dump_registers on dump_registers=1
// RUN: %clangxx %s -o %t
// RUN: %env_tool_opts=dump_registers=0 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NODUMP
// RUN: not %run %t 2>&1 | FileCheck %s --strict-whitespace --check-prefix=CHECK-DUMP
//
// REQUIRES: aarch64-pc-windows-msvc

#include <windows.h>

int main() {
RaiseException(EXCEPTION_ACCESS_VIOLATION, 0, 0, NULL);
// CHECK-DUMP: Register values
// CHECK-DUMP-NEXT: x0 = {{0x[0-9a-f]+}} x1 = {{0x[0-9a-f]+}} x2 = {{0x[0-9a-f]+}} x3 = {{0x[0-9a-f]+}}
// CHECK-DUMP-NEXT: x4 = {{0x[0-9a-f]+}} x5 = {{0x[0-9a-f]+}} x6 = {{0x[0-9a-f]+}} x7 = {{0x[0-9a-f]+}}
// CHECK-DUMP-NEXT: x8 = {{0x[0-9a-f]+}} x9 = {{0x[0-9a-f]+}} x10 = {{0x[0-9a-f]+}} x11 = {{0x[0-9a-f]+}}
// CHECK-DUMP-NEXT:x12 = {{0x[0-9a-f]+}} x13 = {{0x[0-9a-f]+}} x14 = {{0x[0-9a-f]+}} x15 = {{0x[0-9a-f]+}}
// CHECK-DUMP-NEXT:x16 = {{0x[0-9a-f]+}} x17 = {{0x[0-9a-f]+}} x18 = {{0x[0-9a-f]+}} x19 = {{0x[0-9a-f]+}}
// CHECK-DUMP-NEXT:x20 = {{0x[0-9a-f]+}} x21 = {{0x[0-9a-f]+}} x22 = {{0x[0-9a-f]+}} x23 = {{0x[0-9a-f]+}}
// CHECK-DUMP-NEXT:x24 = {{0x[0-9a-f]+}} x25 = {{0x[0-9a-f]+}} x26 = {{0x[0-9a-f]+}} x27 = {{0x[0-9a-f]+}}
// CHECK-DUMP-NEXT:x28 = {{0x[0-9a-f]+}} fp = {{0x[0-9a-f]+}} lr = {{0x[0-9a-f]+}} sp = {{0x[0-9a-f]+}}
// CHECK-NODUMP-NOT: Register values
return 0;
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ def getRoot(config):

root = getRoot(config)

if root.host_os not in ["Linux"]:
if root.host_os in ["Windows"]:
config.unsupported = True
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 11 additions & 12 deletions flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,19 @@ void DataSharingProcessor::insertLastPrivateCompare(mlir::Operation *op) {
// Update the original variable just before exiting the worksharing
// loop. Conversion as follows:
//
// omp.wsloop / omp.simd { omp.wsloop / omp.simd {
// omp.loop_nest { omp.loop_nest {
// ... ...
// store ===> store
// omp.yield %v = arith.addi %iv, %step
// } %cmp = %step < 0 ? %v < %ub : %v > %ub
// omp.terminator fir.if %cmp {
// } fir.store %v to %loopIV
// ^%lpv_update_blk:
// omp.wsloop / omp.simd { omp.wsloop / omp.simd {
// omp.loop_nest { omp.loop_nest {
// ... ...
// store ===> store
// omp.yield %v = arith.addi %iv, %step
// } %cmp = %step < 0 ? %v < %ub : %v > %ub
// } fir.if %cmp {
// fir.store %v to %loopIV
// ^%lpv_update_blk:
// }
// omp.yield
// }
// omp.yield
// }
// omp.terminator
// }

// Only generate the compare once in presence of multiple LastPrivate
// clauses.
Expand Down
3 changes: 0 additions & 3 deletions flang/lib/Lower/OpenMP/OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,9 +1094,6 @@ static OpTy genWrapperOp(lower::AbstractConverter &converter,
// Create entry block with arguments.
genEntryBlock(converter, args, op.getRegion());

firOpBuilder.setInsertionPoint(
lower::genOpenMPTerminator(firOpBuilder, op, loc));

return op;
}

Expand Down
10 changes: 0 additions & 10 deletions flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func.func @_QPsb1(%arg0: !fir.ref<i32> {fir.bindc_name = "n"}, %arg1: !fir.ref<!
fir.store %3 to %6 : !fir.ref<i32>
omp.yield
}
omp.terminator
}
omp.terminator
}
Expand All @@ -43,7 +42,6 @@ func.func @_QPsb1(%arg0: !fir.ref<i32> {fir.bindc_name = "n"}, %arg1: !fir.ref<!
// CHECK: llvm.store %[[I1]], %[[ARR_I_REF]] : i32, !llvm.ptr
// CHECK: omp.yield
// CHECK: }
// CHECK: omp.terminator
// CHECK: }
// CHECK: omp.terminator
// CHECK: }
Expand Down Expand Up @@ -93,7 +91,6 @@ func.func @_QPsb(%arr: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "arr"}) {
fir.store %indx to %3 : !fir.ref<i32>
omp.yield
}
omp.terminator
}
omp.terminator
}
Expand All @@ -110,7 +107,6 @@ func.func @_QPsb(%arr: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "arr"}) {
// CHECK-NEXT: omp.loop_nest (%[[INDX:.*]]) : i32 = (%[[C1]]) to (%[[C50]]) inclusive step (%[[C1]]) {
// CHECK: llvm.store %[[INDX]], %{{.*}} : i32, !llvm.ptr
// CHECK: omp.yield
// CHECK: omp.terminator
// CHECK: omp.terminator
// CHECK: llvm.return

Expand Down Expand Up @@ -200,7 +196,6 @@ func.func @_QPsimd1(%arg0: !fir.ref<i32> {fir.bindc_name = "n"}, %arg1: !fir.ref
fir.store %3 to %6 : !fir.ref<i32>
omp.yield
}
omp.terminator
}
omp.terminator
}
Expand All @@ -226,7 +221,6 @@ func.func @_QPsimd1(%arg0: !fir.ref<i32> {fir.bindc_name = "n"}, %arg1: !fir.ref
// CHECK: llvm.store %[[I1]], %[[ARR_I_REF]] : i32, !llvm.ptr
// CHECK: omp.yield
// CHECK: }
// CHECK: omp.terminator
// CHECK: }
// CHECK: omp.terminator
// CHECK: }
Expand Down Expand Up @@ -519,7 +513,6 @@ func.func @_QPsimd_with_nested_loop() {
fir.store %7 to %3 : !fir.ref<i32>
omp.yield
}
omp.terminator
}
return
}
Expand All @@ -540,7 +533,6 @@ func.func @_QPsimd_with_nested_loop() {
// CHECK: ^bb3:
// CHECK: omp.yield
// CHECK: }
// CHECK: omp.terminator
// CHECK: }
// CHECK: llvm.return
// CHECK: }
Expand Down Expand Up @@ -736,7 +728,6 @@ func.func @_QPsb() {
// CHECK: %[[RES_EXT:.*]] = llvm.zext %[[RES]] : i1 to i32
// CHECK: llvm.store %[[RES_EXT]], %[[PRV]] : i32, !llvm.ptr
// CHECK: omp.yield
// CHECK: omp.terminator
// CHECK: omp.terminator
// CHECK: llvm.return

Expand Down Expand Up @@ -781,7 +772,6 @@ func.func @_QPsimple_reduction(%arg0: !fir.ref<!fir.array<100x!fir.logical<4>>>
fir.store %11 to %prv : !fir.ref<!fir.logical<4>>
omp.yield
}
omp.terminator
}
omp.terminator
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
! CHECK: fir.store %[[result]] to %{{.*}} : !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
2 changes: 0 additions & 2 deletions flang/test/Lower/OpenMP/copyin.f90
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ subroutine copyin_derived_type()
! CHECK: fir.call @_QPsub4(%[[VAL_9]]#1) fastmath<contract> : (!fir.ref<i32>) -> ()
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -338,7 +337,6 @@ subroutine common_1()
! CHECK: hlfir.assign %[[VAL_40]] to %[[VAL_31]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/default-clause-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ subroutine skipped_default_clause_checks()
!CHECK-NEXT: omp.loop_nest (%[[ARG:.*]]) {{.*}} {
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/default-clause.f90
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ subroutine skipped_default_clause_checks()
!CHECK-NEXT: omp.loop_nest (%[[ARG:.*]]) {{.*}} {
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/hlfir-wsloop.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ subroutine simple_loop
print*, i
end do
! CHECK: omp.yield
! CHECK: omp.terminator
!$OMP END DO
! CHECK: omp.terminator
!$OMP END PARALLEL
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/lastprivate-commonblock.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
!CHECK: }
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
subroutine lastprivate_common
common /c/ x, y
Expand Down
2 changes: 0 additions & 2 deletions flang/test/Lower/OpenMP/lastprivate-iv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
!CHECK: }
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
subroutine lastprivate_iv_inc()
integer :: i
Expand Down Expand Up @@ -66,7 +65,6 @@ subroutine lastprivate_iv_inc()
!CHECK: }
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
subroutine lastprivate_iv_dec()
integer :: i
Expand Down
11 changes: 5 additions & 6 deletions flang/test/Lower/OpenMP/location.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ subroutine sub_loop()
print *, i
!CHECK: omp.yield loc(#[[LOOP_LOC:.*]])
!CHECK: } loc(#[[LOOP_LOC]])
!CHECK: omp.terminator loc(#[[LOOP_LOC]])
!CHECK: } loc(#[[LOOP_LOC]])
end do
!$omp end do
Expand Down Expand Up @@ -64,8 +63,8 @@ subroutine sub_if(c)
!CHECK: #[[PAR_LOC]] = loc("{{.*}}location.f90":9:9)
!CHECK: #[[TAR_LOC]] = loc("{{.*}}location.f90":21:9)
!CHECK: #[[LOOP_LOC]] = loc("{{.*}}location.f90":33:9)
!CHECK: #[[BAR_LOC]] = loc("{{.*}}location.f90":47:9)
!CHECK: #[[TW_LOC]] = loc("{{.*}}location.f90":49:9)
!CHECK: #[[TY_LOC]] = loc("{{.*}}location.f90":51:9)
!CHECK: #[[IF_LOC]] = loc("{{.*}}location.f90":58:14)
!CHECK: #[[TASK_LOC]] = loc("{{.*}}location.f90":58:9)
!CHECK: #[[BAR_LOC]] = loc("{{.*}}location.f90":46:9)
!CHECK: #[[TW_LOC]] = loc("{{.*}}location.f90":48:9)
!CHECK: #[[TY_LOC]] = loc("{{.*}}location.f90":50:9)
!CHECK: #[[IF_LOC]] = loc("{{.*}}location.f90":57:14)
!CHECK: #[[TASK_LOC]] = loc("{{.*}}location.f90":57:9)
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
!CHECK: }
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }

subroutine lastprivate_character(arg1)
Expand Down Expand Up @@ -80,7 +79,6 @@ subroutine lastprivate_character(arg1)
!CHECK: }
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }

subroutine lastprivate_int(arg1)
Expand Down Expand Up @@ -124,7 +122,6 @@ subroutine lastprivate_int(arg1)
!CHECK: }
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }

subroutine mult_lastprivate_int(arg1, arg2)
Expand Down Expand Up @@ -169,7 +166,6 @@ subroutine mult_lastprivate_int(arg1, arg2)
!CHECK: }
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }

subroutine mult_lastprivate_int2(arg1, arg2)
Expand Down Expand Up @@ -217,7 +213,6 @@ subroutine mult_lastprivate_int2(arg1, arg2)
!CHECK-NEXT: }
!CHECK-NEXT: omp.yield
!CHECK-NEXT: }
!CHECK-NEXT: omp.terminator
!CHECK-NEXT: }

subroutine firstpriv_lastpriv_int(arg1, arg2)
Expand Down Expand Up @@ -265,7 +260,6 @@ subroutine firstpriv_lastpriv_int(arg1, arg2)
!CHECK-NEXT: }
!CHECK-NEXT: omp.yield
!CHECK-NEXT: }
!CHECK-NEXT: omp.terminator
!CHECK-NEXT: }

subroutine firstpriv_lastpriv_int2(arg1)
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/parallel-private-clause-fixes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
! CHECK: fir.store %[[VAL_12]]#1 to %[[PRIV_J_DECL]]#1 : !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/parallel-private-clause.f90
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ subroutine simple_loop_1
print*, i
end do
! FIRDialect: omp.yield
! FIRDialect: omp.terminator
!$OMP END DO
! FIRDialect: omp.terminator
!$OMP END PARALLEL
Expand Down Expand Up @@ -306,7 +305,6 @@ subroutine simple_loop_2
print*, i
end do
! FIRDialect: omp.yield
! FIRDialect: omp.terminator
! FIRDialect: {{%.*}} = fir.load %[[R_DECL]]#0 : !fir.ref<!fir.box<!fir.heap<f32>>>
! FIRDialect: fir.if {{%.*}} {
! FIRDialect: [[LD:%.*]] = fir.load %[[R_DECL]]#0 : !fir.ref<!fir.box<!fir.heap<f32>>>
Expand Down Expand Up @@ -346,7 +344,6 @@ subroutine simple_loop_3
print*, i
end do
! FIRDialect: omp.yield
! FIRDialect: omp.terminator
! FIRDialect: {{%.*}} = fir.load [[R_DECL]]#0 : !fir.ref<!fir.box<!fir.heap<f32>>>
! FIRDialect: fir.if {{%.*}} {
! FIRDialect: [[LD:%.*]] = fir.load [[R_DECL]]#0 : !fir.ref<!fir.box<!fir.heap<f32>>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ program reduce
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_29]] : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ program reduce
! CHECK: hlfir.assign %[[VAL_36]] to %[[VAL_39]] : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/parallel-reduction3.f90
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
! CHECK: hlfir.destroy %[[VAL_28]] : !hlfir.expr<?xi32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
2 changes: 0 additions & 2 deletions flang/test/Lower/OpenMP/parallel-wsloop-firstpriv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ subroutine omp_do_firstprivate(a)
! CHECK-NEXT: fir.call @_QPfoo(%[[I_PVT_DECL]]#1, %[[A_PVT_DECL]]#1) {{.*}}: (!fir.ref<i32>, !fir.ref<i32>) -> ()
! CHECK-NEXT: omp.yield
! CHECK-NEXT: }
! CHECK-NEXT: omp.terminator
! CHECK-NEXT: }
do i=1, a
call foo(i, a)
Expand Down Expand Up @@ -70,7 +69,6 @@ subroutine omp_do_firstprivate2(a, n)
! CHECK: fir.store %[[ARG2]] to %[[I_PVT_DECL]]#1 : !fir.ref<i32>
! CHECK: fir.call @_QPfoo(%[[I_PVT_DECL]]#1, %[[A_PVT_DECL]]#1) {{.*}}: (!fir.ref<i32>, !fir.ref<i32>) -> ()
! CHECK: omp.yield
! CHECK: omp.terminator
do i= a, n
call foo(i, a)
end do
Expand Down
4 changes: 0 additions & 4 deletions flang/test/Lower/OpenMP/parallel-wsloop-lastpriv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ subroutine omp_do_lastprivate(a)

! CHECK-NEXT: omp.yield
! CHECK-NEXT: }
! CHECK-NEXT: omp.terminator
! CHECK-NEXT: }
do i=1, a
call foo(i, a)
Expand Down Expand Up @@ -90,7 +89,6 @@ subroutine omp_do_lastprivate2(a, n)
! CHECK: }

! CHECK: omp.yield
! CHECK: omp.terminator
do i= a, n
call foo(i, a)
end do
Expand Down Expand Up @@ -148,7 +146,6 @@ subroutine omp_do_lastprivate_collapse2(a)

! CHECK-NEXT: omp.yield
! CHECK-NEXT: }
! CHECK-NEXT: omp.terminator
! CHECK-NEXT: }
do i=1, a
do j=1, a
Expand Down Expand Up @@ -224,7 +221,6 @@ subroutine omp_do_lastprivate_collapse3(a)

! CHECK-NEXT: omp.yield
! CHECK-NEXT: }
! CHECK-NEXT: omp.terminator
! CHECK-NEXT: }
do i=1, a
do j=1, a
Expand Down
8 changes: 0 additions & 8 deletions flang/test/Lower/OpenMP/parallel-wsloop.f90
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ subroutine simple_parallel_do
end do
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
!$OMP END PARALLEL DO
end subroutine

Expand Down Expand Up @@ -51,7 +50,6 @@ subroutine parallel_do_with_parallel_clauses(cond, nt)
end do
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
!$OMP END PARALLEL DO
end subroutine

Expand All @@ -77,7 +75,6 @@ subroutine parallel_do_with_clauses(nt)
end do
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
!$OMP END PARALLEL DO
end subroutine

Expand Down Expand Up @@ -120,7 +117,6 @@ subroutine parallel_do_with_privatisation_clauses(cond,nt)
end do
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
!$OMP END PARALLEL DO
end subroutine

Expand Down Expand Up @@ -165,7 +161,6 @@ end subroutine parallel_private_do
! CHECK: fir.call @_QPfoo(%[[I_PRIV_DECL]]#1, %[[COND_DECL]]#1, %[[NT_PRIV_DECL]]#1) {{.*}}: (!fir.ref<i32>, !fir.ref<!fir.logical<4>>, !fir.ref<i32>) -> ()
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -212,7 +207,6 @@ end subroutine omp_parallel_multiple_firstprivate_do
! CHECK: fir.call @_QPbar(%[[I_PRIV_DECL]]#1, %[[A_PRIV_DECL]]#1) {{.*}}: (!fir.ref<i32>, !fir.ref<i32>) -> ()
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -264,7 +258,6 @@ end subroutine parallel_do_private
! CHECK: fir.call @_QPfoo(%[[I_PRIV_DECL]]#1, %[[COND_PRIV_DECL]]#1, %[[NT_PRIV_DECL]]#1) {{.*}}: (!fir.ref<i32>, !fir.ref<!fir.logical<4>>, !fir.ref<i32>) -> ()
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -317,7 +310,6 @@ end subroutine omp_parallel_do_multiple_firstprivate
! CHECK: fir.call @_QPbar(%[[I_PRIV_DECL]]#1, %[[A_PRIV_DECL]]#1) {{.*}}: (!fir.ref<i32>, !fir.ref<i32>) -> ()
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/private-derived-type.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ end subroutine s4
! Check we do call FortranAInitialize on the derived type
! CHECK: %[[VAL_30:.*]] = fir.call @_FortranAInitialize(%[[VAL_28]], %[[VAL_29]], %[[VAL_27]]) fastmath<contract> : (!fir.box<none>, !fir.ref<i8>, i32) -> none
! CHECK: omp.wsloop {
! CHECK: omp.terminator
! CHECK: }
! CHECK: %[[VAL_39:.*]] = fir.embox %[[VAL_9]]#1 : (!fir.ref<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) -> !fir.box<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>
! CHECK: %[[VAL_40:.*]] = fir.convert %[[VAL_39]] : (!fir.box<!fir.type<_QFs4Ty3{x:!fir.box<!fir.heap<i32>>}>>) -> !fir.box<none>
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/simd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ subroutine lastprivate_with_simd
!CHECK: }
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
!$omp simd lastprivate(sum)
do i = 1, 100
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/stop-stmt-in-region.f90
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ subroutine test_stop_in_region3()
! CHECK: ^bb3:
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: cf.br ^bb1
! CHECK: ^bb1:
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/target.f90
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ subroutine omp_target_parallel_do
end do
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
Expand Down
7 changes: 0 additions & 7 deletions flang/test/Lower/OpenMP/unstructured.f90
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ subroutine ss2(n) ! unstructured OpenMP construct; loop exit inside construct
! CHECK: @_FortranAioOutputInteger32(%{{.*}}, %[[LOAD_1]])
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }

! CHECK: %[[ALLOCA_1:.*]] = fir.alloca i32 {{{.*}}, pinned, {{.*}}}
Expand All @@ -101,7 +100,6 @@ subroutine ss2(n) ! unstructured OpenMP construct; loop exit inside construct
! CHECK: ^bb6: // 2 preds: ^bb2, ^bb4
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: br ^bb1
! CHECK: ^bb4: // pred: ^bb1
Expand Down Expand Up @@ -144,7 +142,6 @@ subroutine ss3(n) ! nested unstructured OpenMP constructs
! CHECK: }
! CHECK-NEXT: omp.yield
! CHECK-NEXT: }
! CHECK-NEXT: omp.terminator
! CHECK-NEXT: }
! CHECK: omp.terminator
! CHECK-NEXT: }
Expand Down Expand Up @@ -179,7 +176,6 @@ subroutine ss4(n) ! CYCLE in OpenMP wsloop constructs
! CHECK: ^[[BB6]]:
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -222,7 +218,6 @@ subroutine ss5() ! EXIT inside OpenMP wsloop (inside parallel)
! CHECK: ^[[BB6]]:
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: br ^[[BB1_OUTER]]
! CHECK: ^[[BB3_OUTER]]:
Expand Down Expand Up @@ -269,7 +264,6 @@ subroutine ss6() ! EXIT inside OpenMP wsloop in a do loop (inside parallel)
! CHECK-NEXT: ^[[BB6]]:
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -310,7 +304,6 @@ subroutine ss7() ! EXIT inside OpenMP parallel do (inside do loop)
! CHECK-NEXT: ^[[BB6]]:
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop-chunks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ program wsloop
! CHECK: {{.*}} = fir.call @_FortranAioOutputInteger32({{.*}}, %[[LOAD_IV]]) {{.*}}: (!fir.ref<i8>, i32) -> i1
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }

end do
Expand All @@ -50,7 +49,6 @@ program wsloop
! CHECK: {{.*}} = fir.call @_FortranAioOutputInteger32({{.*}}, %[[VAL_25]]) {{.*}}: (!fir.ref<i8>, i32) -> i1
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }

end do
Expand All @@ -77,7 +75,6 @@ program wsloop
! CHECK: {{.*}} = fir.call @_FortranAioOutputInteger32({{.*}}, %[[VAL_40]]) {{.*}}: (!fir.ref<i8>, i32) -> i1
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: return
! CHECK: }
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-collapse.f90
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ program wsloop_collapse
!CHECK: hlfir.assign %[[VAL_42]] to %[[VAL_19]]#0 : i32, !fir.ref<i32>
!CHECK: omp.yield
!CHECK-NEXT: }
!CHECK-NEXT: omp.terminator
x = x + i + j + k
end do
end do
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-monotonic.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ program wsloop_dynamic
!CHECK: fir.call @_FortranAioEndIoStatement(%[[RTBEGIN]]) {{.*}}: (!fir.ref<i8>) -> i32
end do
!CHECK: omp.yield
!CHECK: omp.terminator
!CHECK: omp.terminator
!CHECK: }

Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-nonmonotonic.f90
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ program wsloop_dynamic
end do
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
Expand Down
2 changes: 0 additions & 2 deletions flang/test/Lower/OpenMP/wsloop-ordered.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ subroutine wsloop_ordered_no_para()
! CHECK-NEXT: omp.loop_nest (%{{.*}}) : i32 = (%{{.*}}) to (%{{.*}}) inclusive step (%{{.*}}) {
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }

!$omp do ordered
Expand All @@ -32,7 +31,6 @@ subroutine wsloop_ordered_with_para()
! CHECK-NEXT: omp.loop_nest (%{{.*}}) : i32 = (%{{.*}}) to (%{{.*}}) inclusive step (%{{.*}}) {
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }

!$omp do ordered(1)
Expand Down
7 changes: 0 additions & 7 deletions flang/test/Lower/OpenMP/wsloop-reduction-add-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
! CHECK: hlfir.assign %[[VAL_15]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -144,7 +143,6 @@ subroutine simple_int_reduction
! CHECK: hlfir.assign %[[VAL_16]] to %[[VAL_12]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -187,7 +185,6 @@ subroutine simple_real_reduction
! CHECK: hlfir.assign %[[VAL_15]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -230,7 +227,6 @@ subroutine simple_int_reduction_switch_order
! CHECK: hlfir.assign %[[VAL_16]] to %[[VAL_12]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -290,7 +286,6 @@ subroutine simple_real_reduction_switch_order
! CHECK: hlfir.assign %[[VAL_31]] to %[[VAL_22]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -357,7 +352,6 @@ subroutine multiple_int_reductions_same_type
! CHECK: hlfir.assign %[[VAL_34]] to %[[VAL_22]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -433,7 +427,6 @@ subroutine multiple_real_reductions_same_type
! CHECK: hlfir.assign %[[VAL_42]] to %[[VAL_27]]#0 : f64, !fir.ref<f64>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
7 changes: 0 additions & 7 deletions flang/test/Lower/OpenMP/wsloop-reduction-add.f90
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
! CHECK: hlfir.assign %[[VAL_15]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -112,7 +111,6 @@ subroutine simple_int_reduction
! CHECK: hlfir.assign %[[VAL_16]] to %[[VAL_12]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -155,7 +153,6 @@ subroutine simple_real_reduction
! CHECK: hlfir.assign %[[VAL_15]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -198,7 +195,6 @@ subroutine simple_int_reduction_switch_order
! CHECK: hlfir.assign %[[VAL_16]] to %[[VAL_12]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -258,7 +254,6 @@ subroutine simple_real_reduction_switch_order
! CHECK: hlfir.assign %[[VAL_31]] to %[[VAL_22]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -325,7 +320,6 @@ subroutine multiple_int_reductions_same_type
! CHECK: hlfir.assign %[[VAL_34]] to %[[VAL_22]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -401,7 +395,6 @@ subroutine multiple_real_reductions_same_type
! CHECK: hlfir.assign %[[VAL_42]] to %[[VAL_27]]#0 : f64, !fir.ref<f64>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ program reduce15
! CHECK: hlfir.destroy %[[VAL_68]] : !hlfir.expr<?xi32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down Expand Up @@ -295,7 +294,6 @@ program reduce15
! CHECK: hlfir.destroy %[[VAL_100]] : !hlfir.expr<?xi32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-allocatable.f90
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ program reduce
! CHECK: hlfir.assign %[[VAL_17]] to %[[VAL_16]]#0 realloc : i32, !fir.ref<!fir.box<!fir.heap<i32>>>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ subroutine reduce(r)
! CHECK: hlfir.assign %[[VAL_18]] to %[[VAL_21]] : f64, !fir.ref<f64>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-array.f90
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ program reduce
! CHECK: hlfir.assign %[[VAL_22]] to %[[VAL_25]] : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-array2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ program reduce
! CHECK: hlfir.assign %[[VAL_30]] to %[[VAL_33]] : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-iand-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
! CHECK: %[[VAL_20:.*]] = arith.andi %[[VAL_18]], %[[VAL_19]] : i32
! CHECK: hlfir.assign %[[VAL_20]] to %[[VAL_14]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator


Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-iand.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
! CHECK: %[[VAL_20:.*]] = arith.andi %[[VAL_18]], %[[VAL_19]] : i32
! CHECK: hlfir.assign %[[VAL_20]] to %[[VAL_14]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator


Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-ieor-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
!CHECK: hlfir.assign %[[RES]] to %[[PRV_DECL]]#0 : i32, !fir.ref<i32>
!CHECK: omp.yield
!CHECK: omp.terminator
!CHECK: omp.terminator

subroutine reduction_ieor(y)
integer :: x, y(:)
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-ieor.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
!CHECK: hlfir.assign %[[RES]] to %[[PRV_DECL]]#0 : i32, !fir.ref<i32>
!CHECK: omp.yield
!CHECK: omp.terminator
!CHECK: omp.terminator

subroutine reduction_ieor(y)
integer :: x, y(:)
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-ior-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
! CHECK: %[[VAL_20:.*]] = arith.ori %[[VAL_18]], %[[VAL_19]] : i32
! CHECK: hlfir.assign %[[VAL_20]] to %[[VAL_14]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator


Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-ior.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
! CHECK: %[[VAL_20:.*]] = arith.ori %[[VAL_18]], %[[VAL_19]] : i32
! CHECK: hlfir.assign %[[VAL_20]] to %[[VAL_14]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -109,7 +108,6 @@ end subroutine simple_reduction
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -190,7 +188,6 @@ subroutine simple_reduction_switch_order(y)
! CHECK: %[[VAL_56:.*]] = fir.convert %[[VAL_55]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_56]] to %[[VAL_29]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop-reduction-logical-and.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -101,7 +100,6 @@ end subroutine simple_reduction
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -182,7 +180,6 @@ subroutine simple_reduction_switch_order(y)
! CHECK: %[[VAL_56:.*]] = fir.convert %[[VAL_55]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_56]] to %[[VAL_29]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -108,7 +107,6 @@ subroutine simple_reduction(y)
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -189,7 +187,6 @@ subroutine simple_reduction_switch_order(y)
! CHECK: %[[VAL_56:.*]] = fir.convert %[[VAL_55]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_56]] to %[[VAL_29]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop-reduction-logical-eqv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -100,7 +99,6 @@ subroutine simple_reduction(y)
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -181,7 +179,6 @@ subroutine simple_reduction_switch_order(y)
! CHECK: %[[VAL_56:.*]] = fir.convert %[[VAL_55]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_56]] to %[[VAL_29]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -109,7 +108,6 @@ subroutine simple_reduction(y)
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -192,7 +190,6 @@ subroutine simple_reduction_switch_order(y)
! CHECK: %[[VAL_56:.*]] = fir.convert %[[VAL_55]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_56]] to %[[VAL_29]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return
! CHECK: }
Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop-reduction-logical-neqv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -101,7 +100,6 @@ subroutine simple_reduction(y)
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -184,7 +182,6 @@ subroutine simple_reduction_switch_order(y)
! CHECK: %[[VAL_56:.*]] = fir.convert %[[VAL_55]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_56]] to %[[VAL_29]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return
! CHECK: }
Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop-reduction-logical-or-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -107,7 +106,6 @@ subroutine simple_reduction(y)
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -188,7 +186,6 @@ subroutine simple_reduction_switch_order(y)
! CHECK: %[[VAL_56:.*]] = fir.convert %[[VAL_55]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_56]] to %[[VAL_29]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop-reduction-logical-or.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -100,7 +99,6 @@ subroutine simple_reduction(y)
! CHECK: %[[VAL_26:.*]] = fir.convert %[[VAL_25]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_26]] to %[[VAL_17]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -181,7 +179,6 @@ subroutine simple_reduction_switch_order(y)
! CHECK: %[[VAL_56:.*]] = fir.convert %[[VAL_55]] : (i1) -> !fir.logical<4>
! CHECK: hlfir.assign %[[VAL_56]] to %[[VAL_29]]#0 : !fir.logical<4>, !fir.ref<!fir.logical<4>>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop-reduction-max-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
! CHECK: %[[VAL_21:.*]] = arith.select %[[VAL_20]], %[[VAL_18]], %[[VAL_19]] : i32
! CHECK: hlfir.assign %[[VAL_21]] to %[[VAL_14]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator

! CHECK-LABEL: func.func @_QPreduction_max_real(
Expand Down Expand Up @@ -94,7 +93,6 @@
! CHECK: %[[VAL_21:.*]] = arith.select %[[VAL_20]], %[[VAL_18]], %[[VAL_19]] : f32
! CHECK: hlfir.assign %[[VAL_21]] to %[[VAL_14]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: omp.parallel {
! CHECK: %[[VAL_30:.*]] = fir.alloca i32 {bindc_name = "i", pinned, {{.*}}}
Expand All @@ -120,7 +118,6 @@
! CHECK: hlfir.assign %[[VAL_47]] to %[[VAL_37]]#0 : f32, !fir.ref<f32>
! CHECK: }
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator


Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop-reduction-max.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
! CHECK: %[[VAL_21:.*]] = arith.select %[[VAL_20]], %[[VAL_18]], %[[VAL_19]] : i32
! CHECK: hlfir.assign %[[VAL_21]] to %[[VAL_14]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator

! CHECK-LABEL: func.func @_QPreduction_max_real(
Expand Down Expand Up @@ -84,7 +83,6 @@
! CHECK: %[[VAL_21:.*]] = arith.select %[[VAL_20]], %[[VAL_18]], %[[VAL_19]] : f32
! CHECK: hlfir.assign %[[VAL_21]] to %[[VAL_14]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: omp.parallel {
! CHECK: %[[VAL_30:.*]] = fir.alloca i32 {bindc_name = "i", pinned, {{.*}}}
Expand All @@ -110,7 +108,6 @@
! CHECK: hlfir.assign %[[VAL_47]] to %[[VAL_37]]#0 : f32, !fir.ref<f32>
! CHECK: }
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator


Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop-reduction-min-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
! CHECK: %[[VAL_21:.*]] = arith.select %[[VAL_20]], %[[VAL_18]], %[[VAL_19]] : i32
! CHECK: hlfir.assign %[[VAL_21]] to %[[VAL_14]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator

! CHECK-LABEL: func.func @_QPreduction_min_real(
Expand Down Expand Up @@ -95,7 +94,6 @@
! CHECK: hlfir.assign %[[VAL_21]] to %[[VAL_14]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.parallel {
Expand All @@ -122,7 +120,6 @@
! CHECK: hlfir.assign %[[VAL_47]] to %[[VAL_37]]#0 : f32, !fir.ref<f32>
! CHECK: }
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator


Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop-reduction-min.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
! CHECK: %[[VAL_21:.*]] = arith.select %[[VAL_20]], %[[VAL_18]], %[[VAL_19]] : i32
! CHECK: hlfir.assign %[[VAL_21]] to %[[VAL_14]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator

! CHECK-LABEL: func.func @_QPreduction_min_real(
Expand Down Expand Up @@ -85,7 +84,6 @@
! CHECK: hlfir.assign %[[VAL_21]] to %[[VAL_14]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.parallel {
Expand All @@ -112,7 +110,6 @@
! CHECK: hlfir.assign %[[VAL_47]] to %[[VAL_37]]#0 : f32, !fir.ref<f32>
! CHECK: }
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator


Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-min2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ program reduce
! CHECK: hlfir.assign %[[VAL_12]] to %[[VAL_11]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: }
7 changes: 0 additions & 7 deletions flang/test/Lower/OpenMP/wsloop-reduction-mul-byref.f90
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
! CHECK: %[[VAL_15:.*]] = arith.muli %[[VAL_13]], %[[VAL_14]] : i32
! CHECK: hlfir.assign %[[VAL_15]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -141,7 +140,6 @@ subroutine simple_int_reduction
! CHECK: %[[VAL_16:.*]] = arith.mulf %[[VAL_13]], %[[VAL_15]] fastmath<contract> : f32
! CHECK: hlfir.assign %[[VAL_16]] to %[[VAL_12]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -179,7 +177,6 @@ subroutine simple_real_reduction
! CHECK: %[[VAL_15:.*]] = arith.muli %[[VAL_13]], %[[VAL_14]] : i32
! CHECK: hlfir.assign %[[VAL_15]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -218,7 +215,6 @@ subroutine simple_int_reduction_switch_order
! CHECK: %[[VAL_16:.*]] = arith.mulf %[[VAL_14]], %[[VAL_15]] fastmath<contract> : f32
! CHECK: hlfir.assign %[[VAL_16]] to %[[VAL_12]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -274,7 +270,6 @@ subroutine simple_real_reduction_switch_order
! CHECK: %[[VAL_31:.*]] = arith.muli %[[VAL_29]], %[[VAL_30]] : i32
! CHECK: hlfir.assign %[[VAL_31]] to %[[VAL_22]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -337,7 +332,6 @@ subroutine multiple_int_reductions_same_type
! CHECK: %[[VAL_34:.*]] = arith.mulf %[[VAL_31]], %[[VAL_33]] fastmath<contract> : f32
! CHECK: hlfir.assign %[[VAL_34]] to %[[VAL_22]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -409,7 +403,6 @@ subroutine multiple_real_reductions_same_type
! CHECK: %[[VAL_42:.*]] = arith.mulf %[[VAL_39]], %[[VAL_41]] fastmath<contract> : f64
! CHECK: hlfir.assign %[[VAL_42]] to %[[VAL_27]]#0 : f64, !fir.ref<f64>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down
7 changes: 0 additions & 7 deletions flang/test/Lower/OpenMP/wsloop-reduction-mul.f90
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
! CHECK: %[[VAL_15:.*]] = arith.muli %[[VAL_13]], %[[VAL_14]] : i32
! CHECK: hlfir.assign %[[VAL_15]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -108,7 +107,6 @@ subroutine simple_int_reduction
! CHECK: %[[VAL_16:.*]] = arith.mulf %[[VAL_13]], %[[VAL_15]] fastmath<contract> : f32
! CHECK: hlfir.assign %[[VAL_16]] to %[[VAL_12]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -146,7 +144,6 @@ subroutine simple_real_reduction
! CHECK: %[[VAL_15:.*]] = arith.muli %[[VAL_13]], %[[VAL_14]] : i32
! CHECK: hlfir.assign %[[VAL_15]] to %[[VAL_12]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -185,7 +182,6 @@ subroutine simple_int_reduction_switch_order
! CHECK: %[[VAL_16:.*]] = arith.mulf %[[VAL_14]], %[[VAL_15]] fastmath<contract> : f32
! CHECK: hlfir.assign %[[VAL_16]] to %[[VAL_12]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -241,7 +237,6 @@ subroutine simple_real_reduction_switch_order
! CHECK: %[[VAL_31:.*]] = arith.muli %[[VAL_29]], %[[VAL_30]] : i32
! CHECK: hlfir.assign %[[VAL_31]] to %[[VAL_22]]#0 : i32, !fir.ref<i32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -304,7 +299,6 @@ subroutine multiple_int_reductions_same_type
! CHECK: %[[VAL_34:.*]] = arith.mulf %[[VAL_31]], %[[VAL_33]] fastmath<contract> : f32
! CHECK: hlfir.assign %[[VAL_34]] to %[[VAL_22]]#0 : f32, !fir.ref<f32>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down Expand Up @@ -376,7 +370,6 @@ subroutine multiple_real_reductions_same_type
! CHECK: %[[VAL_42:.*]] = arith.mulf %[[VAL_39]], %[[VAL_41]] fastmath<contract> : f64
! CHECK: hlfir.assign %[[VAL_42]] to %[[VAL_27]]#0 : f64, !fir.ref<f64>
! CHECK: omp.yield
! CHECK: omp.terminator
! CHECK: omp.terminator
! CHECK: return

Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-multi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
!CHECK: hlfir.assign %[[RES_Z]] to %[[PRV_Z_DECL]]#0 : i32, !fir.ref<i32>
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
!CHECK: return
subroutine multiple_reduction(v)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ program main
! CHECK: hlfir.assign %[[VAL_44]] to %[[VAL_48]] : f64, !fir.ref<f64>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-reduction-pointer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ program reduce_pointer
! CHECK: hlfir.assign %[[VAL_30]] to %[[VAL_32]] : i32, !fir.ptr<i32>
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-schedule.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ program wsloop_dynamic
end do
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
Expand Down
1 change: 0 additions & 1 deletion flang/test/Lower/OpenMP/wsloop-unstructured.f90
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ end subroutine sub
! CHECK: ^bb7:
! CHECK: omp.yield
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
! CHECK: omp.terminator
! CHECK: }
Expand Down
5 changes: 0 additions & 5 deletions flang/test/Lower/OpenMP/wsloop-variable.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ program wsloop_variable
!CHECK: hlfir.assign %[[TMP11]] to %{{.*}} : f32, !fir.ref<f32>
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }

!$omp do collapse(2)
Expand All @@ -58,7 +57,6 @@ program wsloop_variable
!CHECK: hlfir.assign %[[TMP16]] to %{{.*}} : f32, !fir.ref<f32>
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }

!$omp do
Expand All @@ -79,7 +77,6 @@ program wsloop_variable
!CHECK: hlfir.assign %[[TMP21]] to %{{.*}} : f32, !fir.ref<f32>
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }

!$omp do
Expand Down Expand Up @@ -162,7 +159,6 @@ subroutine wsloop_variable_sub
!CHECK: fir.store %[[VAL_48:.*]]#1 to %[[VAL_17]]#1 : !fir.ref<i64>
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }

!$omp do
Expand Down Expand Up @@ -193,7 +189,6 @@ subroutine wsloop_variable_sub
!CHECK: }
!CHECK: omp.yield
!CHECK: }
!CHECK: omp.terminator
!CHECK: }
j1 = 5
!$omp do
Expand Down
3 changes: 0 additions & 3 deletions flang/test/Lower/OpenMP/wsloop.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ subroutine simple_loop
print*, i
end do
! CHECK: omp.yield
! CHECK: omp.terminator
!$OMP END DO
! CHECK: omp.terminator
!$OMP END PARALLEL
Expand All @@ -48,7 +47,6 @@ subroutine simple_loop_with_step
print*, i
end do
! CHECK: omp.yield
! CHECK: omp.terminator
!$OMP END DO
! CHECK: omp.terminator
!$OMP END PARALLEL
Expand All @@ -74,7 +72,6 @@ subroutine loop_with_schedule_nowait
print*, i
end do
! CHECK: omp.yield
! CHECK: omp.terminator
!$OMP END DO NOWAIT
! CHECK: omp.terminator
!$OMP END PARALLEL
Expand Down
Loading