Skip to content

Commit 645f6c3

Browse files
committed
[flang] Disable noalias captures(none) by default
This is due to a 70% regression in exchange2_r on neoverse-v2 due to function specialization no longer triggering in the LTO pipline.
1 parent c46927f commit 645f6c3

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

flang/lib/Optimizer/Passes/Pipelines.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
/// common to flang and the test tools.
1111

1212
#include "flang/Optimizer/Passes/Pipelines.h"
13+
#include "llvm/Support/CommandLine.h"
14+
15+
/// Force setting the no-alias attribute on fuction arguments when possible.
16+
static llvm::cl::opt<bool> forceNoAlias("force-no-alias", llvm::cl::Hidden,
17+
llvm::cl::init(false));
18+
/// Force setting the no-capture attribute on fuction arguments when possible.
19+
static llvm::cl::opt<bool> forceNoCapture("force-no-capture", llvm::cl::Hidden,
20+
llvm::cl::init(false));
1321

1422
namespace fir {
1523

@@ -350,9 +358,10 @@ void createDefaultFIRCodeGenPassPipeline(mlir::PassManager &pm,
350358
else
351359
framePointerKind = mlir::LLVM::framePointerKind::FramePointerKind::None;
352360

353-
bool setNoCapture = false, setNoAlias = false;
354-
if (config.OptLevel.isOptimizingForSpeed())
355-
setNoCapture = setNoAlias = true;
361+
// TODO: re-enable setNoAlias by default (when optimizing for speed) once
362+
// function specialization is fixed.
363+
bool setNoAlias = forceNoAlias;
364+
bool setNoCapture = forceNoCapture;
356365

357366
pm.addPass(fir::createFunctionAttr(
358367
{framePointerKind, config.InstrumentFunctionEntry,

flang/test/Fir/polymorphic.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: tco %s | FileCheck %s
1+
// RUN: tco --force-no-capture %s | FileCheck %s
22

33
// Test code gen for unlimited polymorphic type descriptor.
44

flang/test/Fir/struct-passing-x86-64-byval.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Test X86-64 ABI rewrite of struct passed by value (BIND(C), VALUE derived types).
22
// This test test cases where the struct must be passed on the stack according
33
// to the System V ABI.
4-
// RUN: tco --target=x86_64-unknown-linux-gnu %s | FileCheck %s
4+
// RUN: tco --target=x86_64-unknown-linux-gnu --force-no-capture --force-no-alias %s | FileCheck %s
55

66
module attributes {fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", llvm.target_triple = "x86_64-unknown-linux-gnu"} {
77

flang/test/Fir/target-rewrite-complex-10-x86.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Test COMPLEX(10) passing and returning on X86
22
// RUN: fir-opt --target-rewrite="target=x86_64-unknown-linux-gnu" %s | FileCheck %s --check-prefix=AMD64
3-
// RUN: tco -target="x86_64-unknown-linux-gnu" %s | FileCheck %s --check-prefix=AMD64_LLVM
3+
// RUN: tco -target="x86_64-unknown-linux-gnu" --force-no-alias --force-no-capture %s | FileCheck %s --check-prefix=AMD64_LLVM
44

55
module attributes {fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", llvm.target_triple = "x86_64-unknown-linux-gnu"} {
66

flang/test/Fir/target.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: tco --target=i386-unknown-linux-gnu %s | FileCheck %s --check-prefix=I32
1+
// RUN: tco --target=i386-unknown-linux-gnu --force-no-alias --force-no-capture %s | FileCheck %s --check-prefix=I32
22
// RUN: tco --target=x86_64-unknown-linux-gnu %s | FileCheck %s --check-prefix=X64
33
// RUN: tco --target=aarch64-unknown-linux-gnu %s | FileCheck %s --check-prefix=AARCH64
44
// RUN: tco --target=powerpc64le-unknown-linux-gnu %s | FileCheck %s --check-prefix=PPC

0 commit comments

Comments
 (0)