Skip to content

Commit e65d689

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:d8b8aa3a5661 into amd-gfx:064a5f8331d7
Local branch amd-gfx 064a5f8 Merged main:934efd2c9b94 into amd-gfx:848775231186 Remote branch main d8b8aa3 [llvm] Replace calls to Type::getPointerTo (NFC)
2 parents 064a5f8 + d8b8aa3 commit e65d689

File tree

210 files changed

+14077
-30834
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+14077
-30834
lines changed

clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.cpp

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,42 @@ AST_MATCHER_P(Stmt, forEachPrevStmt, ast_matchers::internal::Matcher<Stmt>,
5252
}
5353
return IsHostile;
5454
}
55+
56+
// Matches the expression awaited by the `co_await`.
57+
AST_MATCHER_P(CoawaitExpr, awaitable, ast_matchers::internal::Matcher<Expr>,
58+
InnerMatcher) {
59+
if (Expr *E = Node.getCommonExpr())
60+
return InnerMatcher.matches(*E, Finder, Builder);
61+
return false;
62+
}
63+
64+
auto typeWithNameIn(const std::vector<StringRef> &Names) {
65+
return hasType(
66+
hasCanonicalType(hasDeclaration(namedDecl(hasAnyName(Names)))));
67+
}
5568
} // namespace
5669

5770
CoroutineHostileRAIICheck::CoroutineHostileRAIICheck(StringRef Name,
5871
ClangTidyContext *Context)
5972
: ClangTidyCheck(Name, Context),
6073
RAIITypesList(utils::options::parseStringList(
61-
Options.get("RAIITypesList", "std::lock_guard;std::scoped_lock"))) {}
74+
Options.get("RAIITypesList", "std::lock_guard;std::scoped_lock"))),
75+
AllowedAwaitablesList(utils::options::parseStringList(
76+
Options.get("AllowedAwaitablesList", ""))) {}
6277

6378
void CoroutineHostileRAIICheck::registerMatchers(MatchFinder *Finder) {
6479
// A suspension happens with co_await or co_yield.
6580
auto ScopedLockable = varDecl(hasType(hasCanonicalType(hasDeclaration(
6681
hasAttr(attr::Kind::ScopedLockable)))))
6782
.bind("scoped-lockable");
68-
auto OtherRAII = varDecl(hasType(hasCanonicalType(hasDeclaration(
69-
namedDecl(hasAnyName(RAIITypesList))))))
70-
.bind("raii");
71-
Finder->addMatcher(expr(anyOf(coawaitExpr(), coyieldExpr()),
72-
forEachPrevStmt(declStmt(forEach(
73-
varDecl(anyOf(ScopedLockable, OtherRAII))))))
74-
.bind("suspension"),
75-
this);
83+
auto OtherRAII = varDecl(typeWithNameIn(RAIITypesList)).bind("raii");
84+
auto AllowedSuspend = awaitable(typeWithNameIn(AllowedAwaitablesList));
85+
Finder->addMatcher(
86+
expr(anyOf(coawaitExpr(unless(AllowedSuspend)), coyieldExpr()),
87+
forEachPrevStmt(
88+
declStmt(forEach(varDecl(anyOf(ScopedLockable, OtherRAII))))))
89+
.bind("suspension"),
90+
this);
7691
}
7792

7893
void CoroutineHostileRAIICheck::check(const MatchFinder::MatchResult &Result) {
@@ -94,5 +109,7 @@ void CoroutineHostileRAIICheck::storeOptions(
94109
ClangTidyOptions::OptionMap &Opts) {
95110
Options.store(Opts, "RAIITypesList",
96111
utils::options::serializeStringList(RAIITypesList));
112+
Options.store(Opts, "SafeAwaitableList",
113+
utils::options::serializeStringList(AllowedAwaitablesList));
97114
}
98115
} // namespace clang::tidy::misc

clang-tools-extra/clang-tidy/misc/CoroutineHostileRAIICheck.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class CoroutineHostileRAIICheck : public ClangTidyCheck {
4343
// List of fully qualified types which should not persist across a suspension
4444
// point in a coroutine.
4545
std::vector<StringRef> RAIITypesList;
46+
// List of fully qualified awaitable types which are considered safe to
47+
// co_await.
48+
std::vector<StringRef> AllowedAwaitablesList;
4649
};
4750

4851
} // namespace clang::tidy::misc

clang-tools-extra/docs/clang-tidy/checks/misc/coroutine-hostile-raii.rst

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,15 @@ Following types are considered as hostile:
2929
.. code-block:: c++
3030

