From 5ece83588dd1475538ee5e8655d0336c37103789 Mon Sep 17 00:00:00 2001 From: lzy Date: Fri, 8 Nov 2024 17:40:41 +0800 Subject: [PATCH] Handle GNU options -ftree-loop-if-convert --- clang/include/clang/Driver/Options.td | 15 +++++++++++++++ clang/test/Driver/clang_f_opts.c | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 296f9d47636a..93527f464ace 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5178,6 +5178,11 @@ multiclass BooleanFFlag { def fno_#NAME : Flag<["-"], "fno-"#name>; } +multiclass BooleanICompatibilityFlag { + def NAME : Flag<["-"], name>; + def no_#NAME : Flag<["-"], "no-"#name>; +} + multiclass FlangIgnoredDiagOpt { def unsupported_warning_w#NAME : Flag<["-", "--"], "W"#name>, Group; } @@ -7685,6 +7690,16 @@ def Mqq_EQ : Joined<["-"], "Mqq,">, Group; def Hqq_EQ : Joined<["-"], "Hqq,">, Group; def Wh_EQ : Joined<["-"], "Wh,">, Group; #endif + +#ifdef BUILD_FOR_OPENEULER +// Ignored GNU optimization +// Handle all -ftree-/-fno-tree- options since it's only for GNU +def ftree_all_option : Joined<["-"], "ftree">, + Group; +def fno_tree_all_option : Joined<["-"], "fno-tree">, + Group; +#endif + def hlsl_entrypoint : Option<["-"], "hlsl-entry", KIND_SEPARATE>, Group, Flags<[CC1Option]>, diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c index 3cda11ef476d..2fdb661ac724 100644 --- a/clang/test/Driver/clang_f_opts.c +++ b/clang/test/Driver/clang_f_opts.c @@ -610,3 +610,10 @@ // CHECK-INT-OBJEMITTER-NOT: unsupported option '-fintegrated-objemitter' for target // RUN: %clang -### -fno-integrated-objemitter -target x86_64 %s 2>&1 | FileCheck -check-prefix=CHECK-NOINT-OBJEMITTER %s // CHECK-NOINT-OBJEMITTER: unsupported option '-fno-integrated-objemitter' for target + +#ifdef BUILD_FOR_OPENEULER +// RUN: %clang -### +// RUN: -ftree-loop-if-convert +// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK-WARNING %s +// CHECK-WARNING-DAG: GNU optimization flag '-ftree-loop-if-convert' is not supported and ignored. +#endif -- Gitee