Skip to content

Commit 8290440

Browse files
committed
Map -O to -O1 instead of -O2
rL82131 changed -O from -O1 to -O2, because -O1 was not different from -O2 at that time. GCC treats -O as -O1 and there is now work to make -O1 meaningful. We can change -O back to -O1 again. Reviewed By: echristo, dexonsmith, arphaman Differential Revision: https://reviews.llvm.org/D79916
1 parent 682e739 commit 8290440

12 files changed

+22
-22
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def ObjCXX : Flag<["-"], "ObjC++">, Flags<[DriverOption]>,
400400
def ObjC : Flag<["-"], "ObjC">, Flags<[DriverOption]>,
401401
HelpText<"Treat source input files as Objective-C inputs">;
402402
def O : Joined<["-"], "O">, Group<O_Group>, Flags<[CC1Option]>;
403-
def O_flag : Flag<["-"], "O">, Flags<[CC1Option]>, Alias<O>, AliasArgs<["2"]>;
403+
def O_flag : Flag<["-"], "O">, Flags<[CC1Option]>, Alias<O>, AliasArgs<["1"]>;
404404
def Ofast : Joined<["-"], "Ofast">, Group<O_Group>, Flags<[CC1Option]>;
405405
def P : Flag<["-"], "P">, Flags<[CC1Option]>, Group<Preprocessor_Group>,
406406
HelpText<"Disable linemarker output in -E mode">;

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
137137
assert(A->getOption().matches(options::OPT_O));
138138

139139
StringRef S(A->getValue());
140-
if (S == "s" || S == "z" || S.empty())
140+
if (S == "s" || S == "z")
141141
return llvm::CodeGenOpt::Default;
142142

143143
if (S == "g")

clang/test/CodeGen/builtins-systemz-zvector-constrained.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// REQUIRES: systemz-registered-target
22
// RUN: %clang_cc1 -target-cpu z13 -triple s390x-linux-gnu \
3-
// RUN: -O -fzvector -flax-vector-conversions=none \
3+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
44
// RUN: -ffp-exception-behavior=strict \
55
// RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
66
// RUN: %clang_cc1 -target-cpu z13 -triple s390x-linux-gnu \
7-
// RUN: -O -fzvector -flax-vector-conversions=none \
7+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
88
// RUN: -ffp-exception-behavior=strict \
99
// RUN: -Wall -Wno-unused -Werror -S %s -o - | FileCheck %s --check-prefix=CHECK-ASM
1010

clang/test/CodeGen/builtins-systemz-zvector.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// REQUIRES: systemz-registered-target
22
// RUN: %clang_cc1 -target-cpu z13 -triple s390x-linux-gnu \
3-
// RUN: -O -fzvector -flax-vector-conversions=none \
3+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
44
// RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
55
// RUN: %clang_cc1 -target-cpu z13 -triple s390x-linux-gnu \
6-
// RUN: -O -fzvector -flax-vector-conversions=none \
6+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
77
// RUN: -Wall -Wno-unused -Werror -S %s -o - | FileCheck %s --check-prefix=CHECK-ASM
88

99
#include <vecintrin.h>

clang/test/CodeGen/builtins-systemz-zvector2-constrained.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// REQUIRES: systemz-registered-target
22
// RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \
3-
// RUN: -O -fzvector -flax-vector-conversions=none \
3+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
44
// RUN: -ffp-exception-behavior=strict \
55
// RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
66
// RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \
7-
// RUN: -O -fzvector -flax-vector-conversions=none \
7+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
88
// RUN: -ffp-exception-behavior=strict \
99
// RUN: -Wall -Wno-unused -Werror -S %s -o - | FileCheck %s --check-prefix=CHECK-ASM
1010

clang/test/CodeGen/builtins-systemz-zvector2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// REQUIRES: systemz-registered-target
22
// RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \
3-
// RUN: -O -fzvector -flax-vector-conversions=none \
3+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
44
// RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
55
// RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \
6-
// RUN: -O -fzvector -flax-vector-conversions=none \
6+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
77
// RUN: -Wall -Wno-unused -Werror -S %s -o - | FileCheck %s --check-prefix=CHECK-ASM
88

99
#include <vecintrin.h>