3131
// Call some async API while holding a lock.
32-
{
33-
const my::MutexLock l(&mu_);
32+
task coro() {
33+
const std::lock_guard l(&mu_);
3434

3535
// Oops! The async Bar function may finish on a different
36-
// thread from the one that created the MutexLock object and therefore called
37-
// Mutex::Lock -- now Mutex::Unlock will be called on the wrong thread.
36+
// thread from the one that created the lock_guard (and called
37+
// Mutex::Lock). After suspension, Mutex::Unlock will be called on the wrong thread.
3838
co_await Bar();
3939
}
4040

41-
4241
Options
4342
-------
4443

@@ -48,3 +47,37 @@ Options
4847
persist across suspension points.
4948
Eg: ``my::lockable; a::b;::my::other::lockable;``
5049
The default value of this option is `"std::lock_guard;std::scoped_lock"`.
50+
51+
.. option:: AllowedAwaitablesList
52+
53+
A semicolon-separated list of qualified types of awaitables types which can
54+
be safely awaited while having hostile RAII objects in scope.
55+
56+
``co_await``-ing an expression of ``awaitable`` type is considered
57+
safe if the ``awaitable`` type is part of this list.
58+
RAII objects persisting across such a ``co_await`` expression are
59+
considered safe and hence are not flagged.
60+
61+
Example usage:
62+
63+
.. code-block:: c++
64+
65+
// Consider option AllowedAwaitablesList = "safe_awaitable"
66+
struct safe_awaitable {
67+
bool await_ready() noexcept { return false; }
68+
void await_suspend(std::coroutine_handle<>) noexcept {}
69+
void await_resume() noexcept {}
70+
};
71+
auto wait() { return safe_awaitable{}; }
72+
73+
task coro() {
74+
// This persists across both the co_await's but is not flagged
75+
// because the awaitable is considered safe to await on.
76+
const std::lock_guard l(&mu_);
77+
co_await safe_awaitable{};
78+
co_await wait();
79+
}
80+
81+
Eg: ``my::safe::awaitable;other::awaitable``
82+
The default value of this option is empty string `""`.
83+

clang-tools-extra/test/clang-tidy/checkers/misc/coroutine-hostile-raii.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// RUN: %check_clang_tidy -std=c++20 %s misc-coroutine-hostile-raii %t \
2-
// RUN: -config="{CheckOptions: \
3-
// RUN: {misc-coroutine-hostile-raii.RAIITypesList: \
4-
// RUN: 'my::Mutex; ::my::other::Mutex'}}"
2+
// RUN: -config="{CheckOptions: {\
3+
// RUN: misc-coroutine-hostile-raii.RAIITypesList: 'my::Mutex; ::my::other::Mutex', \
4+
// RUN: misc-coroutine-hostile-raii.AllowedAwaitablesList: 'safe::awaitable; ::my::other::awaitable' \
5+
// RUN: }}"
56

67
namespace std {
78

@@ -135,6 +136,20 @@ ReturnObject scopedLockableTest() {
135136
absl::Mutex no_warning_5;
136137
}
137138

139+
namespace safe {
140+
struct awaitable {
141+
bool await_ready() noexcept { return false; }
142+
void await_suspend(std::coroutine_handle<>) noexcept {}
143+
void await_resume() noexcept {}
144+
};
145+
} // namespace safe
146+
ReturnObject RAIISafeSuspendTest() {
147+
absl::Mutex a;
148+
co_await safe::awaitable{};
149+
using other = safe::awaitable;
150+
co_await other{};
151+
}
152+
138153
void lambda() {
139154
absl::Mutex no_warning;
140155
auto lambda = []() -> ReturnObject {

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,26 @@ void Flang::addCodegenOptions(const ArgList &Args,
142142
if (shouldLoopVersion(Args))
143143
CmdArgs.push_back("-fversion-loops-for-stride");
144144

145+
Arg *aliasAnalysis = Args.getLastArg(options::OPT_falias_analysis,
146+
options::OPT_fno_alias_analysis);
147+
// only pass on the argument if it does not match that implied by the
148+
// optimization level: so if optimization is requested, only forward
149+
// -fno-alias-analysis. If optimization is not requested, only forward
150+
// -falias-analysis.
151+
Arg *optLevel =
152+
Args.getLastArg(options::OPT_Ofast, options::OPT_O, options::OPT_O4);
153+
if (aliasAnalysis) {
154+
bool faliasAnalysis =
155+
aliasAnalysis->getOption().matches(options::OPT_falias_analysis);
156+
if (optLevel && !faliasAnalysis) {
157+
CmdArgs.push_back("-fno-alias-analysis");
158+
} else {
159+
if (faliasAnalysis)
160+
// requested alias analysis but no optimization enabled
161+
CmdArgs.push_back("-falias-analysis");
162+
}
163+
}
164+
145165
Args.addAllArgs(CmdArgs, {options::OPT_flang_experimental_hlfir,
146166
options::OPT_flang_deprecated_no_hlfir,
147167
options::OPT_flang_experimental_polymorphism,

clang/test/CodeGen/ms-inline-asm-64.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,22 @@ int t4(void) {
6060
}
6161

6262
void bar() {}
63+
static void (*fptr)();
6364

6465
void t5(void) {
6566
__asm {
6667
call bar
6768
jmp bar
69+
call fptr
70+
jmp fptr
6871
}
6972
// CHECK: t5
7073
// CHECK: call void asm sideeffect inteldialect
7174
// CHECK-SAME: call ${0:P}
7275
// CHECK-SAME: jmp ${1:P}
73-
// CHECK-SAME: "*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void (...)) @bar, ptr elementtype(void (...)) @bar)
76+
// CHECK-SAME: call $2
77+
// CHECK-SAME: jmp $3
78+
// CHECK-SAME: "*m,*m,*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void (...)) @bar, ptr elementtype(void (...)) @bar, ptr elementtype(ptr) @fptr, ptr elementtype(ptr) @fptr)
7479
}
7580

7681
void t47(void) {

flang/include/flang/Tools/CLOptions.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ inline void addDebugFoundationPass(mlir::PassManager &pm) {
158158
}
159159

160160
inline void addFIRToLLVMPass(
161-
mlir::PassManager &pm, llvm::OptimizationLevel optLevel = defaultOptLevel) {
161+
mlir::PassManager &pm, const MLIRToLLVMPassPipelineConfig &config) {
162162
fir::FIRToLLVMPassOptions options;
163163
options.ignoreMissingTypeDescriptors = ignoreMissingTypeDescriptors;
164-
options.applyTBAA = optLevel.isOptimizingForSpeed();
164+
options.applyTBAA = config.AliasAnalysis;
165165
options.forceUnifiedTBAATree = useOldAliasTags;
166166
addPassConditionally(pm, disableFirToLlvmIr,
167167
[&]() { return fir::createFIRToLLVMPass(options); });
@@ -311,7 +311,7 @@ inline void createDefaultFIRCodeGenPassPipeline(
311311
if (config.VScaleMin != 0)
312312
pm.addPass(fir::createVScaleAttrPass({config.VScaleMin, config.VScaleMax}));
313313

314-
fir::addFIRToLLVMPass(pm, config.OptLevel);
314+
fir::addFIRToLLVMPass(pm, config);
315315
}
316316

317317
/// Create a pass pipeline for lowering from MLIR to LLVM IR

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,12 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
242242
clang::driver::options::OPT_fno_loop_versioning, false))
243243
opts.LoopVersioning = 1;
244244

245-
opts.AliasAnalysis =
246-
args.hasFlag(clang::driver::options::OPT_falias_analysis,
247-
clang::driver::options::OPT_fno_alias_analysis,
248-
/*default=*/false);
245+
opts.AliasAnalysis = opts.OptimizationLevel > 0;
246+
if (auto *arg =
247+
args.getLastArg(clang::driver::options::OPT_falias_analysis,
248+
clang::driver::options::OPT_fno_alias_analysis))
249+
opts.AliasAnalysis =
250+
arg->getOption().matches(clang::driver::options::OPT_falias_analysis);
249251

250252
for (auto *a : args.filtered(clang::driver::options::OPT_fpass_plugin_EQ))
251253
opts.LLVMPassPlugins.push_back(a->getValue());

flang/lib/Semantics/resolve-names.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,20 @@ class OmpVisitor : public virtual DeclarationVisitor {
14591459
void Post(const parser::OmpEndSectionsDirective &) {
14601460
messageHandler().set_currStmtSource(std::nullopt);
14611461
}
1462+
bool Pre(const parser::OmpCriticalDirective &x) {
1463+
AddOmpSourceRange(x.source);
1464+
return true;
1465+
}
1466+
void Post(const parser::OmpCriticalDirective &) {
1467+
messageHandler().set_currStmtSource(std::nullopt);
1468+
}
1469+
bool Pre(const parser::OmpEndCriticalDirective &x) {
1470+
AddOmpSourceRange(x.source);
1471+
return true;
1472+
}
1473+
void Post(const parser::OmpEndCriticalDirective &) {
1474+
messageHandler().set_currStmtSource(std::nullopt);
1475+
}
14621476
};
14631477

14641478
bool OmpVisitor::NeedsScope(const parser::OpenMPBlockConstruct &x) {

flang/test/Driver/falias-analysis.f90

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,26 @@
22
! See flang/test/Fir/tbaa-codegen.fir for a test that the output is correct
33

44
! RUN: %flang -c -emit-llvm -falias-analysis %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-AA --check-prefix=CHECK-ALL
5-
! RUN: %flang -c -emit-llvm -falias-analysis -fno-alias-analysis %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-NOAA --check-prefix=CHECK-ALL
5+
! RUN: %flang -c -emit-llvm -Ofast %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-AA --check-prefix=CHECK-ALL
6+
! RUN: %flang -c -emit-llvm -O3 %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-AA --check-prefix=CHECK-ALL
7+
! RUN: %flang -c -emit-llvm -O2 %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-AA --check-prefix=CHECK-ALL
8+
! RUN: %flang -c -emit-llvm -O1 %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-AA --check-prefix=CHECK-ALL
9+
10+
! RUN: %flang -c -emit-llvm -O0 %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-NOAA --check-prefix=CHECK-ALL
11+
! RUN: %flang -c -emit-llvm -Ofast -fno-alias-analysis %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-NOAA --check-prefix=CHECK-ALL
12+
! RUN: %flang -c -emit-llvm -fno-alias-analysis -Ofast %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-NOAA --check-prefix=CHECK-ALL
613
! RUN: %flang -c -emit-llvm %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-NOAA --check-prefix=CHECK-ALL
14+
! RUN: %flang -c -emit-llvm -falias-analysis -fno-alias-analysis %s -o - | llvm-dis | FileCheck %s --check-prefix=CHECK-NOAA --check-prefix=CHECK-ALL
715

816
! RUN: %flang -fc1 -emit-llvm -falias-analysis %s -o - | FileCheck %s --check-prefix=CHECK-AA --check-prefix=CHECK-ALL
17+
! RUN: %flang -fc1 -emit-llvm -O3 %s -o - | FileCheck %s --check-prefix=CHECK-AA --check-prefix=CHECK-ALL
18+
! RUN: %flang -fc1 -emit-llvm -O2 %s -o - | FileCheck %s --check-prefix=CHECK-AA --check-prefix=CHECK-ALL
19+
! RUN: %flang -fc1 -emit-llvm -O1 %s -o - | FileCheck %s --check-prefix=CHECK-AA --check-prefix=CHECK-ALL
20+
21+
! RUN: %flang -fc1 -emit-llvm -O0 %s -o - | FileCheck %s --check-prefix=CHECK-NOAA --check-prefix=CHECK-ALL
922
! RUN: %flang -fc1 -emit-llvm -falias-analysis -fno-alias-analysis %s -o - | FileCheck %s --check-prefix=CHECK-NOAA --check-prefix=CHECK-ALL
1023
! RUN: %flang -fc1 -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-NOAA --check-prefix=CHECK-ALL
24+
! RUN: %flang -fc1 -emit-llvm -O3 -fno-alias-analysis %s -o - | FileCheck %s --check-prefix=CHECK-NOAA --check-prefix=CHECK-ALL
1125

1226
subroutine simple(a)
1327
integer, intent(inout) :: a(:)

flang/test/Driver/mlir-pass-pipeline.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151

5252
! ALL-NEXT: 'func.func' Pipeline
5353
! ALL-NEXT: PolymorphicOpConversion
54+
! O2-NEXT: AddAliasTags
55+
! O2-NEXT: 'func.func' Pipeline
5456
! ALL-NEXT: CFGConversion
5557

5658
! ALL-NEXT: SCFToControlFlow

flang/test/Driver/optimization-remark.f90

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,24 @@
4141
! Once we start filtering, this is reduced to 1 one of the loop passes.
4242

4343
! PASS-REGEX-LOOP-ONLY-NOT: optimization-remark.f90:77:7: remark: hoisting load [-Rpass=licm]
44-
! PASS-REGEX-LOOP-ONLY: optimization-remark.f90:83:5: remark: Loop deleted because it is invariant [-Rpass=loop-delete]
44+
! PASS-REGEX-LOOP-ONLY: optimization-remark.f90:79:5: remark: Loop deleted because it is invariant [-Rpass=loop-delete]
4545

4646
! MISSED-REGEX-LOOP-ONLY-NOT: optimization-remark.f90:77:7: remark: failed to hoist load with loop-invariant address because load is conditionally executed [-Rpass-missed=licm]
47-
! MISSED-REGEX-LOOP-ONLY: optimization-remark.f90:76:4: remark: loop not vectorized [-Rpass-missed=loop-vectorize]
47+
! MISSED-REGEX-LOOP-ONLY: optimization-remark.f90:72:4: remark: loop not vectorized [-Rpass-missed=loop-vectorize]
4848

4949

50-
! ANALYSIS-REGEX-LOOP-ONLY: optimization-remark.f90:79:7: remark: loop not vectorized: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
51-
! ANALYSIS-REGEX-LOOP-ONLY: Unknown data dependence. Memory location is the same as accessed at optimization-remark.f90:78:7 [-Rpass-analysis=loop-vectorize]
50+
! ANALYSIS-REGEX-LOOP-ONLY: optimization-remark.f90:73:7: remark: loop not vectorized: cannot identify array bounds [-Rpass-analysis=loop-vectorize]
5251
! ANALYSIS-REGEX-LOOP-ONLY-NOT: remark: {{.*}}: IR instruction count changed from {{[0-9]+}} to {{[0-9]+}}; Delta: {{-?[0-9]+}} [-Rpass-analysis=size-info]
5352

54-
! PASS: optimization-remark.f90:77:7: remark: hoisting load [-Rpass=licm]
55-
! PASS: optimization-remark.f90:83:5: remark: Loop deleted because it is invariant [-Rpass=loop-delete]
53+
! PASS: optimization-remark.f90:79:5: remark: Loop deleted because it is invariant [-Rpass=loop-delete]
5654

57-
! MISSED: optimization-remark.f90:77:7: remark: failed to hoist load with loop-invariant address because load is conditionally executed [-Rpass-missed=licm]
58-
! MISSED: optimization-remark.f90:76:4: remark: loop not vectorized [-Rpass-missed=loop-vectorize]
59-
! MISSED-NOT: optimization-remark.f90:79:7: remark: loop not vectorized: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
55+
! MISSED: optimization-remark.f90:73:7: remark: failed to move load with loop-invariant address because the loop may invalidate its value [-Rpass-missed=licm]
56+
! MISSED: optimization-remark.f90:72:4: remark: loop not vectorized [-Rpass-missed=loop-vectorize]
57+
! MISSED-NOT: optimization-remark.f90:75:7: remark: loop not vectorized: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
6058
! MISSED-NOT: Unknown data dependence. Memory location is the same as accessed at optimization-remark.f90:78:7 [-Rpass-analysis=loop-vectorize]
6159

62-
! ANALYSIS: optimization-remark.f90:79:7: remark: loop not vectorized: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
63-
! ANALYSIS: Unknown data dependence. Memory location is the same as accessed at optimization-remark.f90:78:7 [-Rpass-analysis=loop-vectorize]
64-
! ANALYSIS: remark: {{.*}}: IR instruction count changed from {{[0-9]+}} to {{[0-9]+}}; Delta: {{-?[0-9]+}} [-Rpass-analysis=size-info]
65-
! ANALYSIS-NOT: optimization-remark.f90:77:7: remark: failed to hoist load with loop-invariant address because load is conditionally executed [-Rpass-missed=licm]
60+
! ANALYSIS: optimization-remark.f90:74:7: remark: loop not vectorized: unsafe dependent memory operations in loop.
61+
! ANALYSIS: remark: {{.*}} instructions in function [-Rpass-analysis=asm-printer]
6662

6763
subroutine swap_real(a1, a2)
6864
implicit none

flang/test/Fir/basic-program.fir

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ func.func @_QQmain() {
5757

5858
// PASSES-NEXT: 'func.func' Pipeline
5959
// PASSES-NEXT: PolymorphicOpConversion
60+
61+
// PASSES-NEXT: AddAliasTags
62+
63+
// PASSES-NEXT: 'func.func' Pipeline
6064
// PASSES-NEXT: CFGConversion
6165

6266
// PASSES-NEXT: SCFToControlFlow
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2+
! Test that there are no errors for an empty critical construct
3+
4+
!$omp critical
5+
!$omp end critical
6+
end

flang/tools/tco/tco.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ compileFIR(const mlir::PassPipelineCLParser &passPipeline) {
120120
return mlir::failure();
121121
} else {
122122
MLIRToLLVMPassPipelineConfig config(llvm::OptimizationLevel::O2);
123+
config.AliasAnalysis = true; // enabled when optimizing for speed
123124
if (codeGenLLVM) {
124125
// Run only CodeGen passes.
125126
fir::createDefaultFIRCodeGenPassPipeline(pm, config);

0 commit comments

Comments
 (0)