clang/test/CodeGen/builtins-systemz-zvector3-constrained.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// REQUIRES: systemz-registered-target
22
// RUN: %clang_cc1 -target-cpu z15 -triple s390x-linux-gnu \
3-
// RUN: -O -fzvector -flax-vector-conversions=none \
3+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
44
// RUN: -ffp-exception-behavior=strict \
55
// RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
66
// RUN: %clang_cc1 -target-cpu z15 -triple s390x-linux-gnu \
7-
// RUN: -O -fzvector -flax-vector-conversions=none \
7+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
88
// RUN: -ffp-exception-behavior=strict \
99
// RUN: -Wall -Wno-unused -Werror -S %s -o - | FileCheck %s --check-prefix=CHECK-ASM
1010

clang/test/CodeGen/builtins-systemz-zvector3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// REQUIRES: systemz-registered-target
22
// RUN: %clang_cc1 -target-cpu z15 -triple s390x-linux-gnu \
3-
// RUN: -O -fzvector -flax-vector-conversions=none \
3+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
44
// RUN: -Wall -Wno-unused -Werror -emit-llvm %s -o - | FileCheck %s
55
// RUN: %clang_cc1 -target-cpu z15 -triple s390x-linux-gnu \
6-
// RUN: -O -fzvector -flax-vector-conversions=none \
6+
// RUN: -O2 -fzvector -flax-vector-conversions=none \
77
// RUN: -Wall -Wno-unused -Werror -S %s -o - | FileCheck %s --check-prefix=CHECK-ASM
88

99
#include <vecintrin.h>

clang/test/CodeGen/fma-builtins-constrained.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: x86-registered-target
2-
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O -emit-llvm -o - | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=UNCONSTRAINED %s
3-
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -ffp-exception-behavior=strict -O -emit-llvm -o - | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED %s
4-
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O -S -o - | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM --check-prefix=CHECK-ASM-UNCONSTRAINED %s
5-
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O -ffp-exception-behavior=strict -S -o - | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM --check-prefix=CHECK-ASM-CONSTRAINED %s
2+
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -emit-llvm -o - | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=UNCONSTRAINED %s
3+
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -ffp-exception-behavior=strict -O2 -emit-llvm -o - | FileCheck --check-prefix=COMMON --check-prefix=COMMONIR --check-prefix=CONSTRAINED %s
4+
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -S -o - | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM --check-prefix=CHECK-ASM-UNCONSTRAINED %s
5+
// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-unknown-linux-gnu -target-feature +fma -O2 -ffp-exception-behavior=strict -S -o - | FileCheck --check-prefix=COMMON --check-prefix=CHECK-ASM --check-prefix=CHECK-ASM-CONSTRAINED %s
66

77
#include <immintrin.h>
88

clang/test/Driver/O.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Test that we parse and translate the -O option correctly.
22

33
// RUN: %clang -O -### %s 2>&1 | FileCheck -check-prefix=CHECK-O %s
4-
// CHECK-O: -O2
4+
// CHECK-O: -O1
55

66
// RUN: %clang -O0 -### %s 2>&1 | FileCheck -check-prefix=CHECK-O0 %s
77
// CHECK-O0: -O0

clang/test/Driver/clang_f_opts.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
// RUN: %clang -### -S -fno-tree-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
136136
// RUN: %clang -### -S -fno-tree-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
137137
// RUN: %clang -### -S -ftree-vectorize -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
138-
// RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
138+
// RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
139139
// RUN: %clang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
140140
// RUN: %clang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
141141
// RUN: %clang -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
@@ -157,7 +157,7 @@
157157
// RUN: %clang -### -S -fno-tree-slp-vectorize -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
158158
// RUN: %clang -### -S -fno-tree-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
159159
// RUN: %clang -### -S -ftree-slp-vectorize -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
160-
// RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
160+
// RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s
161161
// RUN: %clang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
162162
// RUN: %clang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
163163
// RUN: %clang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s

clang/test/Driver/lto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
// NO-LLVMGOLD-NOT: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
5050

5151
// RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \
52-
// RUN: -fuse-ld=lld -flto -O -### 2>&1 | FileCheck --check-prefix=O2 %s
52+
// RUN: -fuse-ld=lld -flto -O -### 2>&1 | FileCheck --check-prefix=O1 %s
5353
// RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \
5454
// RUN: -fuse-ld=lld -flto -O1 -### 2>&1 | FileCheck --check-prefix=O1 %s
5555
// RUN: %clang -target x86_64-unknown-linux-gnu --sysroot %S/Inputs/basic_cross_linux_tree %s \

0 commit comments

Comments
 (0)