[PATCH] D157331: [clang] Implement C23

2023-09-19 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

@aaron.ballman do you have additional comments or does this patch looks good to 
merge?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157331/new/

https://reviews.llvm.org/D157331

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D158476: [driver] Search for compatible Android runtime directories

2023-09-18 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama accepted this revision.
pirama added a comment.

LGTM from the Android platform/NDK side.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158476/new/

https://reviews.llvm.org/D158476

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D157331: [clang] Implement C23

2023-09-11 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:8618-8619
+  "operand argument to %select{overflow builtin|checked integer operation}0 "
+  "must be an integer type %select{|other than plain 'char', 'bool', 
bit-precise, "
+  "or an enumeration }1 invalid">;
 def err_overflow_builtin_must_be_ptr_int : Error<

The warning selector is slightly different from the one for the result.



Comment at: clang/lib/Headers/stdckdint.h:12
+#define __STDCKDINT_H
+
+/* C23 7.20.1 Defines several macros for performing checked integer 
arithmetic*/

aaron.ballman wrote:
> Should a hosted build attempt to do an include_next into the system library 
> and then fall back to the compiler builtins, or should we treat this like 
> stdbool.h where the compiler always wins? CC @jyknight @jrtc27 @efriedma 
> 
> My intuition is that we want to include_next in case the system has better 
> facilities than the compiler does.
The `include_next` question is still open.  Any preference here?

IMO, since the standard explicitly delegates to the compiler builtin when 
available, we may not need to `include_next` - unless there are other 
conventions around this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157331/new/

https://reviews.llvm.org/D157331

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D132984: Set HOME for tests that use module cache path

2022-09-15 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7fe475756b26: Set HOME for tests that use module cache path 
(authored by ccross, committed by pirama).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132984/new/

https://reviews.llvm.org/D132984

Files:
  clang/test/Driver/modules-cache-path.m
  clang/test/Modules/driver.c
  clang/test/Unit/lit.cfg.py


Index: clang/test/Unit/lit.cfg.py
===
--- clang/test/Unit/lit.cfg.py
+++ clang/test/Unit/lit.cfg.py
@@ -30,6 +30,9 @@
 if 'TEMP' in os.environ:
 config.environment['TEMP'] = os.environ['TEMP']
 
+if 'HOME' in os.environ:
+config.environment['HOME'] = os.environ['HOME']
+
 # Propagate sanitizer options.
 for var in [
 'ASAN_SYMBOLIZER_PATH',
Index: clang/test/Modules/driver.c
===
--- clang/test/Modules/driver.c
+++ clang/test/Modules/driver.c
@@ -1,4 +1,4 @@
-// RUN: %clang -fmodules -fimplicit-module-maps %s -### 2>&1 | FileCheck 
-check-prefix CHECK-NO_MODULE_CACHE %s
+// RUN: env HOME=%t.home %clang -fmodules -fimplicit-module-maps %s -### 2>&1 
| FileCheck -check-prefix CHECK-NO_MODULE_CACHE %s
 // RUN: %clang -fmodules -fimplicit-module-maps -fmodules-cache-path=blarg %s 
-### 2>&1 | FileCheck -check-prefix CHECK-WITH_MODULE_CACHE %s
 
 // CHECK-NO_MODULE_CACHE: {{clang.*"-fmodules-cache-path=.*ModuleCache"}}
Index: clang/test/Driver/modules-cache-path.m
===
--- clang/test/Driver/modules-cache-path.m
+++ clang/test/Driver/modules-cache-path.m
@@ -1,4 +1,4 @@
-// RUN: %clang -fmodules -### %s 2>&1 | FileCheck %s 
-check-prefix=CHECK-DEFAULT
+// RUN: env HOME=%t.home %clang -fmodules -### %s 2>&1 | FileCheck %s 
-check-prefix=CHECK-DEFAULT
 // CHECK-DEFAULT: -fmodules-cache-path={{.*}}clang{{[/\\]+}}ModuleCache
 
 // RUN: env CLANG_MODULE_CACHE_PATH=/dev/null \


Index: clang/test/Unit/lit.cfg.py
===
--- clang/test/Unit/lit.cfg.py
+++ clang/test/Unit/lit.cfg.py
@@ -30,6 +30,9 @@
 if 'TEMP' in os.environ:
 config.environment['TEMP'] = os.environ['TEMP']
 
+if 'HOME' in os.environ:
+config.environment['HOME'] = os.environ['HOME']
+
 # Propagate sanitizer options.
 for var in [
 'ASAN_SYMBOLIZER_PATH',
Index: clang/test/Modules/driver.c
===
--- clang/test/Modules/driver.c
+++ clang/test/Modules/driver.c
@@ -1,4 +1,4 @@
-// RUN: %clang -fmodules -fimplicit-module-maps %s -### 2>&1 | FileCheck -check-prefix CHECK-NO_MODULE_CACHE %s
+// RUN: env HOME=%t.home %clang -fmodules -fimplicit-module-maps %s -### 2>&1 | FileCheck -check-prefix CHECK-NO_MODULE_CACHE %s
 // RUN: %clang -fmodules -fimplicit-module-maps -fmodules-cache-path=blarg %s -### 2>&1 | FileCheck -check-prefix CHECK-WITH_MODULE_CACHE %s
 
 // CHECK-NO_MODULE_CACHE: {{clang.*"-fmodules-cache-path=.*ModuleCache"}}
Index: clang/test/Driver/modules-cache-path.m
===
--- clang/test/Driver/modules-cache-path.m
+++ clang/test/Driver/modules-cache-path.m
@@ -1,4 +1,4 @@
-// RUN: %clang -fmodules -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-DEFAULT
+// RUN: env HOME=%t.home %clang -fmodules -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-DEFAULT
 // CHECK-DEFAULT: -fmodules-cache-path={{.*}}clang{{[/\\]+}}ModuleCache
 
 // RUN: env CLANG_MODULE_CACHE_PATH=/dev/null \
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D112349: [Verifier] Add verification logic for GlobalIFuncs

2022-02-17 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added subscribers: pirama, srhines, kongyi.
pirama added a comment.

Unrelated to missing resolver definition, this change doesn't accommodate 
resolvers that take parameters.  (Curiously, this verification only fails with 
ThinLTO).

  // with -flto=full or without -flto=thin, below command works
  $ clang -shared ifunc.cpp -fPIC -fuse-ld=lld -flto=thin
  IFunc resolver has incorrect type
  i32 ()* @_Z5ifuncv
  
  $ cat ifunc.cpp
  #include 
  
  typedef int (*fn_ptr_t)();
  
  int ifunc() __attribute__((ifunc("resolver")));
  
  int ret42() {
return 42;
  }
  
  extern "C" fn_ptr_t resolver(uint64_t hwcap) {
return ret42;
  }

I have a change that fixes the above use case but causes some opaque pointer 
tests to fail.  I'll investigate and upload once they're fixed.

I also noticed that this patch didn't add any test for the "IFunc resolver has 
incorrect type" errors cases.  It'd be good to add those in a follow-up.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112349/new/

https://reviews.llvm.org/D112349

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D116753: [Driver] Default to -fno-math-errno for musl too

2022-02-04 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

@alxu Just realized you don't have commit access.  Do you want one of us to 
merge this?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116753/new/

https://reviews.llvm.org/D116753

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D116755: Revert "[CodeGen] Mark fma as const for Android"

2022-01-10 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf5b387988bd4: Revert [CodeGen] Mark fma as const for 
Android (authored by alxu, committed by pirama).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116755/new/

https://reviews.llvm.org/D116755

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/test/CodeGen/math-builtins.c


Index: clang/test/CodeGen/math-builtins.c
===
--- clang/test/CodeGen/math-builtins.c
+++ clang/test/CodeGen/math-builtins.c
@@ -1,7 +1,6 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm
  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - 
-emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
@@ -345,10 +344,6 @@
 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) 
[[READNONE_INTRINSIC]]
 
-// HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) 
[[READNONE_INTRINSIC:#[0-9]+]]
-// HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
-// HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, 
x86_fp80) [[READNONE_INTRINSIC]]
-
 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) 
[[READNONE_INTRINSIC:#[0-9]+]]
 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
 // Long double is just double on win, so no f80 use/declaration.
@@ -696,6 +691,5 @@
 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
 
 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
-// HAS_ERRNO_ANDROID: attributes [[READNONE_INTRINSIC]] = { 
{{.*}}readnone{{.*}} }
 // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -15196,11 +15196,11 @@
 Context.BuiltinInfo.isConstWithoutErrno(BuiltinID))
   FD->addAttr(ConstAttr::CreateImplicit(Context, FD->getLocation()));
 
-// We make "fma" on some platforms const because we know it does not set
+// We make "fma" on GNU or Windows const because we know it does not set
 // errno in those environments even though it could set errno based on the
 // C standard.
 const llvm::Triple  = Context.getTargetInfo().getTriple();
-if ((Trip.isGNUEnvironment() || Trip.isAndroid() || Trip.isOSMSVCRT()) &&
+if ((Trip.isGNUEnvironment() || Trip.isOSMSVCRT()) &&
 !FD->hasAttr()) {
   switch (BuiltinID) {
   case Builtin::BI__builtin_fma:


Index: clang/test/CodeGen/math-builtins.c
===
--- clang/test/CodeGen/math-builtins.c
+++ clang/test/CodeGen/math-builtins.c
@@ -1,7 +1,6 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
@@ -345,10 +344,6 @@
 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
 
-// HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
-// HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
-// HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
-
 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) 

[PATCH] D116755: Revert "[CodeGen] Mark fma as const for Android"

2022-01-06 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama accepted this revision.
pirama added a subscriber: srhines.
pirama added a comment.
This revision is now accepted and ready to land.

Thanks for the cleanup here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116755/new/

https://reviews.llvm.org/D116755

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D113840: [Driver][Android] Remove unneeded isNoExecStackDefault

2021-11-16 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama edited reviewers, added: srhines; removed: pirama.
pirama added a comment.

Will defer to Dan's review.  I think these changes are safe for the Android 
platform (where we only use lld).  The NDK only supports lld but that does not 
preclude external users from using other linkers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113840/new/

https://reviews.llvm.org/D113840

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110379: [Driver] Remove confusing *-linux-android detection with non-android --target=

2021-09-23 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a reviewer: nickdesaulniers.
pirama added a subscriber: nickdesaulniers.
pirama added a comment.

@nickdesaulniers I presume this is still necessary?  See 
https://reviews.llvm.org/D53463 for why we added this.  (The Android kernel 
build does not use the Android triple.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110379/new/

https://reviews.llvm.org/D110379

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-11 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0fd0a010a1ed: [git-clang-format] Do not apply clang-format 
to symlinks (authored by pirama).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101878/new/

https://reviews.llvm.org/D101878

Files:
  clang/docs/ReleaseNotes.rst
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or 
symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -244,6 +244,9 @@
   accepts ``AllIfsAndElse`` value that allows to put "else if" and "else" short
   statements on a single line. (Fixes https://llvm.org/PR50019.)
 
+- ``git-clang-format`` no longer formats changes to symbolic links. (Fixes
+  https://llvm.org/PR46992.)
+
 libclang
 
 


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -244,6 +244,9 @@
   accepts ``AllIfsAndElse`` value that allows to put "else if" and "else" short
   statements on a single line. (Fixes https://llvm.org/PR50019.)
 
+- ``git-clang-format`` no longer formats changes to symbolic links. (Fixes
+  https://llvm.org/PR46992.)
+
 libclang
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 343194.
pirama added a comment.

Add release note


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101878/new/

https://reviews.llvm.org/D101878

Files:
  clang/docs/ReleaseNotes.rst
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or 
symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -243,6 +243,9 @@
   accepts ``AllIfsAndElse`` value that allows to put "else if" and "else" short
   statements on a single line. (Fixes https://llvm.org/PR50019.)
 
+- ``git-clang-format`` no longer formats changes to symbolic links. (Fixes
+  https://llvm.org/PR46992.)
+
 libclang
 
 


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -243,6 +243,9 @@
   accepts ``AllIfsAndElse`` value that allows to put "else if" and "else" short
   statements on a single line. (Fixes https://llvm.org/PR50019.)
 
+- ``git-clang-format`` no longer formats changes to symbolic links. (Fixes
+  https://llvm.org/PR46992.)
+
 libclang
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama marked an inline comment as done.
pirama added a comment.

In D101878#2740133 , @curdeius wrote:

> LGTM but let's wait a day or two before landing, so that others can chime in.
> Btw, do you have commit rights? If no, please provide "Name " for 
> commit attribution.

Yes, I do have commit rights.  Let's wait for comments and I'll submit it on 
Monday.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101878/new/

https://reviews.llvm.org/D101878

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama marked an inline comment as done.
pirama added inline comments.



Comment at: clang/tools/clang-format/git-clang-format:345
+  for filename in list(dictionary.keys()):
+print(os.getcwd())
+if os.path.islink(filename):

curdeius wrote:
> Is this print supposed to stay or is it a remnant of print-debugging?
Oops, can't believe it slipped through.  Sorry about that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101878/new/

https://reviews.llvm.org/D101878

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 343171.
pirama added a comment.

Remove debug print().


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101878/new/

https://reviews.llvm.org/D101878

Files:
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or 
symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-04 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 342927.
pirama added a comment.

Leave two empty lines after filter_symlinks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101878/new/

https://reviews.llvm.org/D101878

Files:
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or 
symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,14 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+print(os.getcwd())
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,14 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+print(os.getcwd())
+if os.path.islink(filename):
+  del dictionary[filename]
+
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D101878: [git-clang-format] Do not apply clang-format to symlinks

2021-05-04 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: MyDeveloperDay, srhines.
pirama requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This fixes PR46992.

Git stores symlinks as text files and we should not format them even if
they have one of the requested extensions.

(Move the call to `cd_to_toplevel()` up a few lines so we can also print
the skipped symlinks during verbose output.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101878

Files:
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or 
symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+print(os.getcwd())
+if os.path.islink(filename):
+  del dictionary[filename]
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')


Index: clang/tools/clang-format/git-clang-format
===
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -137,10 +137,15 @@
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
+  # The computed diff outputs absolute paths, so we must cd before accessing
+  # those files.
+  cd_to_toplevel()
+  filter_symlinks(changed_lines)
   if opts.verbose >= 1:
 ignored_files.difference_update(changed_lines)
 if ignored_files:
-  print('Ignoring changes in the following files (wrong extension):')
+  print(
+'Ignoring changes in the following files (wrong extension or symlink):')
   for filename in ignored_files:
 print('%s' % filename)
 if changed_lines:
@@ -151,9 +156,6 @@
 if opts.verbose >= 0:
   print('no modified files to format')
 return
-  # The computed diff outputs absolute paths, so we must cd before accessing
-  # those files.
-  cd_to_toplevel()
   if len(commits) > 1:
 old_tree = commits[1]
 new_tree = run_clang_format_and_save_to_tree(changed_lines,
@@ -337,6 +339,13 @@
   del dictionary[filename]
 
 
+def filter_symlinks(dictionary):
+  """Delete every key in `dictionary` that is a symlink."""
+  for filename in list(dictionary.keys()):
+print(os.getcwd())
+if os.path.islink(filename):
+  del dictionary[filename]
+
 def cd_to_toplevel():
   """Change to the top level of the git repository."""
   toplevel = run('git', 'rev-parse', '--show-toplevel')
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78033: [cmake] Restrict symbols exported from libclang-cpp

2020-04-14 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

In D78033#1978612 , @beanz wrote:

> I think this has some unintended consequences. If your tool wants to use 
> libLLVM and libClang you really need libClang to be linked against libLLVM, 
> otherwise you're actually just hiding the problem.


I wanted to avoid this since `libLLVM` is an optional target but `libclang-cpp` 
is built by default.  Maybe I didn't think through all options in this regard.

1. We could build `libLLVM` by default, but don't install it unless requested.
2. Or link `libclang-cpp` against `libLLVM` iff the latter is built.

Either option would require a CMake change that I am not sure how to make.  We 
would need to remove LLVM static libraries from `libclang-cpp`'s link command 
but I cannot figure out how to accomplish this.  They are getting included 
transitively via CMake's dependency graph.

Another option is to make libclang-cpp a superset of Clang and LLVM libraries.  
This would however require using `--whole-archive` similar to `libLLVM.so`.

Do you have any preferred solution and pointers on how to filter out some 
dependencies in CMake?  One hacky way could be to add a special-case in 
`AddLLVM.cmake` and dedup right before `target_link_libraries()`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78033/new/

https://reviews.llvm.org/D78033



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78033: [cmake] Restrict symbols exported from libclang-cpp

2020-04-13 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: beanz, mgorny.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

In libclang-cpp, export only symbols from the clang namespace or clang_*
(functions for the C interface).  This fixes the use case where a tool
depends on both libclang-cpp and libLLVM.  Without this change,
command-line registries from libLLVMSupport are exported by libclang-cpp
and gets deduped with symbols of the same name from libLLVM .  But, the
arguments get registered separately from both the libraries during
startup, resulting in an error.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78033

Files:
  clang/tools/clang-shlib/CMakeLists.txt
  clang/tools/clang-shlib/libclang-cpp.exports


Index: clang/tools/clang-shlib/libclang-cpp.exports
===
--- /dev/null
+++ clang/tools/clang-shlib/libclang-cpp.exports
@@ -0,0 +1,2 @@
+_Z*5clang*
+clang_*
Index: clang/tools/clang-shlib/CMakeLists.txt
===
--- clang/tools/clang-shlib/CMakeLists.txt
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -36,6 +36,8 @@
   set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)
 endif()
 
+set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang-cpp.exports)
+
 add_clang_library(clang-cpp
   SHARED
   ${INSTALL_WITH_TOOLCHAIN}


Index: clang/tools/clang-shlib/libclang-cpp.exports
===
--- /dev/null
+++ clang/tools/clang-shlib/libclang-cpp.exports
@@ -0,0 +1,2 @@
+_Z*5clang*
+clang_*
Index: clang/tools/clang-shlib/CMakeLists.txt
===
--- clang/tools/clang-shlib/CMakeLists.txt
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -36,6 +36,8 @@
   set(INSTALL_WITH_TOOLCHAIN INSTALL_WITH_TOOLCHAIN)
 endif()
 
+set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/libclang-cpp.exports)
+
 add_clang_library(clang-cpp
   SHARED
   ${INSTALL_WITH_TOOLCHAIN}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67364: [Driver] Handle default case in refactored addOpenMPRuntime

2019-09-09 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL371444: [Driver] Handle default case in refactored 
addOpenMPRuntime (authored by pirama, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67364?vs=219413=219415#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67364/new/

https://reviews.llvm.org/D67364

Files:
  cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp


Index: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
@@ -525,6 +525,8 @@
   case Driver::OMPRT_IOMP5:
 CmdArgs.push_back("-liomp5");
 break;
+  case Driver::OMPRT_Unknown:
+break;
   }
 
   if (ForceStaticHostRuntime)


Index: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
@@ -525,6 +525,8 @@
   case Driver::OMPRT_IOMP5:
 CmdArgs.push_back("-liomp5");
 break;
+  case Driver::OMPRT_Unknown:
+break;
   }
 
   if (ForceStaticHostRuntime)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67364: [Driver] Handle default case in refactored addOpenMPRuntime

2019-09-09 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 219413.
pirama added a comment.

Check for OMPRT_Unknown instead of a default case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67364/new/

https://reviews.llvm.org/D67364

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -525,6 +525,8 @@
   case Driver::OMPRT_IOMP5:
 CmdArgs.push_back("-liomp5");
 break;
+  case Driver::OMPRT_Unknown:
+break;
   }
 
   if (ForceStaticHostRuntime)


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -525,6 +525,8 @@
   case Driver::OMPRT_IOMP5:
 CmdArgs.push_back("-liomp5");
 break;
+  case Driver::OMPRT_Unknown:
+break;
   }
 
   if (ForceStaticHostRuntime)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67364: [Driver] Handle default case in refactored addOpenMPRuntime

2019-09-09 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: srhines, danalbert.
Herald added a subscriber: guansong.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

Appease failed builds (due to -Werror and -Wswitch) where OMPRT_Unknown
is not handled in the switch statement (even though it's handled by the
early exit).

This fixes -Wswitch triggered by r371442.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67364

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -525,6 +525,8 @@
   case Driver::OMPRT_IOMP5:
 CmdArgs.push_back("-liomp5");
 break;
+  default:
+break;
   }
 
   if (ForceStaticHostRuntime)


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -525,6 +525,8 @@
   case Driver::OMPRT_IOMP5:
 CmdArgs.push_back("-liomp5");
 break;
+  default:
+break;
   }
 
   if (ForceStaticHostRuntime)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67200: Add -static-openmp driver option

2019-09-09 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL371437: [Driver] Add -static-openmp driver option (authored 
by pirama, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67200?vs=219200=219401#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67200/new/

https://reviews.llvm.org/D67200

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
  cfe/trunk/lib/Driver/ToolChains/CommonArgs.h
  cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp
  cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
  cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
  cfe/trunk/test/Driver/fopenmp.c

Index: cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
+++ cfe/trunk/lib/Driver/ToolChains/NetBSD.cpp
@@ -289,7 +289,11 @@
   }
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
-addOpenMPRuntime(CmdArgs, getToolChain(), Args);
+// Use the static OpenMP runtime with -static-openmp
+bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
+!Args.hasArg(options::OPT_static);
+addOpenMPRuntime(CmdArgs, getToolChain(), Args, StaticOpenMP);
+
 if (D.CCCIsCXX()) {
   if (ToolChain.ShouldLinkCXXStdlib(Args))
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
Index: cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp
+++ cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp
@@ -270,7 +270,11 @@
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
-addOpenMPRuntime(CmdArgs, ToolChain, Args);
+// Use the static OpenMP runtime with -static-openmp
+bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
+!Args.hasArg(options::OPT_static);
+addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
+
 if (D.CCCIsCXX()) {
   if (ToolChain.ShouldLinkCXXStdlib(Args))
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
Index: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
@@ -500,30 +500,39 @@
 }
 
 bool tools::addOpenMPRuntime(ArgStringList , const ToolChain ,
- const ArgList , bool IsOffloadingHost,
- bool GompNeedsRT) {
+ const ArgList , bool ForceStaticHostRuntime,
+ bool IsOffloadingHost, bool GompNeedsRT) {
   if (!Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
 options::OPT_fno_openmp, false))
 return false;
 
-  switch (TC.getDriver().getOpenMPRuntime(Args)) {
+  Driver::OpenMPRuntimeKind RTKind = TC.getDriver().getOpenMPRuntime(Args);
+
+  if (RTKind == Driver::OMPRT_Unknown)
+// Already diagnosed.
+return false;
+
+  if (ForceStaticHostRuntime)
+CmdArgs.push_back("-Bstatic");
+
+  switch (RTKind) {
   case Driver::OMPRT_OMP:
 CmdArgs.push_back("-lomp");
 break;
   case Driver::OMPRT_GOMP:
 CmdArgs.push_back("-lgomp");
-
-if (GompNeedsRT)
-  CmdArgs.push_back("-lrt");
 break;
   case Driver::OMPRT_IOMP5:
 CmdArgs.push_back("-liomp5");
 break;
-  case Driver::OMPRT_Unknown:
-// Already diagnosed.
-return false;
   }
 
+  if (ForceStaticHostRuntime)
+CmdArgs.push_back("-Bdynamic");
+
+  if (RTKind == Driver::OMPRT_GOMP && GompNeedsRT)
+  CmdArgs.push_back("-lrt");
+
   if (IsOffloadingHost)
 CmdArgs.push_back("-lomptarget");
 
Index: cfe/trunk/lib/Driver/ToolChains/CommonArgs.h
===
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.h
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.h
@@ -84,6 +84,7 @@
 /// Returns true, if an OpenMP runtime has been added.
 bool addOpenMPRuntime(llvm::opt::ArgStringList , const ToolChain ,
   const llvm::opt::ArgList ,
+  bool ForceStaticHostRuntime = false,
   bool IsOffloadingHost = false, bool GompNeedsRT = false);
 
 llvm::opt::Arg *getLastProfileUseArg(const llvm::opt::ArgList );
Index: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
@@ -555,9 +555,13 @@
   bool WantPthread = Args.hasArg(options::OPT_pthread) ||
  Args.hasArg(options::OPT_pthreads);
 
+  // Use the static OpenMP runtime with -static-openmp
+  bool StaticOpenMP 

[PATCH] D67200: Add -static-openmp driver option

2019-09-06 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 219200.
pirama edited the summary of this revision.
pirama added a comment.

Test -static, -static-openmp interaction.  Added these only for iomp5 to avoid 
test-case explosion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67200/new/

https://reviews.llvm.org/D67200

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/NetBSD.cpp
  clang/test/Driver/fopenmp.c

Index: clang/test/Driver/fopenmp.c
===
--- clang/test/Driver/fopenmp.c
+++ clang/test/Driver/fopenmp.c
@@ -31,6 +31,11 @@
 // RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-RT
 // RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-RT
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC
+//
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -47,6 +52,11 @@
 // RUN: %clang -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
 // RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-freebsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-freebsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
+// RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+// RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC
+//
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -55,6 +65,11 @@
 // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
 // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-netbsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
+// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC
+//
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -93,6 +108,22 @@
 // CHECK-NO-IOMP5MD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-NO-IOMP5MD-NOT: "-liomp5md"
 //
+// CHECK-LD-STATIC-OMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-OMP: "-Bstatic" "-lomp" "-Bdynamic"
+//
+// 

[PATCH] D67200: Add -static-openmp driver option

2019-09-06 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

I'll update this review addressing @Joerg's reply to cfe-commits:

> Needs testing for the -static interaction?

Thanks @srhines for pointing me to it - I'd only subscribed to cfe-dev and not 
cfe-commits so I'd missed it..


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67200/new/

https://reviews.llvm.org/D67200



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67200: Add -static-openmp driver option

2019-09-06 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

In D67200#1660147 , @srhines wrote:

> Looks really nice. I am sure the NDK developers will be happy to see support 
> for static OpenMP. Do you want to add the public NDK github issue link in the 
> commit message?


Done.

In D67200#1660192 , @MaskRay wrote:

> Edit: Added `-static=` in D53238 . If that 
> is accepted, you may consider `-static=openmp`


Thanks Fangrui!  That change would be very helpful and I'll move to 
`-static=openmp` once it lands.  As for this change, I'll wait over the weekend 
and submit it on Monday to allow everyone a chance to look at it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67200/new/

https://reviews.llvm.org/D67200



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67200: Add -static-openmp driver option

2019-09-06 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 219182.
pirama added a comment.
Herald added a subscriber: ychen.

Mention NDK issue https://github.com/android-ndk/ndk/issues/1028.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67200/new/

https://reviews.llvm.org/D67200

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/NetBSD.cpp
  clang/test/Driver/fopenmp.c

Index: clang/test/Driver/fopenmp.c
===
--- clang/test/Driver/fopenmp.c
+++ clang/test/Driver/fopenmp.c
@@ -31,6 +31,10 @@
 // RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-RT
 // RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-RT
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+//
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -47,6 +51,10 @@
 // RUN: %clang -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
 // RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-freebsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-freebsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
+// RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+//
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -55,6 +63,10 @@
 // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
 // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-netbsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
+// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+//
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -93,6 +105,17 @@
 // CHECK-NO-IOMP5MD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-NO-IOMP5MD-NOT: "-liomp5md"
 //
+// CHECK-LD-STATIC-OMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-OMP: "-Bstatic" "-lomp" "-Bdynamic"
+//
+// CHECK-LD-STATIC-GOMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-GOMP: "-Bstatic" "-lgomp" "-Bdynamic"
+// CHECK-LD-STATIC-GOMP-RT: "-lrt"
+// CHECK-LD-STATIC-NO-GOMP-RT-NOT: "-lrt"
+//
+// CHECK-LD-STATIC-IOMP5: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-IOMP5: "-Bstatic" "-liomp5" "-Bdynamic"
+//
 // We'd like to check that the default is sane, but until we have the ability
 // to *always* semantically analyze OpenMP without always generating runtime
 // calls (in the event of an unsupported runtime), we don't have a good way to
Index: 

[PATCH] D53238: [Driver] Add -static= to unify -static-{libgcc,libstdc++}

2019-09-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

Does this regress from existing behavior for unused arguments?  Currently, 
`-static-libstdc++ -nostdlib` issues an unused argument warning for 
`-static-libstdc++`, while AFAICT `-static=c++stdlib -nostdlib` doesn't.

I'm not exactly sure how/where to issue this warning, though.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53238/new/

https://reviews.llvm.org/D53238



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67200: Add -static-openmp driver option

2019-09-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 219004.
pirama added a comment.

Change parameter name.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67200/new/

https://reviews.llvm.org/D67200

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/NetBSD.cpp
  clang/test/Driver/fopenmp.c

Index: clang/test/Driver/fopenmp.c
===
--- clang/test/Driver/fopenmp.c
+++ clang/test/Driver/fopenmp.c
@@ -31,6 +31,10 @@
 // RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-RT
 // RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-RT
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+//
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -47,6 +51,10 @@
 // RUN: %clang -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
 // RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-freebsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-freebsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
+// RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+//
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -55,6 +63,10 @@
 // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
 // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-netbsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
+// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+//
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -93,6 +105,17 @@
 // CHECK-NO-IOMP5MD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-NO-IOMP5MD-NOT: "-liomp5md"
 //
+// CHECK-LD-STATIC-OMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-OMP: "-Bstatic" "-lomp" "-Bdynamic"
+//
+// CHECK-LD-STATIC-GOMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-GOMP: "-Bstatic" "-lgomp" "-Bdynamic"
+// CHECK-LD-STATIC-GOMP-RT: "-lrt"
+// CHECK-LD-STATIC-NO-GOMP-RT-NOT: "-lrt"
+//
+// CHECK-LD-STATIC-IOMP5: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-IOMP5: "-Bstatic" "-liomp5" "-Bdynamic"
+//
 // We'd like to check that the default is sane, but until we have the ability
 // to *always* semantically analyze OpenMP without always generating runtime
 // calls (in the event of an unsupported runtime), we don't have a good way to
Index: clang/lib/Driver/ToolChains/NetBSD.cpp

[PATCH] D67200: Add -static-openmp driver option

2019-09-05 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 218959.
pirama added a comment.
Herald added a subscriber: emaste.

Supported this flag for NetBSD and FreeBSD as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67200/new/

https://reviews.llvm.org/D67200

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/FreeBSD.cpp
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/lib/Driver/ToolChains/NetBSD.cpp
  clang/test/Driver/fopenmp.c

Index: clang/test/Driver/fopenmp.c
===
--- clang/test/Driver/fopenmp.c
+++ clang/test/Driver/fopenmp.c
@@ -31,6 +31,10 @@
 // RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-RT
 // RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-RT
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+//
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -47,6 +51,10 @@
 // RUN: %clang -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
 // RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-freebsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-freebsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
+// RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+//
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -55,6 +63,10 @@
 // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
 // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-netbsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
+// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+//
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -93,6 +105,17 @@
 // CHECK-NO-IOMP5MD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-NO-IOMP5MD-NOT: "-liomp5md"
 //
+// CHECK-LD-STATIC-OMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-OMP: "-Bstatic" "-lomp" "-Bdynamic"
+//
+// CHECK-LD-STATIC-GOMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-GOMP: "-Bstatic" "-lgomp" "-Bdynamic"
+// CHECK-LD-STATIC-GOMP-RT: "-lrt"
+// CHECK-LD-STATIC-NO-GOMP-RT-NOT: "-lrt"
+//
+// CHECK-LD-STATIC-IOMP5: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-IOMP5: "-Bstatic" "-liomp5" "-Bdynamic"
+//
 // We'd like to check that the default is sane, but until we have the ability
 // to *always* semantically analyze OpenMP without always generating runtime
 // calls (in the event of an unsupported runtime), we don't have a good way to
Index: 

[PATCH] D67200: Add -static-openmp driver option

2019-09-04 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: Hahnfeld, danalbert, srhines, joerg.
Herald added a subscriber: guansong.
Herald added a reviewer: jdoerfert.
Herald added a project: clang.

This option forces linking with the static OpenMP host runtime (similar
to -static-libgcc and -static-libstdcxx).

Android's NDK will start the shared OpenMP runtime in addition to the static
libomp.  In this scenario, the linker will prefer to use the shared library by
default.  Add this option to enable linking with the static libomp.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67200

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/Gnu.cpp
  clang/test/Driver/fopenmp.c

Index: clang/test/Driver/fopenmp.c
===
--- clang/test/Driver/fopenmp.c
+++ clang/test/Driver/fopenmp.c
@@ -31,6 +31,10 @@
 // RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-RT
 // RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
 //
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-RT
+// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+//
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
@@ -93,6 +97,16 @@
 // CHECK-NO-IOMP5MD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-NO-IOMP5MD-NOT: "-liomp5md"
 //
+// CHECK-LD-STATIC-OMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-OMP: "-Bstatic" "-lomp" "-Bdynamic"
+//
+// CHECK-LD-STATIC-GOMP: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-GOMP: "-Bstatic" "-lgomp" "-Bdynamic"
+// CHECK-LD-STATIC-GOMP-RT: "-lrt"
+//
+// CHECK-LD-STATIC-IOMP5: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-STATIC-IOMP5: "-Bstatic" "-liomp5" "-Bdynamic"
+//
 // We'd like to check that the default is sane, but until we have the ability
 // to *always* semantically analyze OpenMP without always generating runtime
 // calls (in the event of an unsupported runtime), we don't have a good way to
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -555,11 +555,15 @@
   bool WantPthread = Args.hasArg(options::OPT_pthread) ||
  Args.hasArg(options::OPT_pthreads);
 
+  // Prefer the static OpenMP runtime with -static-openmp
+  bool StaticLibOpenMP = Args.hasArg(options::OPT_static_openmp) &&
+ !Args.hasArg(options::OPT_static);
+
   // FIXME: Only pass GompNeedsRT = true for platforms with libgomp that
   // require librt. Most modern Linux platforms do, but some may not.
   if (addOpenMPRuntime(CmdArgs, ToolChain, Args,
JA.isHostOffloading(Action::OFK_OpenMP),
-   /* GompNeedsRT= */ true))
+   /* GompNeedsRT= */ true, StaticLibOpenMP))
 // OpenMP runtimes implies pthreads when using the GNU toolchain.
 // FIXME: Does this really make sense for all GNU toolchains?
 WantPthread = true;
Index: clang/lib/Driver/ToolChains/CommonArgs.h
===
--- clang/lib/Driver/ToolChains/CommonArgs.h
+++ clang/lib/Driver/ToolChains/CommonArgs.h
@@ -84,7 +84,8 @@
 /// Returns true, if an OpenMP runtime has been added.
 bool addOpenMPRuntime(llvm::opt::ArgStringList , const ToolChain ,
   const llvm::opt::ArgList ,
-  bool IsOffloadingHost = false, bool GompNeedsRT = false);
+  bool IsOffloadingHost = false, bool GompNeedsRT = false,
+  bool StaticHostRuntime = false);
 
 llvm::opt::Arg *getLastProfileUseArg(const llvm::opt::ArgList );
 llvm::opt::Arg *getLastProfileSampleUseArg(const llvm::opt::ArgList );
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -501,29 +501,38 @@
 
 bool 

[PATCH] D65000: [ARM] Set default alignment to 64bits

2019-07-25 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama accepted this revision.
pirama added a comment.

LGTM for Android.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65000/new/

https://reviews.llvm.org/D65000



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63889: Check possible warnings on global initializers for reachability

2019-07-01 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added inline comments.



Comment at: clang/include/clang/Sema/AnalysisBasedWarnings.h:111
+void emitPossiblyUnreachableDiags(Sema , AnalysisDeclContext ,
+SmallVector PossiblyUnreachableDiags);
+

Fix indentation.



Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:2007
+static void flushDiagnostics(Sema ,
+SmallVector PossiblyUnreachableDiags) 
{
+  for (const auto  : PossiblyUnreachableDiags)

Should `PossiblyUnreachableDiags` be const?

Also, fix indentation.



Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:2015
+
+  if (!PossiblyUnreachableDiags.empty()) {
+bool analyzed = false;

How about returning early if `PossiblyUnreachableDiags` here is empty?  That'll 
avoid putting the entire logic of this function in the `true` branch.



Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:2031
+  CFGReverseBlockReachabilityAnalysis *cra =
+  AC.getCFGReachablityAnalysis();
+  // FIXME: We should be able to assert that block is non-null, but

`getCFGReachablityAnalysis` has a typo.  It's missing an 'i'.  Consider fixing 
this in a separate patch.



Comment at: clang/lib/Sema/AnalysisBasedWarnings.cpp:2051
+
+if (!analyzed)
+  flushDiagnostics(S, PossiblyUnreachableDiags);

Rewrite this as the `else` clause for `if (AC.getCFG())`?  In the current 
structure, it's not immediately clear that `flushDiagnostics` is called iff 
`AC.getCFG()` fails to return a valid CFG.

Upon further reading, this seems to be refactored from another function below 
so it probably makes sense to leave it as-is.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63889/new/

https://reviews.llvm.org/D63889



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53343: [Driver] Default Android toolchains to noexecstack.

2019-03-27 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama accepted this revision.
pirama added inline comments.
This revision is now accepted and ready to land.
Herald added a project: clang.



Comment at: include/clang/Driver/ToolChain.h:393
 
+  /// Test whether this toolchaind defaults to non-executable stacks.
+  virtual bool isNoExecStackDefault() const;

typo: toolchain


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53343/new/

https://reviews.llvm.org/D53343



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55856: [Driver] Also obey -nostdlib++ when rewriting -lstdc++.

2018-12-18 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added inline comments.



Comment at: test/Driver/nostdlibxx.cpp:14
+// RUN: %clangxx -target i686-pc-linux-gnu -### \
+// RUN: -nostdlib++ -stdlib=libc++ -lstdc++%s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-RESERVED-LIB-REWRITE < %t %s

Missing space here?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55856/new/

https://reviews.llvm.org/D55856



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55856: [Driver] Also obey -nostdlib++ when rewriting -lstdc++.

2018-12-18 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama accepted this revision.
pirama added inline comments.
This revision is now accepted and ready to land.



Comment at: test/Driver/nostdlibxx.cpp:14
+// RUN: %clangxx -target i686-pc-linux-gnu -### \
+// RUN: -nostdlib++ -stdlib=libc++ -lstdc++%s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-RESERVED-LIB-REWRITE < %t %s

pirama wrote:
> Missing space here?
Between -lstdc++ and the %s.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55856/new/

https://reviews.llvm.org/D55856



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53850: Declares __cpu_model as hidden symbol

2018-10-29 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama edited reviewers, added: echristo, craig.topper; removed: pirama.
pirama added subscribers: srhines, pirama, cfe-commits.
pirama added a comment.

Adding reviewers suggested by 'arc cover'.


https://reviews.llvm.org/D53850



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52368: [libc++abi] is_strcmp parameter to is_equal is unused for WIN32

2018-09-21 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342764: [libc++abi] is_strcmp parameter to is_equal is 
unused for WIN32 (authored by pirama, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D52368

Files:
  libcxxabi/trunk/src/private_typeinfo.cpp


Index: libcxxabi/trunk/src/private_typeinfo.cpp
===
--- libcxxabi/trunk/src/private_typeinfo.cpp
+++ libcxxabi/trunk/src/private_typeinfo.cpp
@@ -64,6 +64,7 @@
 return x == y;
 return strcmp(x->name(), y->name()) == 0;
 #else
+(void) use_strcmp;
 return (x == y) || (strcmp(x->name(), y->name()) == 0);
 #endif
 }


Index: libcxxabi/trunk/src/private_typeinfo.cpp
===
--- libcxxabi/trunk/src/private_typeinfo.cpp
+++ libcxxabi/trunk/src/private_typeinfo.cpp
@@ -64,6 +64,7 @@
 return x == y;
 return strcmp(x->name(), y->name()) == 0;
 #else
+(void) use_strcmp;
 return (x == y) || (strcmp(x->name(), y->name()) == 0);
 #endif
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52368: [libc++abi] is_strcmp parameter to is_equal is unused for WIN32

2018-09-21 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 166527.
pirama added a comment.

Simplify patch.


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D52368

Files:
  src/private_typeinfo.cpp


Index: src/private_typeinfo.cpp
===
--- src/private_typeinfo.cpp
+++ src/private_typeinfo.cpp
@@ -64,6 +64,7 @@
 return x == y;
 return strcmp(x->name(), y->name()) == 0;
 #else
+(void) use_strcmp;
 return (x == y) || (strcmp(x->name(), y->name()) == 0);
 #endif
 }


Index: src/private_typeinfo.cpp
===
--- src/private_typeinfo.cpp
+++ src/private_typeinfo.cpp
@@ -64,6 +64,7 @@
 return x == y;
 return strcmp(x->name(), y->name()) == 0;
 #else
+(void) use_strcmp;
 return (x == y) || (strcmp(x->name(), y->name()) == 0);
 #endif
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52368: [libc++abi] is_strcmp parameter to is_equal is unused for WIN32

2018-09-21 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: EricWF, srhines, mstorsjo.
Herald added subscribers: libcxx-commits, ldionne, christof.

Mark it as unused to avoid -Wunused-parameter.


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D52368

Files:
  src/private_typeinfo.cpp


Index: src/private_typeinfo.cpp
===
--- src/private_typeinfo.cpp
+++ src/private_typeinfo.cpp
@@ -51,13 +51,17 @@
 // Defining _LIBCXX_DYNAMIC_FALLBACK does not help since can_catch() calls 
 // is_equal() with use_strcmp=false so the string names are not compared.
 
+#define _UNUSED_IN_WIN32
 #ifdef _WIN32
 #include 
+#define _UNUSED_IN_WIN32 __attribute__((unused))
 #endif
 
 static inline
 bool
-is_equal(const std::type_info* x, const std::type_info* y, bool use_strcmp)
+is_equal(const std::type_info* x,
+ const std::type_info* y,
+ _UNUSED_IN_WIN32 bool use_strcmp)
 {
 #ifndef _WIN32
 if (!use_strcmp)


Index: src/private_typeinfo.cpp
===
--- src/private_typeinfo.cpp
+++ src/private_typeinfo.cpp
@@ -51,13 +51,17 @@
 // Defining _LIBCXX_DYNAMIC_FALLBACK does not help since can_catch() calls 
 // is_equal() with use_strcmp=false so the string names are not compared.
 
+#define _UNUSED_IN_WIN32
 #ifdef _WIN32
 #include 
+#define _UNUSED_IN_WIN32 __attribute__((unused))
 #endif
 
 static inline
 bool
-is_equal(const std::type_info* x, const std::type_info* y, bool use_strcmp)
+is_equal(const std::type_info* x,
+ const std::type_info* y,
+ _UNUSED_IN_WIN32 bool use_strcmp)
 {
 #ifndef _WIN32
 if (!use_strcmp)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D48742: Set _LIBCPP_TLS_DESTRUCTOR_CC convention to run_dtors

2018-09-21 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama abandoned this revision.
pirama added a comment.
Herald added subscribers: libcxx-commits, jfb.

This file is not built for WIN32.


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D48742



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50359: Add a new library, libclang-cxx

2018-09-12 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

As I mentioned in the discussion, we decided to carry build rules for the 
proposed library in downstream.  I've updated this to make it more general, and 
will leave it open in case there's more interest to revive it in the future.


Repository:
  rC Clang

https://reviews.llvm.org/D50359



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50359: Add a new library, libclang-cxx

2018-09-12 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 165118.
pirama added a comment.
Herald added a subscriber: fedor.sergeev.

Add empty source file to silence CMake warning.
Support more platforms, similar to libLLVM.so


Repository:
  rC Clang

https://reviews.llvm.org/D50359

Files:
  CMakeLists.txt
  tools/CMakeLists.txt
  tools/libclang-cxx/CMakeLists.txt
  tools/libclang-cxx/libclang_cxx.cpp

Index: tools/libclang-cxx/libclang_cxx.cpp
===
--- /dev/null
+++ tools/libclang-cxx/libclang_cxx.cpp
@@ -0,0 +1,8 @@
+//===- libclang_cxx.cpp - libclang_cxx Shared Library ---===//
+//===--===//
+//
+// This file is empty and serves only the purpose of making CMake happy because
+// you can't define a target with no sources.
+//
+//===--===//
+
Index: tools/libclang-cxx/CMakeLists.txt
===
--- /dev/null
+++ tools/libclang-cxx/CMakeLists.txt
@@ -0,0 +1,87 @@
+set(SOURCES
+  libclang_cxx.cpp
+  )
+
+set(LIBS
+  clangBasic
+  clangCodeGen
+  clangDriver
+  clangFrontend
+  clangFrontendTool
+)
+
+if (CLANG_ENABLE_ARCMT)
+  list(APPEND LIBS clangARCMigrate)
+endif ()
+
+if (TARGET clangTidyPlugin)
+  add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
+  list(APPEND LIBS clangTidyPlugin)
+  list(APPEND LIBS clangIncludeFixerPlugin)
+  if(LLVM_ENABLE_MODULES)
+list(APPEND LLVM_COMPILE_FLAGS "-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
+  endif()
+endif ()
+
+find_library(DL_LIBRARY_PATH dl)
+if (DL_LIBRARY_PATH)
+  list(APPEND LIBS dl)
+endif()
+
+if( LLVM_ENABLE_PIC )
+  set(ENABLE_SHARED SHARED)
+endif()
+
+if(NOT LLVM_ENABLE_PIC AND NOT WIN32)
+  set(ENABLE_STATIC STATIC)
+endif()
+
+if(WIN32)
+  set(output_name "libclang_cxx")
+else()
+  set(output_name "clang_cxx")
+endif()
+
+if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU)
+OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
+OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
+OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
+OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
+OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")) # FIXME: It should be "GNU ld for elf"
+  set(LIBS -Wl,--whole-archive ${LIBS} -Wl,--no-whole-archive)
+elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
+  set(LIBS -Wl,-all_load ${LIBS})
+endif()
+
+add_clang_library(libclang_cxx ${ENABLE_SHARED} ${ENABLE_STATIC}
+  OUTPUT_NAME ${output_name}
+  ${SOURCES}
+  LINK_LIBS
+  ${LIBS}
+  )
+
+if(ENABLE_SHARED)
+  if(WIN32)
+set_target_properties(libclang_cxx
+  PROPERTIES
+  VERSION ${LIBCLANG_LIBRARY_VERSION}
+  DEFINE_SYMBOL _CINDEX_LIB_)
+  elseif(APPLE)
+  set(LIBCLANG_CXX_LINK_FLAGS " -Wl,-compatibility_version -Wl,1")
+  set(LIBCLANG_CXX_LINK_FLAGS "${LIBCLANG_CXX_LINK_FLAGS} -Wl,-current_version -Wl,${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
+
+set_property(TARGET libclang_cxx APPEND_STRING PROPERTY
+LINK_FLAGS ${LIBCLANG_CXX_LINK_FLAGS})
+  else()
+set_target_properties(libclang_cxx
+  PROPERTIES
+  VERSION ${LIBCLANG_LIBRARY_VERSION}
+  DEFINE_SYMBOL _CINDEX_LIB_)
+# FIXME: _CINDEX_LIB_ affects dllexport/dllimport on Win32.
+if(LLVM_ENABLE_MODULES AND NOT WIN32)
+  target_compile_options(libclang_cxx PRIVATE
+"-fmodules-ignore-macro=_CINDEX_LIB_"
+)
+endif()
+  endif()
+endif()
Index: tools/CMakeLists.txt
===
--- tools/CMakeLists.txt
+++ tools/CMakeLists.txt
@@ -35,3 +35,4 @@
 
 # libclang may require clang-tidy in clang-tools-extra.
 add_clang_subdirectory(libclang)
+add_clang_subdirectory(libclang-cxx)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -422,7 +422,7 @@
 "Major version number that will be appended to the clang executable name")
 set(LIBCLANG_LIBRARY_VERSION
 "${CLANG_VERSION_MAJOR}" CACHE STRING
-"Major version number that will be appended to the libclang library")
+"Major version number that will be appended to the libclang, libclang_cxx libraries")
 mark_as_advanced(CLANG_EXECUTABLE_VERSION LIBCLANG_LIBRARY_VERSION)
 
 option(CLANG_INCLUDE_TESTS
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51068: [Android] Default to -fno-math-errno

2018-08-22 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL340424: [Android] Default to -fno-math-errno (authored by 
pirama, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D51068

Files:
  cfe/trunk/lib/Driver/ToolChains/Linux.cpp
  cfe/trunk/lib/Driver/ToolChains/Linux.h
  cfe/trunk/test/Driver/fast-math.c


Index: cfe/trunk/test/Driver/fast-math.c
===
--- cfe/trunk/test/Driver/fast-math.c
+++ cfe/trunk/test/Driver/fast-math.c
@@ -95,6 +95,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-linux-android -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 //
 // Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely
 // preserves the target default. Also check various flag set operations between
Index: cfe/trunk/lib/Driver/ToolChains/Linux.h
===
--- cfe/trunk/lib/Driver/ToolChains/Linux.h
+++ cfe/trunk/lib/Driver/ToolChains/Linux.h
@@ -38,6 +38,7 @@
   void AddIAMCUIncludeArgs(const llvm::opt::ArgList ,
llvm::opt::ArgStringList ) const override;
   bool isPIEDefault() const override;
+  bool IsMathErrnoDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;
   void addProfileRTLibs(const llvm::opt::ArgList ,
 llvm::opt::ArgStringList ) const override;
Index: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp
@@ -907,6 +907,12 @@
   getTriple().isMusl() || getSanitizerArgs().requiresPIE();
 }
 
+bool Linux::IsMathErrnoDefault() const {
+  if (getTriple().isAndroid())
+return false;
+  return Generic_ELF::IsMathErrnoDefault();
+}
+
 SanitizerMask Linux::getSupportedSanitizers() const {
   const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
   const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;


Index: cfe/trunk/test/Driver/fast-math.c
===
--- cfe/trunk/test/Driver/fast-math.c
+++ cfe/trunk/test/Driver/fast-math.c
@@ -95,6 +95,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-linux-android -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 //
 // Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely
 // preserves the target default. Also check various flag set operations between
Index: cfe/trunk/lib/Driver/ToolChains/Linux.h
===
--- cfe/trunk/lib/Driver/ToolChains/Linux.h
+++ cfe/trunk/lib/Driver/ToolChains/Linux.h
@@ -38,6 +38,7 @@
   void AddIAMCUIncludeArgs(const llvm::opt::ArgList ,
llvm::opt::ArgStringList ) const override;
   bool isPIEDefault() const override;
+  bool IsMathErrnoDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;
   void addProfileRTLibs(const llvm::opt::ArgList ,
 llvm::opt::ArgStringList ) const override;
Index: cfe/trunk/lib/Driver/ToolChains/Linux.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Linux.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp
@@ -907,6 +907,12 @@
   getTriple().isMusl() || getSanitizerArgs().requiresPIE();
 }
 
+bool Linux::IsMathErrnoDefault() const {
+  if (getTriple().isAndroid())
+return false;
+  return Generic_ELF::IsMathErrnoDefault();
+}
+
 SanitizerMask Linux::getSupportedSanitizers() const {
   const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
   const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51068: [Android] Default to -fno-math-errno

2018-08-21 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added inline comments.



Comment at: lib/Driver/ToolChains/Linux.cpp:913
+return false;
+  return Generic_ELF::IsMathErrnoDefault();
+}

I tried to be defensive here in case the default changes in the future.  I can 
simplify to just return true here if that'd be simpler.


Repository:
  rC Clang

https://reviews.llvm.org/D51068



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51068: [Android] Default to -fno-math-errno

2018-08-21 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: srhines, enh.

Android's libm does not set errno.


Repository:
  rC Clang

https://reviews.llvm.org/D51068

Files:
  lib/Driver/ToolChains/Linux.cpp
  lib/Driver/ToolChains/Linux.h
  test/Driver/fast-math.c


Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -95,6 +95,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-linux-android -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 //
 // Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely
 // preserves the target default. Also check various flag set operations between
Index: lib/Driver/ToolChains/Linux.h
===
--- lib/Driver/ToolChains/Linux.h
+++ lib/Driver/ToolChains/Linux.h
@@ -38,6 +38,7 @@
   void AddIAMCUIncludeArgs(const llvm::opt::ArgList ,
llvm::opt::ArgStringList ) const override;
   bool isPIEDefault() const override;
+  bool IsMathErrnoDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;
   void addProfileRTLibs(const llvm::opt::ArgList ,
 llvm::opt::ArgStringList ) const override;
Index: lib/Driver/ToolChains/Linux.cpp
===
--- lib/Driver/ToolChains/Linux.cpp
+++ lib/Driver/ToolChains/Linux.cpp
@@ -907,6 +907,12 @@
   getTriple().isMusl() || getSanitizerArgs().requiresPIE();
 }
 
+bool Linux::IsMathErrnoDefault() const {
+  if (getTriple().isAndroid())
+return false;
+  return Generic_ELF::IsMathErrnoDefault();
+}
+
 SanitizerMask Linux::getSupportedSanitizers() const {
   const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
   const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;


Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -95,6 +95,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-linux-android -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 //
 // Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely
 // preserves the target default. Also check various flag set operations between
Index: lib/Driver/ToolChains/Linux.h
===
--- lib/Driver/ToolChains/Linux.h
+++ lib/Driver/ToolChains/Linux.h
@@ -38,6 +38,7 @@
   void AddIAMCUIncludeArgs(const llvm::opt::ArgList ,
llvm::opt::ArgStringList ) const override;
   bool isPIEDefault() const override;
+  bool IsMathErrnoDefault() const override;
   SanitizerMask getSupportedSanitizers() const override;
   void addProfileRTLibs(const llvm::opt::ArgList ,
 llvm::opt::ArgStringList ) const override;
Index: lib/Driver/ToolChains/Linux.cpp
===
--- lib/Driver/ToolChains/Linux.cpp
+++ lib/Driver/ToolChains/Linux.cpp
@@ -907,6 +907,12 @@
   getTriple().isMusl() || getSanitizerArgs().requiresPIE();
 }
 
+bool Linux::IsMathErrnoDefault() const {
+  if (getTriple().isAndroid())
+return false;
+  return Generic_ELF::IsMathErrnoDefault();
+}
+
 SanitizerMask Linux::getSupportedSanitizers() const {
   const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
   const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50683: [Android] Set NewAlign for 64-bit Android to 8 bytes

2018-08-20 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama abandoned this revision.
pirama added a comment.

Thanks for the clarification Richard and Eli.  I agree that leaving the status 
quo will match the intent of the macro.  I'll abandon this.


Repository:
  rC Clang

https://reviews.llvm.org/D50683



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50683: [Android] Set NewAlign for 64-bit Android to 8 bytes

2018-08-13 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: rsmith, srhines.

Android uses jemalloc allocator, which returns 8-byte-aligned pointers for
allocations smaller than 8 bytes for 64-bit architectures.  Set NewAlign
conservatively to 8 bytes.


Repository:
  rC Clang

https://reviews.llvm.org/D50683

Files:
  lib/Basic/TargetInfo.cpp
  test/Preprocessor/init.c


Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -9022,7 +9022,10 @@
 // I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U
 //
 // RUN: %clang_cc1 -x c++ -triple x86_64-linux-android -E -dM < /dev/null | 
FileCheck -match-full-lines -check-prefix X86_64-ANDROID-CXX %s
-// X86_64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL
+// X86_64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8UL
+//
+// RUN: %clang_cc1 -x c++ -triple aarch64-linux-android -E -dM < /dev/null | 
FileCheck -match-full-lines -check-prefix AARCH64-ANDROID-CXX %s
+// AARCH64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8UL
 //
 // RUN: %clang_cc1 -triple arm-linux-androideabi20 -E -dM < /dev/null | 
FileCheck -match-full-lines -check-prefix ANDROID20 %s
 // ANDROID20:#define __ANDROID_API__ 20
Index: lib/Basic/TargetInfo.cpp
===
--- lib/Basic/TargetInfo.cpp
+++ lib/Basic/TargetInfo.cpp
@@ -64,10 +64,13 @@
   // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
   // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
   // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
-  // This alignment guarantee also applies to Windows and Android.
-  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid())
+  // This alignment guarantee also applies to Windows.
+  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment())
 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
-  else
+  else if (T.isAndroid()) {
+// For 64-bit Android, alignment is 8 bytes for allocations <= 8 bytes.
+NewAlign = (Triple.isArch64Bit() || Triple.isArch32Bit()) ? 64 : 0;
+  } else
 NewAlign = 0; // Infer from basic type alignment.
   HalfWidth = 16;
   HalfAlign = 16;


Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -9022,7 +9022,10 @@
 // I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U
 //
 // RUN: %clang_cc1 -x c++ -triple x86_64-linux-android -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix X86_64-ANDROID-CXX %s
-// X86_64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL
+// X86_64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8UL
+//
+// RUN: %clang_cc1 -x c++ -triple aarch64-linux-android -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix AARCH64-ANDROID-CXX %s
+// AARCH64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8UL
 //
 // RUN: %clang_cc1 -triple arm-linux-androideabi20 -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix ANDROID20 %s
 // ANDROID20:#define __ANDROID_API__ 20
Index: lib/Basic/TargetInfo.cpp
===
--- lib/Basic/TargetInfo.cpp
+++ lib/Basic/TargetInfo.cpp
@@ -64,10 +64,13 @@
   // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
   // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
   // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
-  // This alignment guarantee also applies to Windows and Android.
-  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid())
+  // This alignment guarantee also applies to Windows.
+  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment())
 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
-  else
+  else if (T.isAndroid()) {
+// For 64-bit Android, alignment is 8 bytes for allocations <= 8 bytes.
+NewAlign = (Triple.isArch64Bit() || Triple.isArch32Bit()) ? 64 : 0;
+  } else
 NewAlign = 0; // Infer from basic type alignment.
   HalfWidth = 16;
   HalfAlign = 16;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50467: [SEMA] add more -Wfloat-conversion to compound assigment analysis

2018-08-08 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added inline comments.



Comment at: lib/Sema/SemaChecking.cpp:10411
+->getAs();
+  if (!ResultBT || !(RBT && RBT->isFloatingPoint())) return;
+

Add a comment explaining this conditional as well?  

> Return if source and target types are unavailable or if source is not a 
> floating point.

With the comment, it might be cleaner to read if you expand the negation: 
`!ResultBT || !RBT || !RBT->isFloatingPoint()`


Repository:
  rC Clang

https://reviews.llvm.org/D50467



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2018-08-08 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC339284: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL 
(authored by pirama, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D37302?vs=159330=159778#toc

Repository:
  rC Clang

https://reviews.llvm.org/D37302

Files:
  lib/Headers/float.h
  test/Headers/float.c


Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#  define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
 #endif
 
 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > 
LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 


Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#  define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
 #endif
 
 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D50359: Add a new library, libclang-cxx

2018-08-06 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

This implements the new library proposed in 
http://lists.llvm.org/pipermail/cfe-dev/2018-August/058736.html.


Repository:
  rC Clang

https://reviews.llvm.org/D50359



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50359: Add a new library, libclang-cxx

2018-08-06 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
Herald added a subscriber: mgorny.

The current libclang.so exports only the symbols required for the stable
C api.  This is opposed to libLLVM.so, which exports all the symbols
from the LLVM libraries, including those from the C++ API.  This patch
adds libclang-cxx.so that is similar to libLLVM.so and exports all
symbols from the clang libraries.  The motivation for this library is to
be used by Clang tools that use Clang's C++ api.  They no longer need to
link against the individual static libraries.


Repository:
  rC Clang

https://reviews.llvm.org/D50359

Files:
  CMakeLists.txt
  tools/CMakeLists.txt
  tools/libclang-cxx/CMakeLists.txt

Index: tools/libclang-cxx/CMakeLists.txt
===
--- /dev/null
+++ tools/libclang-cxx/CMakeLists.txt
@@ -0,0 +1,74 @@
+set(LIBS
+  clangBasic
+  clangCodeGen
+  clangDriver
+  clangFrontend
+  clangFrontendTool
+)
+
+if (CLANG_ENABLE_ARCMT)
+  list(APPEND LIBS clangARCMigrate)
+endif ()
+
+if (TARGET clangTidyPlugin)
+  add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
+  list(APPEND LIBS clangTidyPlugin)
+  list(APPEND LIBS clangIncludeFixerPlugin)
+  if(LLVM_ENABLE_MODULES)
+list(APPEND LLVM_COMPILE_FLAGS "-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
+  endif()
+endif ()
+
+find_library(DL_LIBRARY_PATH dl)
+if (DL_LIBRARY_PATH)
+  list(APPEND LIBS dl)
+endif()
+
+if( LLVM_ENABLE_PIC )
+  set(ENABLE_SHARED SHARED)
+endif()
+
+if(NOT LLVM_ENABLE_PIC AND NOT WIN32)
+  set(ENABLE_STATIC STATIC)
+endif()
+
+if(WIN32)
+  set(output_name "libclang_cxx")
+else()
+  set(output_name "clang_cxx")
+endif()
+
+set(LIBS -Wl,--whole-archive ${LIBS} -Wl,--no-whole-archive)
+
+add_clang_library(libclang_cxx ${ENABLE_SHARED} ${ENABLE_STATIC}
+  OUTPUT_NAME ${output_name}
+
+  LINK_LIBS
+  ${LIBS}
+  )
+
+if(ENABLE_SHARED)
+  if(WIN32)
+set_target_properties(libclang_cxx
+  PROPERTIES
+  VERSION ${LIBCLANG_LIBRARY_VERSION}
+  DEFINE_SYMBOL _CINDEX_LIB_)
+  elseif(APPLE)
+  set(LIBCLANG_CXX_LINK_FLAGS " -Wl,-compatibility_version -Wl,1")
+  set(LIBCLANG_CXX_LINK_FLAGS "${LIBCLANG_CXX_LINK_FLAGS} -Wl,-current_version -Wl,${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
+
+set_property(TARGET libclang_cxx APPEND_STRING PROPERTY
+LINK_FLAGS ${LIBCLANG_CXX_LINK_FLAGS})
+  else()
+set_target_properties(libclang_cxx
+  PROPERTIES
+  VERSION ${LIBCLANG_LIBRARY_VERSION}
+  DEFINE_SYMBOL _CINDEX_LIB_)
+# FIXME: _CINDEX_LIB_ affects dllexport/dllimport on Win32.
+if(LLVM_ENABLE_MODULES AND NOT WIN32)
+  target_compile_options(libclang_cxx PRIVATE
+"-fmodules-ignore-macro=_CINDEX_LIB_"
+)
+endif()
+  endif()
+endif()
Index: tools/CMakeLists.txt
===
--- tools/CMakeLists.txt
+++ tools/CMakeLists.txt
@@ -35,3 +35,4 @@
 
 # libclang may require clang-tidy in clang-tools-extra.
 add_clang_subdirectory(libclang)
+add_clang_subdirectory(libclang-cxx)
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -431,7 +431,7 @@
 "Major version number that will be appended to the clang executable name")
 set(LIBCLANG_LIBRARY_VERSION
 "${CLANG_VERSION_MAJOR}" CACHE STRING
-"Major version number that will be appended to the libclang library")
+"Major version number that will be appended to the libclang, libclang_cxx libraries")
 mark_as_advanced(CLANG_EXECUTABLE_VERSION LIBCLANG_LIBRARY_VERSION)
 
 option(CLANG_INCLUDE_TESTS
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2018-08-06 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

Sorry this fell of my radar.  I've rebased the patch.

Since this has been inactive for a while, lets wait for a couple of days to see 
if there are any other comments.  If there are no objections, I'll submit this 
on Wednesday.


Repository:
  rC Clang

https://reviews.llvm.org/D37302



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2018-08-06 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 159330.
pirama added a comment.

Rebase


Repository:
  rC Clang

https://reviews.llvm.org/D37302

Files:
  lib/Headers/float.h
  test/Headers/float.c


Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > 
LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#  define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
 #endif
 
 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__


Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#  define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
 #endif
 
 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50199: [MinGW] Predefine UNICODE if -municode is specified during compilation

2018-08-02 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

In https://reviews.llvm.org/D50199#1186164, @rnk wrote:

> Does this do anything other than -DUNICODE? Maybe just translate it at the 
> driver level and skip the -cc1 flag?


It seems odd to include predefined macros at the driver, which AFAIK is just a 
bridge to the frontend's command-line interface.  OTOH, there is other 
precedence for doing this - during clang-cl's argument processing.  So I don't 
have a strong opinion here.


https://reviews.llvm.org/D50199



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50112: [Android] Increase default new alignment for Android

2018-08-01 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC338603: [Android] Increase default new alignment for Android 
(authored by pirama, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D50112?vs=158402=158574#toc

Repository:
  rC Clang

https://reviews.llvm.org/D50112

Files:
  lib/Basic/TargetInfo.cpp
  test/Preprocessor/init.c


Index: lib/Basic/TargetInfo.cpp
===
--- lib/Basic/TargetInfo.cpp
+++ lib/Basic/TargetInfo.cpp
@@ -63,8 +63,9 @@
   MinGlobalAlign = 0;
   // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
   // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
-  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html
-  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment())
+  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
+  // This alignment guarantee also applies to Windows and Android.
+  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid())
 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
   else
 NewAlign = 0; // Infer from basic type alignment.
Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -9019,7 +9019,7 @@
 // ANDROID:#define __ANDROID__ 1
 //
 // RUN: %clang_cc1 -x c++ -triple i686-linux-android -E -dM < /dev/null | 
FileCheck -match-full-lines -check-prefix I386-ANDROID-CXX %s
-// I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 4U
+// I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U
 //
 // RUN: %clang_cc1 -x c++ -triple x86_64-linux-android -E -dM < /dev/null | 
FileCheck -match-full-lines -check-prefix X86_64-ANDROID-CXX %s
 // X86_64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL


Index: lib/Basic/TargetInfo.cpp
===
--- lib/Basic/TargetInfo.cpp
+++ lib/Basic/TargetInfo.cpp
@@ -63,8 +63,9 @@
   MinGlobalAlign = 0;
   // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
   // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
-  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html
-  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment())
+  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
+  // This alignment guarantee also applies to Windows and Android.
+  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid())
 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
   else
 NewAlign = 0; // Infer from basic type alignment.
Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -9019,7 +9019,7 @@
 // ANDROID:#define __ANDROID__ 1
 //
 // RUN: %clang_cc1 -x c++ -triple i686-linux-android -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix I386-ANDROID-CXX %s
-// I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 4U
+// I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U
 //
 // RUN: %clang_cc1 -x c++ -triple x86_64-linux-android -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix X86_64-ANDROID-CXX %s
 // X86_64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50112: [Android] Increase default new alignment for Android

2018-07-31 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added a reviewer: rsmith.

Android's memory allocators also guarantee 8-byte alignment for 32-bit
architectures and 16-byte alignment for 64-bit.


Repository:
  rC Clang

https://reviews.llvm.org/D50112

Files:
  lib/Basic/TargetInfo.cpp
  test/Preprocessor/init.c


Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -9019,7 +9019,7 @@
 // ANDROID:#define __ANDROID__ 1
 //
 // RUN: %clang_cc1 -x c++ -triple i686-linux-android -E -dM < /dev/null | 
FileCheck -match-full-lines -check-prefix I386-ANDROID-CXX %s
-// I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 4U
+// I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U
 //
 // RUN: %clang_cc1 -x c++ -triple x86_64-linux-android -E -dM < /dev/null | 
FileCheck -match-full-lines -check-prefix X86_64-ANDROID-CXX %s
 // X86_64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL
Index: lib/Basic/TargetInfo.cpp
===
--- lib/Basic/TargetInfo.cpp
+++ lib/Basic/TargetInfo.cpp
@@ -63,8 +63,9 @@
   MinGlobalAlign = 0;
   // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
   // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
-  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html
-  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment())
+  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
+  // This alignment guarantee also applies to Windows and Android.
+  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid())
 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
   else
 NewAlign = 0; // Infer from basic type alignment.


Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -9019,7 +9019,7 @@
 // ANDROID:#define __ANDROID__ 1
 //
 // RUN: %clang_cc1 -x c++ -triple i686-linux-android -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix I386-ANDROID-CXX %s
-// I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 4U
+// I386-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U
 //
 // RUN: %clang_cc1 -x c++ -triple x86_64-linux-android -E -dM < /dev/null | FileCheck -match-full-lines -check-prefix X86_64-ANDROID-CXX %s
 // X86_64-ANDROID-CXX:#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL
Index: lib/Basic/TargetInfo.cpp
===
--- lib/Basic/TargetInfo.cpp
+++ lib/Basic/TargetInfo.cpp
@@ -63,8 +63,9 @@
   MinGlobalAlign = 0;
   // From the glibc documentation, on GNU systems, malloc guarantees 16-byte
   // alignment on 64-bit systems and 8-byte alignment on 32-bit systems. See
-  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html
-  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment())
+  // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html.
+  // This alignment guarantee also applies to Windows and Android.
+  if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid())
 NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0;
   else
 NewAlign = 0; // Infer from basic type alignment.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D48742: Set _LIBCPP_TLS_DESTRUCTOR_CC convention to run_dtors

2018-07-20 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

Ping...


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D48742



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D48743: Make pthread's __libcpp_get_tls declaration consistent

2018-07-20 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

Ping...


Repository:
  rCXX libc++

https://reviews.llvm.org/D48743



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D48749: [Win32] Overload ==, != for locale_t and long long

2018-07-02 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCXX336141: [Win32] Overload ==, != for locale_t and long long 
(authored by pirama, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D48749?vs=153411=153778#toc

Repository:
  rCXX libc++

https://reviews.llvm.org/D48749

Files:
  include/support/win32/locale_win32.h


Index: include/support/win32/locale_win32.h
===
--- include/support/win32/locale_win32.h
+++ include/support/win32/locale_win32.h
@@ -46,6 +46,10 @@
 return __left.__locale == nullptr && __right == 0;
 }
 
+friend bool operator==(const locale_t& __left, long long __right) {
+return __left.__locale == nullptr && __right == 0;
+}
+
 friend bool operator==(const locale_t& __left, std::nullptr_t) {
 return __left.__locale == nullptr;
 }
@@ -66,6 +70,10 @@
 return !(__left == __right);
 }
 
+friend bool operator!=(const locale_t& __left, long long __right) {
+return !(__left == __right);
+}
+
 friend bool operator!=(const locale_t& __left, std::nullptr_t __right) {
 return !(__left == __right);
 }


Index: include/support/win32/locale_win32.h
===
--- include/support/win32/locale_win32.h
+++ include/support/win32/locale_win32.h
@@ -46,6 +46,10 @@
 return __left.__locale == nullptr && __right == 0;
 }
 
+friend bool operator==(const locale_t& __left, long long __right) {
+return __left.__locale == nullptr && __right == 0;
+}
+
 friend bool operator==(const locale_t& __left, std::nullptr_t) {
 return __left.__locale == nullptr;
 }
@@ -66,6 +70,10 @@
 return !(__left == __right);
 }
 
+friend bool operator!=(const locale_t& __left, long long __right) {
+return !(__left == __right);
+}
+
 friend bool operator!=(const locale_t& __left, std::nullptr_t __right) {
 return !(__left == __right);
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D48749: [Win32] Overload ==, != for locale_t and long long

2018-06-28 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: mstorsjo, EricWF, srhines, danalbert.
Herald added subscribers: ldionne, christof.

_is_chartype_l (needed for isxdigit_l) in MinGW compares locale_t and NULL.
NULL is 'long long' for 64-bit, and this results in ambiguous overloads when
compiled with Clang.  Define a concrete overload for the operators to fix the
ambiguity.


Repository:
  rCXX libc++

https://reviews.llvm.org/D48749

Files:
  include/support/win32/locale_win32.h


Index: include/support/win32/locale_win32.h
===
--- include/support/win32/locale_win32.h
+++ include/support/win32/locale_win32.h
@@ -46,6 +46,10 @@
 return __left.__locale == nullptr && __right == 0;
 }
 
+friend bool operator==(const locale_t& __left, long long __right) {
+return __left.__locale == nullptr && __right == 0;
+}
+
 friend bool operator==(const locale_t& __left, std::nullptr_t) {
 return __left.__locale == nullptr;
 }
@@ -66,6 +70,10 @@
 return !(__left == __right);
 }
 
+friend bool operator!=(const locale_t& __left, long long __right) {
+return !(__left == __right);
+}
+
 friend bool operator!=(const locale_t& __left, std::nullptr_t __right) {
 return !(__left == __right);
 }


Index: include/support/win32/locale_win32.h
===
--- include/support/win32/locale_win32.h
+++ include/support/win32/locale_win32.h
@@ -46,6 +46,10 @@
 return __left.__locale == nullptr && __right == 0;
 }
 
+friend bool operator==(const locale_t& __left, long long __right) {
+return __left.__locale == nullptr && __right == 0;
+}
+
 friend bool operator==(const locale_t& __left, std::nullptr_t) {
 return __left.__locale == nullptr;
 }
@@ -66,6 +70,10 @@
 return !(__left == __right);
 }
 
+friend bool operator!=(const locale_t& __left, long long __right) {
+return !(__left == __right);
+}
+
 friend bool operator!=(const locale_t& __left, std::nullptr_t __right) {
 return !(__left == __right);
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D48743: Make pthread's __libcpp_get_tls declaration consistent

2018-06-28 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: EricWF, srhines, danalbert.
Herald added subscribers: ldionne, christof.

Add the _LIBCPP_TLS_DESTRUCTOR_CC attribute to the __at_exit parameter
for the pthread definition of __libcpp_get_tls.  This makes it
consistent with the rest (the non-pthread declaration in
include/__threading_support, and calls in include/thread and
srcsrc/support/win32/thread_win32.cpp).

This has NFC because _LIBCPP_TLS_DESTRUCTOR_CC is empty when pthread is
available.


Repository:
  rCXX libc++

https://reviews.llvm.org/D48743

Files:
  include/__threading_support


Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -376,7 +376,8 @@
 }
 
 // Thread local storage
-int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
+int __libcpp_tls_create(__libcpp_tls_key *__key,
+void (_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void *))
 {
   return pthread_key_create(__key, __at_exit);
 }


Index: include/__threading_support
===
--- include/__threading_support
+++ include/__threading_support
@@ -376,7 +376,8 @@
 }
 
 // Thread local storage
-int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
+int __libcpp_tls_create(__libcpp_tls_key *__key,
+void (_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void *))
 {
   return pthread_key_create(__key, __at_exit);
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D48742: Set _LIBCPP_TLS_DESTRUCTOR_CC convention to run_dtors

2018-06-28 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: EricWF, srhines, danalbert.
Herald added subscribers: ldionne, christof.

This function is passed as the __at_exit parameter to
__libcpp_tls_create.  This parameter is marked with the
_LIBCPP_TLS_DESTRUCTOR_CC attribute.  The macro is empty for pthread,
and set to __stdcall for other threading models.  __stdcall is in turn
emptry for most cases.  That's likely why this doesn't fail now.

The one exception is Windows on i686 with the Win32 threading API, where
the stdcall calling convention is used.


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D48742

Files:
  src/cxa_thread_atexit.cpp


Index: src/cxa_thread_atexit.cpp
===
--- src/cxa_thread_atexit.cpp
+++ src/cxa_thread_atexit.cpp
@@ -68,7 +68,7 @@
   // Used to trigger destructors on thread exit; value is ignored
   std::__libcpp_tls_key dtors_key;
 
-  void run_dtors(void*) {
+  void _LIBCPP_TLS_DESTRUCTOR_CC run_dtors(void*) {
 while (auto head = dtors) {
   dtors = head->next;
   head->dtor(head->obj);


Index: src/cxa_thread_atexit.cpp
===
--- src/cxa_thread_atexit.cpp
+++ src/cxa_thread_atexit.cpp
@@ -68,7 +68,7 @@
   // Used to trigger destructors on thread exit; value is ignored
   std::__libcpp_tls_key dtors_key;
 
-  void run_dtors(void*) {
+  void _LIBCPP_TLS_DESTRUCTOR_CC run_dtors(void*) {
 while (auto head = dtors) {
   dtors = head->next;
   head->dtor(head->obj);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D48731: Configure ELAST for MinGW

2018-06-28 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCXX335916: Configure ELAST for MinGW (authored by pirama, 
committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D48731?vs=153352=153381#toc

Repository:
  rCXX libc++

https://reviews.llvm.org/D48731

Files:
  src/include/config_elast.h


Index: src/include/config_elast.h
===
--- src/include/config_elast.h
+++ src/include/config_elast.h
@@ -12,7 +12,7 @@
 
 #include <__config>
 
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 #include 
 #else
 #include 
@@ -30,7 +30,7 @@
 // No _LIBCPP_ELAST needed on Apple
 #elif defined(__sun__)
 #define _LIBCPP_ELAST ESTALE
-#elif defined(_LIBCPP_MSVCRT)
+#elif defined(_LIBCPP_MSVCRT_LIKE)
 #define _LIBCPP_ELAST (_sys_nerr - 1)
 #else
 // Warn here so that the person doing the libcxx port has an easier time:


Index: src/include/config_elast.h
===
--- src/include/config_elast.h
+++ src/include/config_elast.h
@@ -12,7 +12,7 @@
 
 #include <__config>
 
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 #include 
 #else
 #include 
@@ -30,7 +30,7 @@
 // No _LIBCPP_ELAST needed on Apple
 #elif defined(__sun__)
 #define _LIBCPP_ELAST ESTALE
-#elif defined(_LIBCPP_MSVCRT)
+#elif defined(_LIBCPP_MSVCRT_LIKE)
 #define _LIBCPP_ELAST (_sys_nerr - 1)
 #else
 // Warn here so that the person doing the libcxx port has an easier time:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D48731: Configure ELAST for MinGW

2018-06-28 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: compnerd, srhines, danalbert, mstorsjo.
Herald added subscribers: cfe-commits, ldionne, christof.

Use _LIBCPP_MSVCRT_LIKE while configuring ELAST, so MinGW gets the same
configuration as MSVC.


Repository:
  rCXX libc++

https://reviews.llvm.org/D48731

Files:
  src/include/config_elast.h


Index: src/include/config_elast.h
===
--- src/include/config_elast.h
+++ src/include/config_elast.h
@@ -12,7 +12,7 @@
 
 #include <__config>
 
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 #include 
 #else
 #include 
@@ -30,7 +30,7 @@
 // No _LIBCPP_ELAST needed on Apple
 #elif defined(__sun__)
 #define _LIBCPP_ELAST ESTALE
-#elif defined(_LIBCPP_MSVCRT)
+#elif defined(_LIBCPP_MSVCRT_LIKE)
 #define _LIBCPP_ELAST (_sys_nerr - 1)
 #else
 // Warn here so that the person doing the libcxx port has an easier time:


Index: src/include/config_elast.h
===
--- src/include/config_elast.h
+++ src/include/config_elast.h
@@ -12,7 +12,7 @@
 
 #include <__config>
 
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
 #include 
 #else
 #include 
@@ -30,7 +30,7 @@
 // No _LIBCPP_ELAST needed on Apple
 #elif defined(__sun__)
 #define _LIBCPP_ELAST ESTALE
-#elif defined(_LIBCPP_MSVCRT)
+#elif defined(_LIBCPP_MSVCRT_LIKE)
 #define _LIBCPP_ELAST (_sys_nerr - 1)
 #else
 // Warn here so that the person doing the libcxx port has an easier time:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D45145: [Driver] Wire up the -f[no-]rtlib-add-rpath flag and tests

2018-04-02 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

Hi Petr, thanks for the fix (I dropped the ball on this one :( ).  Instead of 
duplicating the checks, does it make sense to fold check into 
addArchSpecificRPath and rename it to 'addArchSpecificRPathIfRequested' or 
something similar?


Repository:
  rC Clang

https://reviews.llvm.org/D45145



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D44852: [CodeGen] Mark fma as const for Android

2018-03-26 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

Thanks for the reviews!


Repository:
  rL LLVM

https://reviews.llvm.org/D44852



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D44852: [CodeGen] Mark fma as const for Android

2018-03-26 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL328552: [CodeGen] Mark fma as const for Android (authored by 
pirama, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D44852

Files:
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/CodeGen/math-builtins.c


Index: cfe/trunk/test/CodeGen/math-builtins.c
===
--- cfe/trunk/test/CodeGen/math-builtins.c
+++ cfe/trunk/test/CodeGen/math-builtins.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm
  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - 
-emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
@@ -296,6 +297,10 @@
 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) 
[[READNONE_INTRINSIC]]
 
+// HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) 
[[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
+// HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, 
x86_fp80) [[READNONE_INTRINSIC]]
+
 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) 
[[READNONE_INTRINSIC:#[0-9]+]]
 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
 // Long double is just double on win, so no f80 use/declaration.
@@ -582,5 +587,6 @@
 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
 
 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
+// HAS_ERRNO_ANDROID: attributes [[READNONE_INTRINSIC]] = { 
{{.*}}readnone{{.*}} }
 // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -13116,11 +13116,11 @@
 Context.BuiltinInfo.isConstWithoutErrno(BuiltinID))
   FD->addAttr(ConstAttr::CreateImplicit(Context, FD->getLocation()));
 
-// We make "fma" on GNU or Windows const because we know it does not set
+// We make "fma" on some platforms const because we know it does not set
 // errno in those environments even though it could set errno based on the
 // C standard.
 const llvm::Triple  = Context.getTargetInfo().getTriple();
-if ((Trip.isGNUEnvironment() || Trip.isOSMSVCRT()) &&
+if ((Trip.isGNUEnvironment() || Trip.isAndroid() || Trip.isOSMSVCRT()) &&
 !FD->hasAttr()) {
   switch (BuiltinID) {
   case Builtin::BI__builtin_fma:


Index: cfe/trunk/test/CodeGen/math-builtins.c
===
--- cfe/trunk/test/CodeGen/math-builtins.c
+++ cfe/trunk/test/CodeGen/math-builtins.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
@@ -296,6 +297,10 @@
 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
 
+// HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
+
 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // Long double is just double on 

[PATCH] D44852: [CodeGen] Mark fma as const for Android

2018-03-26 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 139798.
pirama added a comment.

Fix comment.


Repository:
  rC Clang

https://reviews.llvm.org/D44852

Files:
  lib/Sema/SemaDecl.cpp
  test/CodeGen/math-builtins.c


Index: test/CodeGen/math-builtins.c
===
--- test/CodeGen/math-builtins.c
+++ test/CodeGen/math-builtins.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm
  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - 
-emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
@@ -296,6 +297,10 @@
 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) 
[[READNONE_INTRINSIC]]
 
+// HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) 
[[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
+// HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, 
x86_fp80) [[READNONE_INTRINSIC]]
+
 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) 
[[READNONE_INTRINSIC:#[0-9]+]]
 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
 // Long double is just double on win, so no f80 use/declaration.
@@ -582,5 +587,6 @@
 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
 
 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
+// HAS_ERRNO_ANDROID: attributes [[READNONE_INTRINSIC]] = { 
{{.*}}readnone{{.*}} }
 // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -13105,11 +13105,11 @@
 Context.BuiltinInfo.isConstWithoutErrno(BuiltinID))
   FD->addAttr(ConstAttr::CreateImplicit(Context, FD->getLocation()));
 
-// We make "fma" on GNU or Windows const because we know it does not set
+// We make "fma" on some platforms const because we know it does not set
 // errno in those environments even though it could set errno based on the
 // C standard.
 const llvm::Triple  = Context.getTargetInfo().getTriple();
-if ((Trip.isGNUEnvironment() || Trip.isOSMSVCRT()) &&
+if ((Trip.isGNUEnvironment() || Trip.isAndroid() || Trip.isOSMSVCRT()) &&
 !FD->hasAttr()) {
   switch (BuiltinID) {
   case Builtin::BI__builtin_fma:


Index: test/CodeGen/math-builtins.c
===
--- test/CodeGen/math-builtins.c
+++ test/CodeGen/math-builtins.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
@@ -296,6 +297,10 @@
 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
 
+// HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
+
 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // Long double is just double on win, so no f80 use/declaration.
@@ -582,5 +587,6 @@
 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
 
 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
+// 

[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2018-03-23 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 139670.
pirama added a comment.

Remove unexpected change from another patch.


Repository:
  rC Clang

https://reviews.llvm.org/D37302

Files:
  lib/Headers/float.h
  test/Headers/float.c


Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > 
LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#  define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
 #endif
 
 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__


Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#  define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
 #endif
 
 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D44852: [CodeGen] Mark fma as const for Android

2018-03-23 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
pirama added reviewers: spatel, efriedma, srhines, chh, enh.
Herald added a subscriber: cfe-commits.

r318093 sets fma, fmaf, fmal as const for Gnu and MSVC.  Android also
does not set errno for these functions.  So mark these const for
Android.


Repository:
  rC Clang

https://reviews.llvm.org/D44852

Files:
  lib/Sema/SemaDecl.cpp
  test/CodeGen/math-builtins.c


Index: test/CodeGen/math-builtins.c
===
--- test/CodeGen/math-builtins.c
+++ test/CodeGen/math-builtins.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm
  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - 
-emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm 
-fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
@@ -296,6 +297,10 @@
 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) 
[[READNONE_INTRINSIC]]
 
+// HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) 
[[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
+// HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, 
x86_fp80) [[READNONE_INTRINSIC]]
+
 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) 
[[READNONE_INTRINSIC:#[0-9]+]]
 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) 
[[READNONE_INTRINSIC]]
 // Long double is just double on win, so no f80 use/declaration.
@@ -582,5 +587,6 @@
 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
 
 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
+// HAS_ERRNO_ANDROID: attributes [[READNONE_INTRINSIC]] = { 
{{.*}}readnone{{.*}} }
 // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -13109,7 +13109,7 @@
 // errno in those environments even though it could set errno based on the
 // C standard.
 const llvm::Triple  = Context.getTargetInfo().getTriple();
-if ((Trip.isGNUEnvironment() || Trip.isOSMSVCRT()) &&
+if ((Trip.isGNUEnvironment() || Trip.isAndroid() || Trip.isOSMSVCRT()) &&
 !FD->hasAttr()) {
   switch (BuiltinID) {
   case Builtin::BI__builtin_fma:


Index: test/CodeGen/math-builtins.c
===
--- test/CodeGen/math-builtins.c
+++ test/CodeGen/math-builtins.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
@@ -296,6 +297,10 @@
 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
 
+// HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
+
 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // Long double is just double on win, so no f80 use/declaration.
@@ -582,5 +587,6 @@
 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
 
 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
+// HAS_ERRNO_ANDROID: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 // HAS_ERRNO_WIN: 

[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2018-03-23 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 139667.
pirama added a comment.

- [CodeGen] Mark fma as const for Android


Repository:
  rC Clang

https://reviews.llvm.org/D37302

Files:
  lib/Headers/float.h
  lib/Sema/SemaDecl.cpp
  test/CodeGen/math-builtins.c
  test/Headers/float.c

Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
Index: test/CodeGen/math-builtins.c
===
--- test/CodeGen/math-builtins.c
+++ test/CodeGen/math-builtins.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
@@ -296,6 +297,10 @@
 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
 
+// HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
+
 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // Long double is just double on win, so no f80 use/declaration.
@@ -582,5 +587,6 @@
 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
 
 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
+// HAS_ERRNO_ANDROID: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -13109,7 +13109,7 @@
 // errno in those environments even though it could set errno based on the
 // C standard.
 const llvm::Triple  = Context.getTargetInfo().getTriple();
-if ((Trip.isGNUEnvironment() || Trip.isOSMSVCRT()) &&
+if ((Trip.isGNUEnvironment() || Trip.isAndroid() || Trip.isOSMSVCRT()) &&
 !FD->hasAttr()) {
   switch (BuiltinID) {
   case Builtin::BI__builtin_fma:
Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define 

[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2018-03-23 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 139666.
pirama added a comment.

- [CodeGen] Mark fma as const for Android


Repository:
  rC Clang

https://reviews.llvm.org/D37302

Files:
  lib/Headers/float.h
  lib/Sema/SemaDecl.cpp
  test/CodeGen/math-builtins.c
  test/Headers/float.c

Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
Index: test/CodeGen/math-builtins.c
===
--- test/CodeGen/math-builtins.c
+++ test/CodeGen/math-builtins.c
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm  %s | FileCheck %s -check-prefix=NO__ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown-android -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_ANDROID
 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
@@ -296,6 +297,10 @@
 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
 
+// HAS_ERRNO_ANDROID: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO_ANDROID: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO_ANDROID: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
+
 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
 // Long double is just double on win, so no f80 use/declaration.
@@ -582,5 +587,6 @@
 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
 
 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
+// HAS_ERRNO_ANDROID: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -13109,7 +13109,7 @@
 // errno in those environments even though it could set errno based on the
 // C standard.
 const llvm::Triple  = Context.getTargetInfo().getTriple();
-if ((Trip.isGNUEnvironment() || Trip.isOSMSVCRT()) &&
+if ((Trip.isGNUEnvironment() || Trip.isAndroid() || Trip.isOSMSVCRT()) &&
 !FD->hasAttr()) {
   switch (BuiltinID) {
   case Builtin::BI__builtin_fma:
Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define 

[PATCH] D40476: Switch kryo to use -mcpu=cortex-a57 when invoking the assembler

2017-11-27 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL319077: Switch CPU names not recognized by GNU assembler 
(authored by pirama).

Repository:
  rL LLVM

https://reviews.llvm.org/D40476

Files:
  cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
  cfe/trunk/test/Driver/as-mcpu.c


Index: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
@@ -42,6 +42,24 @@
  !O.hasFlag(options::DriverOption) && !O.hasFlag(options::LinkerInput);
 }
 
+// Switch CPU names not recognized by GNU assembler to a close CPU that it does
+// recognize, instead of a lower march from being picked in the absence of a 
cpu
+// flag.
+static void normalizeCPUNamesForAssembler(const ArgList ,
+  ArgStringList ) {
+  if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
+StringRef CPUArg(A->getValue());
+if (CPUArg.equals_lower("krait"))
+  CmdArgs.push_back("-mcpu=cortex-a15");
+else if(CPUArg.equals_lower("kryo") ||
+CPUArg.equals_lower("falkor") ||
+CPUArg.equals_lower("saphira"))
+  CmdArgs.push_back("-mcpu=cortex-a57");
+else
+  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+  }
+}
+
 void tools::gcc::Common::ConstructJob(Compilation , const JobAction ,
   const InputInfo ,
   const InputInfoList ,
@@ -652,23 +670,16 @@
 }
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
+normalizeCPUNamesForAssembler(Args, CmdArgs);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
-Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
 break;
   }
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
-Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+normalizeCPUNamesForAssembler(Args, CmdArgs);
+
 break;
   }
   case llvm::Triple::mips:
Index: cfe/trunk/test/Driver/as-mcpu.c
===
--- cfe/trunk/test/Driver/as-mcpu.c
+++ cfe/trunk/test/Driver/as-mcpu.c
@@ -0,0 +1,17 @@
+// == Check that krait is substituted by cortex-a15 when 
invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-a57 when 
invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+
+// RUN: %clang -target arm-linux -mcpu=falkor -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=falkor -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+
+// RUN: %clang -target arm-linux -mcpu=saphira -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=saphira -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+
+// CHECK-CORTEX-A57: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a57


Index: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
@@ -42,6 +42,24 @@
  !O.hasFlag(options::DriverOption) && !O.hasFlag(options::LinkerInput);
 }
 
+// Switch CPU names not recognized by GNU assembler to a close CPU that it does
+// recognize, instead of a lower march from being picked in the absence of a cpu
+// flag.
+static void normalizeCPUNamesForAssembler(const ArgList ,
+  ArgStringList ) {
+  if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
+StringRef CPUArg(A->getValue());
+if (CPUArg.equals_lower("krait"))
+  CmdArgs.push_back("-mcpu=cortex-a15");
+else if(CPUArg.equals_lower("kryo") ||
+CPUArg.equals_lower("falkor") ||
+CPUArg.equals_lower("saphira"))
+  CmdArgs.push_back("-mcpu=cortex-a57");
+else
+  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+  }
+}
+
 void 

[PATCH] D40476: Switch kryo to use -mcpu=cortex-a57 when invoking the assembler

2017-11-27 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 124417.
pirama added a comment.

Normalize falkor and saphira as well.


https://reviews.llvm.org/D40476

Files:
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/as-mcpu.c


Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,17 @@
+// == Check that krait is substituted by cortex-a15 when 
invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-a57 when 
invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+
+// RUN: %clang -target arm-linux -mcpu=falkor -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=falkor -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+
+// RUN: %clang -target arm-linux -mcpu=saphira -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=saphira -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+
+// CHECK-CORTEX-A57: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -42,6 +42,24 @@
  !O.hasFlag(options::DriverOption) && !O.hasFlag(options::LinkerInput);
 }
 
+// Switch CPU names not recognized by GNU assembler to a close CPU that it does
+// recognize, instead of a lower march from being picked in the absence of a 
cpu
+// flag.
+static void normalizeCPUNamesForAssembler(const ArgList ,
+  ArgStringList ) {
+  if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
+StringRef CPUArg(A->getValue());
+if (CPUArg.equals_lower("krait"))
+  CmdArgs.push_back("-mcpu=cortex-a15");
+else if(CPUArg.equals_lower("kryo") ||
+CPUArg.equals_lower("falkor") ||
+CPUArg.equals_lower("saphira"))
+  CmdArgs.push_back("-mcpu=cortex-a57");
+else
+  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+  }
+}
+
 void tools::gcc::Common::ConstructJob(Compilation , const JobAction ,
   const InputInfo ,
   const InputInfoList ,
@@ -652,23 +670,16 @@
 }
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
+normalizeCPUNamesForAssembler(Args, CmdArgs);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
-Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
 break;
   }
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
-Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+normalizeCPUNamesForAssembler(Args, CmdArgs);
+
 break;
   }
   case llvm::Triple::mips:


Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,17 @@
+// == Check that krait is substituted by cortex-a15 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-a57 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+
+// RUN: %clang -target arm-linux -mcpu=falkor -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=falkor -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+
+// RUN: %clang -target arm-linux -mcpu=saphira -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux 

[PATCH] D40476: Switch kryo to use -mcpu=cortex-a57 when invoking the assembler

2017-11-27 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 124415.
pirama added a comment.

Sink 'Arg *' declaration.


https://reviews.llvm.org/D40476

Files:
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/as-mcpu.c


Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// == Check that krait is substituted by cortex-a15 when 
invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-a57 when 
invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,35 @@
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
-Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+// FIXME: remove krait and kryo checks when GNU tools support them.  For 
now
+// use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
+  StringRef CPUArg(A->getValue());
+  if(CPUArg.equals_lower("krait"))
+CmdArgs.push_back("-mcpu=cortex-a15");
+  else if(CPUArg.equals_lower("kryo"))
+CmdArgs.push_back("-mcpu=cortex-a57");
+  else
+Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+}
 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
 break;
   }
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
-Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+
+// FIXME: remove kryo check when GNU tools support them.  For now use
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+Arg *A;
+if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
+(StringRef(A->getValue()).equals_lower("kryo")))
+  CmdArgs.push_back("-mcpu=cortex-a57");
+else
+  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
 break;
   }
   case llvm::Triple::mips:


Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// == Check that krait is substituted by cortex-a15 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-a57 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,35 @@
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
-Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+// FIXME: remove krait and kryo checks when GNU tools support them.  For now
+// use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
+  StringRef CPUArg(A->getValue());
+  

[PATCH] D40476: Switch kryo to use -mcpu=cortex-a57 when invoking the assembler

2017-11-27 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 124410.
pirama added a comment.

Address review comments.


https://reviews.llvm.org/D40476

Files:
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/as-mcpu.c


Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// == Check that krait is substituted by cortex-a15 when 
invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-a57 when 
invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,36 @@
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
+// FIXME: remove krait and kryo checks when GNU tools support them.  For 
now
+// use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
 Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+if ((A= Args.getLastArg(options::OPT_mcpu_EQ))) {
+  StringRef CPUArg(A->getValue());
+  if(CPUArg.equals_lower("krait"))
+CmdArgs.push_back("-mcpu=cortex-a15");
+  else if(CPUArg.equals_lower("kryo"))
+CmdArgs.push_back("-mcpu=cortex-a57");
+  else
+Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+}
 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
 break;
   }
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
-Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+
+// FIXME: remove kryo check when GNU tools support them.  For now use
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+Arg *A;
+if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
+(StringRef(A->getValue()).equals_lower("kryo")))
+  CmdArgs.push_back("-mcpu=cortex-a57");
+else
+  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
 break;
   }
   case llvm::Triple::mips:


Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// == Check that krait is substituted by cortex-a15 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-a57 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,36 @@
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
+// FIXME: remove krait and kryo checks when GNU tools support them.  For now
+// use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
 Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+if ((A= Args.getLastArg(options::OPT_mcpu_EQ))) {
+  StringRef CPUArg(A->getValue());
+  

[PATCH] D40476: Switch kryo to use -mcpu=cortex-a57 when invoking the assembler

2017-11-26 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 124318.
pirama added a comment.

Few refactorings.


https://reviews.llvm.org/D40476

Files:
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/as-mcpu.c


Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// == Check that krait is substituted by cortex-15 when 
invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-57 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,36 @@
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
-Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+// FIXME: remove krait and kryo checks when GNU tools support them.  For 
now
+// use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+Arg *A = Args.getLastArg(options::OPT_mcpu_EQ);
+if (A) {
+  StringRef CPUArg(A->getValue());
+  if(CPUArg.equals_lower("krait"))
+CmdArgs.push_back("-mcpu=cortex-a15");
+  else if(CPUArg.equals_lower("kryo"))
+CmdArgs.push_back("-mcpu=cortex-a57");
+  else
+Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+}
 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
 break;
   }
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
-Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+
+// FIXME: remove kryo check when GNU tools support them.  For now use
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+Arg *A;
+if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
+(StringRef(A->getValue()).equals_lower("kryo")))
+  CmdArgs.push_back("-mcpu=cortex-a57");
+else
+  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
 break;
   }
   case llvm::Triple::mips:


Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// == Check that krait is substituted by cortex-15 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-57 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: as{{(.exe)?}}" "{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,36 @@
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
-Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+// FIXME: remove krait and kryo checks when GNU tools support them.  For now
+// use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+Arg *A = Args.getLastArg(options::OPT_mcpu_EQ);
+if (A) {
+  StringRef CPUArg(A->getValue());
+  

[PATCH] D40476: Switch kryo to use -mcpu=cortex-a57 when invoking the assembler

2017-11-26 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.

Using -no-integrated-as causes -mcpu=kryo to fail since GNU assembler
doesn't recognize kryo.  Cortex-a57 is the closest CPU to kryo that the
assembler does recognize.  So we should switch the assembler to use
that instead.


https://reviews.llvm.org/D40476

Files:
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/as-mcpu.c


Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// == Check that krait is substituted by cortex-15 when 
invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: bin/as{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-57 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 
2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v 
-fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: bin/as{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,35 @@
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
-Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+// FIXME: remove krait and kryo checks when GNU tools support them.  For 
now
+// use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+Arg *A = Args.getLastArg(options::OPT_mcpu_EQ);
+if (A) {
+  if(StringRef(A->getValue()).equals_lower("krait"))
+CmdArgs.push_back("-mcpu=cortex-a15");
+  else if(StringRef(A->getValue()).equals_lower("kryo"))
+CmdArgs.push_back("-mcpu=cortex-a57");
+  else
+Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+}
 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
 break;
   }
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
-Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+
+// FIXME: remove kryo check when GNU tools support them.  For now use
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+Arg *A;
+if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
+(StringRef(A->getValue()).equals_lower("kryo")))
+  CmdArgs.push_back("-mcpu=cortex-a57");
+else
+  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
 break;
   }
   case llvm::Triple::mips:


Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// == Check that krait is substituted by cortex-15 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: bin/as{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-57 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: bin/as{{.*}}-mcpu=cortex-a57
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,35 @@
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
-Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+// FIXME: remove krait and kryo checks when GNU tools support them.  For now
+// use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a 

[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2017-11-26 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 124314.
pirama added a comment.

Revert to previous patch after accidental update


https://reviews.llvm.org/D37302

Files:
  lib/Driver/ToolChains/Gnu.cpp
  lib/Headers/float.h
  test/Driver/as-mcpu.c
  test/Headers/float.c

Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// == Check that krait is substituted by cortex-15 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: bin/as{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-57 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: bin/as{{.*}}-mcpu=cortex-a57
Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#  define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
 #endif
 
 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,35 @@
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
-Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+// FIXME: remove krait and kryo checks when GNU tools support them.  For now
+// use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+Arg *A = Args.getLastArg(options::OPT_mcpu_EQ);
+if (A) {
+  if(StringRef(A->getValue()).equals_lower("krait"))
+CmdArgs.push_back("-mcpu=cortex-a15");
+  else if(StringRef(A->getValue()).equals_lower("kryo"))
+CmdArgs.push_back("-mcpu=cortex-a57");
+  else
+Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+}
 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
 break;
   }
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
-Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+
+// FIXME: remove kryo check when GNU tools support them.  For now use
+// -mcpu=cortex-a57 to 

[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2017-11-26 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 124315.
pirama added a comment.

Actually revert


https://reviews.llvm.org/D37302

Files:
  lib/Headers/float.h
  test/Headers/float.c


Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > 
LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#  define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
 #endif
 
 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__


Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#  define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
 #endif
 
 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2017-11-26 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 124313.
pirama added a comment.

- Switch kryo to use -mcpu=cortex-a57 when invoking the assembler


https://reviews.llvm.org/D37302

Files:
  lib/Driver/ToolChains/Gnu.cpp
  lib/Headers/float.h
  test/Driver/as-mcpu.c
  test/Headers/float.c

Index: test/Headers/float.c
===
--- test/Headers/float.c
+++ test/Headers/float.c
@@ -61,6 +61,21 @@
 #if ((FLT_DECIMAL_DIG > DBL_DECIMAL_DIG) || (DBL_DECIMAL_DIG > LDBL_DECIMAL_DIG))
 #error "Mandatory macros {FLT,DBL,LDBL}_DECIMAL_DIG are invalid."
 #endif
+#ifndef FLT_HAS_SUBNORM
+#error "Mandatory macro FLT_HAS_SUBNORM is missing."
+#elif FLT_HAS_SUBNORM != __FLT_HAS_DENORM__
+#error "Mandatory macro FLT_HAS_SUBNORM is invalid."
+#endif
+#ifndef LDBL_HAS_SUBNORM
+#error "Mandatory macro LDBL_HAS_SUBNORM is missing."
+#elif LDBL_HAS_SUBNORM != __LDBL_HAS_DENORM__
+#error "Mandatory macro LDBL_HAS_SUBNORM is invalid."
+#endif
+#ifndef DBL_HAS_SUBNORM
+#error "Mandatory macro DBL_HAS_SUBNORM is missing."
+#elif DBL_HAS_SUBNORM != __DBL_HAS_DENORM__
+#error "Mandatory macro DBL_HAS_SUBNORM is invalid."
+#endif
 #else
 #ifdef FLT_DECIMAL_DIG
 #error "Macro FLT_DECIMAL_DIG should not be defined."
@@ -71,6 +86,15 @@
 #ifdef LDBL_DECIMAL_DIG
 #error "Macro LDBL_DECIMAL_DIG should not be defined."
 #endif
+#ifdef FLT_HAS_SUBNORM
+#error "Macro FLT_HAS_SUBNORM should not be defined."
+#endif
+#ifdef DBL_HAS_SUBNORM
+#error "Macro DBL_HAS_SUBNORM should not be defined."
+#endif
+#ifdef LDBL_HAS_SUBNORM
+#error "Macro LDBL_HAS_SUBNORM should not be defined."
+#endif
 #endif
 
 
Index: test/Driver/as-mcpu.c
===
--- /dev/null
+++ test/Driver/as-mcpu.c
@@ -0,0 +1,10 @@
+// == Check that krait is substituted by cortex-15 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=krait -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A15 %s
+// CHECK-CORTEX-A15: bin/as{{.*}}-mcpu=cortex-a15
+
+// == Check that kryo is substituted by cortex-57 when invoking
+// the assembler
+// RUN: %clang -target arm-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// RUN: %clang -target aarch64-linux -mcpu=kryo -### -c %s -v -fno-integrated-as 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A57 %s
+// CHECK-CORTEX-A57: bin/as{{.*}}-mcpu=cortex-a57
Index: lib/Headers/float.h
===
--- lib/Headers/float.h
+++ lib/Headers/float.h
@@ -85,6 +85,9 @@
 #undef FLT_DECIMAL_DIG
 #undef DBL_DECIMAL_DIG
 #undef LDBL_DECIMAL_DIG
+#undef FLT_HAS_SUBNORM
+#undef DBL_HAS_SUBNORM
+#undef LDBL_HAS_SUBNORM
 #  endif
 #endif
 
@@ -141,6 +144,9 @@
 #  define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
 #  define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
 #  define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
+#  define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
+#  define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
+#  define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
 #endif
 
 #ifdef __STDC_WANT_IEC_60559_TYPES_EXT__
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -653,22 +653,35 @@
 
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
 
-// FIXME: remove krait check when GNU tools support krait cpu
-// for now replace it with -mcpu=cortex-a15 to avoid a lower
-// march from being picked in the absence of a cpu flag.
-Arg *A;
-if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
-StringRef(A->getValue()).equals_lower("krait"))
-  CmdArgs.push_back("-mcpu=cortex-a15");
-else
-  Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+// FIXME: remove krait and kryo checks when GNU tools support them.  For now
+// use -mcpu=cortex-a15 for krait and -mcpu=cortex-a57 for kryo
+// -mcpu=cortex-a57 to avoid a lower march from being picked in the absence
+// of a cpu flag.
+Arg *A = Args.getLastArg(options::OPT_mcpu_EQ);
+if (A) {
+  if(StringRef(A->getValue()).equals_lower("krait"))
+CmdArgs.push_back("-mcpu=cortex-a15");
+  else if(StringRef(A->getValue()).equals_lower("kryo"))
+CmdArgs.push_back("-mcpu=cortex-a57");
+  else
+Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+}
 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
 break;
   }
   case llvm::Triple::aarch64:
   case llvm::Triple::aarch64_be: {
 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
-Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
+
+// FIXME: remove kryo check when GNU tools support them.  For now use
+// 

[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2017-09-15 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

In https://reviews.llvm.org/D37302#871794, @joerg wrote:

> So what about targets that don't support subnormals? I'm moderately sure ARM 
> falls into this category given the right phase of the moon.


Clang defines `__FLT_HAS_DENORM__` and friends unconditionally, so I thought we 
could do this for `FLT_HAS_SUBNORM` as well, considering that gcc did the same. 
 But that might be misleading because gcc's float.h was just for the target of 
that particular gcc build.

Am I right to understand that `__FLT_HAS_DENORM__` signifies *compiler* support 
for denorms as opposed to support on the *platforms* supported?  If so, it 
might support our alternative consideration of defining these macros in the 
bionic/libc headers for Android (and rely on the include_next similar to 
Windows and Darwin).


https://reviews.llvm.org/D37302



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2017-09-14 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

@bruno Any suggestion on how to update test/Headers/float-darwin,c* so make it 
check the include_next?  I am unable to find the darwin-specific float.h inside 
an XCode installation directory.

- Oops, my earlier comment had the wrong test name


https://reviews.llvm.org/D37302



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2017-09-13 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

Ping


https://reviews.llvm.org/D37302



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37302: [Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

2017-09-06 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

Ping...


https://reviews.llvm.org/D37302



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-07-18 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added inline comments.



Comment at: cmake/caches/Android-stage2.cmake:37
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_INCLUDE_TESTS OFF CACHE 
BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_THREADS OFF CACHE BOOL "")

jroelofs wrote:
> pirama wrote:
> > Should we initialize it to LLVM_ENABLE_ASSERTIONS rather than defaulting to 
> > ON?  So assertions can be enabled/disabled for all targets with just one 
> > switch (and then over-ride with per-target flags, if necessary).
> No. Absolutely not. Whether or not the bits of the toolchain that run on the 
> host have assertions should be *completely* independent of whether the target 
> bits do or don't. Do not conflate the host with the target.
Maybe I wasn't clear.  I suggest that we don't set 
RUNTIMES_${target}_LLVM_ENABLE_ASSERTIONS to ON here and rather initialize it 
based on another flag.  I was incorrect to suggest we reuse 
LLVM_ENABLE_ASSERTIONS.  We should rather have something like 
ANDROID_RUNTIMES_ENABLE_ASSERTIONS.

The motivation is to reduce the number of additional flags/switches, under the 
assumption that assert-enabled or assert-disabled builds of the runtimes are 
generated simultaneously.

To generate assert-enabled builds, the invocation would be:

```
$ cmake ... -DANDROID_RUNTIMES_ENABLE_ASSERTIONS=ON

```
instead of

```
$ cmake ... -DRUNTIMES_armv7-linux-android_LLVM_ENABLE_ASSERTIONS=ON 
-DRUNTIMES-aarch64-linux-android_LLVM_ENABLE_ASSERTIONS=ON ...

```
If I understand CMake correctly, we can still enable assertions only for a 
particular target by:

```
$ cmake ...  -DANDROID_RUNTIMES_ENABLE_ASSERTIONS=OFF 
-DRUNTIMES-aarch64-linux-android_LLVM_ENABLE_ASSERTIONS=ON
```


https://reviews.llvm.org/D33561



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33561: [CMake] Add Android toolchain CMake cache files.

2017-07-18 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added inline comments.



Comment at: cmake/caches/Android-stage2.cmake:27
+  set(RUNTIMES_${target}-linux-android_CMAKE_ASM_FLAGS 
${ANDROID_${target}_C_FLAGS} CACHE PATH "")
+  set(RUNTIMES_${target}-linux-android_CMAKE_BUILD_TYPE RELEASE CACHE STRING 
"")
+  set(RUNTIMES_${target}-linux-android_CMAKE_C_FLAGS 
${ANDROID_${target}_C_FLAGS} CACHE PATH "")

Same comment as ASSERTIONS below.



Comment at: cmake/caches/Android-stage2.cmake:37
+  set(RUNTIMES_${target}-linux-android_COMPILER_RT_INCLUDE_TESTS OFF CACHE 
BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-android_LLVM_ENABLE_THREADS OFF CACHE BOOL "")

Should we initialize it to LLVM_ENABLE_ASSERTIONS rather than defaulting to ON? 
 So assertions can be enabled/disabled for all targets with just one switch 
(and then over-ride with per-target flags, if necessary).


https://reviews.llvm.org/D33561



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-04-03 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

From the discussion, it seems it is theoretically feasible to make optimization 
for speed a function-level attribute as well.  After looking at the 
PassMangerBuilder for this bug, I think that'll make the optimization passes 
cleaner by keeping the passes and their behavior at various levels in one place.

Circling back to the issue at hand, what is the best way to handle Os and Oz at 
the lto stage?  I think we left off with @mehdi_amini's comment that the driver 
should emit a warning when dropping the Os/Oz.


https://reviews.llvm.org/D30920



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-16 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

In https://reviews.llvm.org/D30920#700741, @mehdi_amini wrote:

> In https://reviews.llvm.org/D30920#700574, @hfinkel wrote:
>
> > In https://reviews.llvm.org/D30920#700557, @mehdi_amini wrote:
> >
> > > In https://reviews.llvm.org/D30920#700433, @tejohnson wrote:
> > >
> > > > In https://reviews.llvm.org/D30920#700133, @pcc wrote:
> > > >
> > > > > In https://reviews.llvm.org/D30920#700077, @tejohnson wrote:
> > > > >
> > > > > > Until everything is converted to using size attributes, it seems 
> > > > > > like a correct fix for the bug is to accept these options in the 
> > > > > > gold-plugin and pass through the LTO API to the PassManagerBuilder.
> > > > >
> > > > >
> > > > > Not necessarily. There is no requirement (from a correctness 
> > > > > perspective) that `-Os` at link time should exactly match the 
> > > > > behaviour of `-Os` at compile time.
> > > >
> > > >
> > > > Sure, but there is certainly a perception that optimization flags 
> > > > affecting the non-LTO pipeline should similarly affect the LTO 
> > > > pipeline. LTO should be transparent to the user, so if -Os behaves one 
> > > > way without LTO, it seems problematic to me if it behaves a different 
> > > > way with LTO.
> > > >
> > > > That being said, agree that the best way to enforce that is to pass the 
> > > > relevant flags through the IR. (On the flip side, if the user passes 
> > > > -O1 to the link step, it does get passed through to the plugin and 
> > > > affects the LTO optimization pipeline...)
> > >
> > >
> > > I agree that I don't like the discrepancy: the driver should *not* drop 
> > > -Os silently if it passes down -O1/-O2/-O3, a warning is the minimum.
> >
> >
> > I don't like the discrepancy either, and I agree that we should be passing 
> > these other flags through the IR as well (even though, in the face of 
> > inlining, there is some ambiguity as to what the flags would mean). That 
> > having been said, I don't see the value in the warning. Forcing users to 
> > endure a warning solely because they use LTO and use -Os or -Oz for all of 
> > their compilation steps, is not friendly.
>
>
> The warning here is only about the *link* step.
>
> > The information has been captured already so there's nothing to warn about. 
> > You might worry about the opposite situation (the user uses only -Os or -Oz 
> > on the link step, but not for the compile steps), and that will have no 
> > effect. That, however, should be the expected behavior (optimization is 
> > associated with compiling, not linking, except perhaps for specifically 
> > called-out exceptions). The fact that our other optimization level don't 
> > work that way is a bug, not a feature, that we should fix instead of 
> > further exposing to our users.
>
> Yes, the issue is only about how the driver accepts Os for the link even 
> though it has no effect 
> (O0/https://reviews.llvm.org/owners/package/1//https://reviews.llvm.org/owners/package/2//https://reviews.llvm.org/owners/package/3/
>  *will* have an effect though).


The driver (accepts, but) ignores Os and other optimization flags for non-lto 
link-only actions.  That it has an effect for LTO is seems to be an 
implementation detail.  Since optimization flags are compiler-only options, and 
Clang already silently (without a warning) ignores these flags during link-only 
invocations, silently transforming them when passing to the plugin seems 
reasonable.


https://reviews.llvm.org/D30920



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30947: [Driver] Fix arch-specific-libdir-rpath.c

2017-03-14 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297754: [Driver] Fix arch-specific-libdir-rpath.c (authored 
by pirama).

Changed prior to commit:
  https://reviews.llvm.org/D30947?vs=91746=91747#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30947

Files:
  cfe/trunk/test/Driver/arch-specific-libdir-rpath.c


Index: cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
===
--- cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
+++ cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
@@ -59,19 +59,19 @@
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
 //
 // Add LIBPATH but no RPATH for ubsan (or any other sanitizer)
-// RUN: %clang %s -### 2>&1 -fsanitize=undefined \
+// RUN: %clang %s -### 2>&1 -fsanitize=undefined -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Add LIBPATH but no RPATH if no sanitizer or runtime is specified
-// RUN: %clang %s -### 2>&1 \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Do not add LIBPATH or RPATH if arch-specific subdir doesn't exist
-// RUN: %clang %s -### 2>&1 \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,NO-LIBPATH,NO-RPATH %s


Index: cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
===
--- cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
+++ cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
@@ -59,19 +59,19 @@
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
 //
 // Add LIBPATH but no RPATH for ubsan (or any other sanitizer)
-// RUN: %clang %s -### 2>&1 -fsanitize=undefined \
+// RUN: %clang %s -### 2>&1 -fsanitize=undefined -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Add LIBPATH but no RPATH if no sanitizer or runtime is specified
-// RUN: %clang %s -### 2>&1 \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Do not add LIBPATH or RPATH if arch-specific subdir doesn't exist
-// RUN: %clang %s -### 2>&1 \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,NO-LIBPATH,NO-RPATH %s
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30947: [Driver] Fix arch-specific-libdir-rpath.c

2017-03-14 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.

Fix the test by adding missing -target flags with a 'linux' triple.


https://reviews.llvm.org/D30947

Files:
  test/Driver/arch-specific-libdir-rpath.c


Index: test/Driver/arch-specific-libdir-rpath.c
===
--- test/Driver/arch-specific-libdir-rpath.c
+++ test/Driver/arch-specific-libdir-rpath.c
@@ -59,19 +59,19 @@
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
 //
 // Add LIBPATH but no RPATH for ubsan (or any other sanitizer)
-// RUN: %clang %s -### 2>&1 -fsanitize=undefined \
+// RUN: %clang %s -### 2>&1 -fsanitize=undefined -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Add LIBPATH but no RPATH if no sanitizer or runtime is specified
-// RUN: %clang %s -### 2>&1 \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Do not add LIBPATH or RPATH if arch-specific subdir doesn't exist
-// RUN: %clang %s -### 2>&1 \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,NO-LIBPATH,NO-RPATH %s


Index: test/Driver/arch-specific-libdir-rpath.c
===
--- test/Driver/arch-specific-libdir-rpath.c
+++ test/Driver/arch-specific-libdir-rpath.c
@@ -59,19 +59,19 @@
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
 //
 // Add LIBPATH but no RPATH for ubsan (or any other sanitizer)
-// RUN: %clang %s -### 2>&1 -fsanitize=undefined \
+// RUN: %clang %s -### 2>&1 -fsanitize=undefined -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Add LIBPATH but no RPATH if no sanitizer or runtime is specified
-// RUN: %clang %s -### 2>&1 \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Do not add LIBPATH or RPATH if arch-specific subdir doesn't exist
-// RUN: %clang %s -### 2>&1 \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir \
 // RUN: -frtlib-add-rpath \
 // RUN:   | FileCheck --check-prefixes=RESDIR,NO-LIBPATH,NO-RPATH %s
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30700: [Driver] Add flag to request arch-specific-subdir in -rpath

2017-03-14 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297751: [Driver] Add flag to request arch-specific-subdir in 
-rpath (authored by pirama).

Changed prior to commit:
  https://reviews.llvm.org/D30700?vs=91743=91744#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30700

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
  cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
  cfe/trunk/test/Driver/arch-specific-libdir.c
  cfe/trunk/test/lit.cfg

Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -2098,6 +2098,10 @@
 def rpath : Separate<["-"], "rpath">, Flags<[LinkerInput]>, Group;
 def rtlib_EQ : Joined<["-", "--"], "rtlib=">,
   HelpText<"Compiler runtime library to use">;
+def frtlib_add_rpath: Flag<["-"], "frtlib-add-rpath">, Flags<[NoArgumentUnused]>,
+  HelpText<"Add -rpath with architecture-specific resource directory to the linker flags">;
+def fno_rtlib_add_rpath: Flag<["-"], "fno-rtlib-add-rpath">, Flags<[NoArgumentUnused]>,
+  HelpText<"Do not add -rpath with architecture-specific resource directory to the linker flags">;
 def r : Flag<["-"], "r">, Flags<[LinkerInput,NoArgumentUnused]>,
 Group;
 def save_temps_EQ : Joined<["-", "--"], "save-temps=">, Flags<[DriverOption]>,
Index: cfe/trunk/test/Driver/arch-specific-libdir.c
===
--- cfe/trunk/test/Driver/arch-specific-libdir.c
+++ cfe/trunk/test/Driver/arch-specific-libdir.c
@@ -1,8 +1,6 @@
 // Test that the driver adds an arch-specific subdirectory in
 // {RESOURCE_DIR}/lib/linux to the search path.
 //
-// REQUIRES: linux
-//
 // RUN: %clang %s -### 2>&1 -target i386-unknown-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i386 %s
Index: cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
===
--- cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
+++ cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
@@ -1,50 +1,85 @@
 // Test that the driver adds an arch-specific subdirectory in
-// {RESOURCE_DIR}/lib/linux to the linker search path and to '-rpath' for native
-// compilations.
+// {RESOURCE_DIR}/lib/linux to the linker search path and to '-rpath'
 //
-// -rpath only gets added during native compilation.  To keep the test simple,
-// just test for x86_64-linux native compilation.
-// REQUIRES: x86_64-linux
+// Test the default behavior when neither -frtlib-add-rpath nor
+// -fno-rtlib-add-rpath is specified, which is to skip -rpath
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
+// RUN: -fsanitize=address -shared-libasan \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
+//
+// Test that -rpath is not added under -fno-rtlib-add-rpath even if other
+// conditions are met.
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
+// RUN: -fsanitize=address -shared-libasan \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
+//
+// Test that -rpath is added only under the right circumstance even if
+// -frtlib-add-rpath is specified.
 //
 // Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan
-// RUN: %clang %s -### 2>&1 -fsanitize=undefined \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux -fsanitize=undefined \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
+//
+// Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan
+// RUN: %clang %s -### 2>&1 -target x86_64-linux -fsanitize=undefined \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
-// RUN:   | FileCheck --check-prefixes=FILEPATH,LIBPATH,NO-RPATH %s
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Add LIBPATH, RPATH for -fsanitize=address -shared-libasan
 // RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -fsanitize=address -shared-libasan \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
-// RUN:   | FileCheck --check-prefixes=FILEPATH,LIBPATH,RPATH %s
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
+//
+// Add LIBPATH, RPATH for -fsanitize=address -shared-libasan on aarch64
+// RUN: %clang %s -### 2>&1 -target aarch64-linux \
+// RUN: -fsanitize=address -shared-libasan \
+// RUN: 

[PATCH] D30700: [Driver] Always add arch-specific-subdir to -rpath

2017-03-14 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 91743.
pirama added a comment.

Update commit message


https://reviews.llvm.org/D30700

Files:
  include/clang/Driver/Options.td
  lib/Driver/ToolChains/CommonArgs.cpp
  test/Driver/arch-specific-libdir-rpath.c
  test/Driver/arch-specific-libdir.c
  test/lit.cfg

Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -397,10 +397,6 @@
 if config.host_triple == config.target_triple:
 config.available_features.add("native")
 
-# Test Driver/arch-specific-libdir-rpath.c is restricted to x86_64-linux
-if re.match(r'^x86_64.*-linux', config.target_triple):
-config.available_features.add("x86_64-linux")
-
 # Case-insensitive file system
 def is_filesystem_case_insensitive():
 handle, path = tempfile.mkstemp(prefix='case-test', dir=config.test_exec_root)
Index: test/Driver/arch-specific-libdir.c
===
--- test/Driver/arch-specific-libdir.c
+++ test/Driver/arch-specific-libdir.c
@@ -1,8 +1,6 @@
 // Test that the driver adds an arch-specific subdirectory in
 // {RESOURCE_DIR}/lib/linux to the search path.
 //
-// REQUIRES: linux
-//
 // RUN: %clang %s -### 2>&1 -target i386-unknown-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i386 %s
Index: test/Driver/arch-specific-libdir-rpath.c
===
--- test/Driver/arch-specific-libdir-rpath.c
+++ test/Driver/arch-specific-libdir-rpath.c
@@ -1,50 +1,85 @@
 // Test that the driver adds an arch-specific subdirectory in
-// {RESOURCE_DIR}/lib/linux to the linker search path and to '-rpath' for native
-// compilations.
+// {RESOURCE_DIR}/lib/linux to the linker search path and to '-rpath'
 //
-// -rpath only gets added during native compilation.  To keep the test simple,
-// just test for x86_64-linux native compilation.
-// REQUIRES: x86_64-linux
+// Test the default behavior when neither -frtlib-add-rpath nor
+// -fno-rtlib-add-rpath is specified, which is to skip -rpath
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
+// RUN: -fsanitize=address -shared-libasan \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
+//
+// Test that -rpath is not added under -fno-rtlib-add-rpath even if other
+// conditions are met.
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
+// RUN: -fsanitize=address -shared-libasan \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
+//
+// Test that -rpath is added only under the right circumstance even if
+// -frtlib-add-rpath is specified.
 //
 // Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan
-// RUN: %clang %s -### 2>&1 -fsanitize=undefined \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux -fsanitize=undefined \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
+//
+// Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan
+// RUN: %clang %s -### 2>&1 -target x86_64-linux -fsanitize=undefined \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
-// RUN:   | FileCheck --check-prefixes=FILEPATH,LIBPATH,NO-RPATH %s
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Add LIBPATH, RPATH for -fsanitize=address -shared-libasan
 // RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -fsanitize=address -shared-libasan \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
-// RUN:   | FileCheck --check-prefixes=FILEPATH,LIBPATH,RPATH %s
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
+//
+// Add LIBPATH, RPATH for -fsanitize=address -shared-libasan on aarch64
+// RUN: %clang %s -### 2>&1 -target aarch64-linux \
+// RUN: -fsanitize=address -shared-libasan \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-AArch64,RPATH-AArch64 %s
 //
 // Add LIBPATH, RPATH with -fsanitize=address for Android
 // RUN: %clang %s -### 2>&1 -target x86_64-linux-android -fsanitize=address \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
-// RUN:   | FileCheck --check-prefixes=FILEPATH,LIBPATH,RPATH %s
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
 //
 // Add LIBPATH, RPATH for OpenMP
-// RUN: %clang %s -### 2>&1 -fopenmp \
+// RUN: %clang %s -### 2>&1 -target 

[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-14 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 91738.
pirama added a comment.

Explicitly pass -O2 instead of relying on the default opt level.


https://reviews.llvm.org/D30920

Files:
  lib/Driver/ToolChains/CommonArgs.cpp
  test/Driver/gold-lto.c


Index: test/Driver/gold-lto.c
===
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -26,3 +26,12 @@
 // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID
 // CHECK-X86-ANDROID: "-plugin" "{{.*}}/LLVMgold.so"
+//
+// Test that -Os and -Oz are not passed to the plugin
+// RUN: %clang -### %t.o -flto -Os 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Os" \
+// RUN:   --check-prefix=CHECK-O2
+// RUN: %clang -### %t.o -flto -Oz 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Oz" \
+// RUN:   --check-prefix=CHECK-O2
+// CHECK-O2: "-plugin-opt=O2"
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -368,9 +368,16 @@
 if (A->getOption().matches(options::OPT_O4) ||
 A->getOption().matches(options::OPT_Ofast))
   OOpt = "3";
-else if (A->getOption().matches(options::OPT_O))
-  OOpt = A->getValue();
-else if (A->getOption().matches(options::OPT_O0))
+else if (A->getOption().matches(options::OPT_O)) {
+  StringRef OptLevel = A->getValue();
+  // -Os and -Oz add corresponding attributes to functions.  Just use -O2
+  // for these optimization levels.  Pass other optimization levels through
+  // to the plugin.
+  if (OptLevel == "s" || OptLevel == "z")
+OOpt = "2";
+  else
+OOpt = OptLevel;
+} else if (A->getOption().matches(options::OPT_O0))
   OOpt = "0";
 if (!OOpt.empty())
   CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt));


Index: test/Driver/gold-lto.c
===
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -26,3 +26,12 @@
 // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID
 // CHECK-X86-ANDROID: "-plugin" "{{.*}}/LLVMgold.so"
+//
+// Test that -Os and -Oz are not passed to the plugin
+// RUN: %clang -### %t.o -flto -Os 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Os" \
+// RUN:   --check-prefix=CHECK-O2
+// RUN: %clang -### %t.o -flto -Oz 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Oz" \
+// RUN:   --check-prefix=CHECK-O2
+// CHECK-O2: "-plugin-opt=O2"
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -368,9 +368,16 @@
 if (A->getOption().matches(options::OPT_O4) ||
 A->getOption().matches(options::OPT_Ofast))
   OOpt = "3";
-else if (A->getOption().matches(options::OPT_O))
-  OOpt = A->getValue();
-else if (A->getOption().matches(options::OPT_O0))
+else if (A->getOption().matches(options::OPT_O)) {
+  StringRef OptLevel = A->getValue();
+  // -Os and -Oz add corresponding attributes to functions.  Just use -O2
+  // for these optimization levels.  Pass other optimization levels through
+  // to the plugin.
+  if (OptLevel == "s" || OptLevel == "z")
+OOpt = "2";
+  else
+OOpt = OptLevel;
+} else if (A->getOption().matches(options::OPT_O0))
   OOpt = "0";
 if (!OOpt.empty())
   CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-13 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama marked 3 inline comments as done.
pirama added inline comments.



Comment at: lib/Driver/ToolChains/CommonArgs.cpp:369
 if (A->getOption().matches(options::OPT_O4) ||
-A->getOption().matches(options::OPT_Ofast))
+A->getOption().matches(options::OPT_Ofast)) {
   OOpt = "3";

tejohnson wrote:
> Remove added "{"
Done.  I thought having braces consistent across `if` and `else` branches would 
be a consistent coding style but doesn't seem so: clang-format doesn't do this.


https://reviews.llvm.org/D30920



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-13 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 91671.
pirama added a comment.

Address review comments


https://reviews.llvm.org/D30920

Files:
  lib/Driver/ToolChains/CommonArgs.cpp
  test/Driver/gold-lto.c


Index: test/Driver/gold-lto.c
===
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -26,3 +26,9 @@
 // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID
 // CHECK-X86-ANDROID: "-plugin" "{{.*}}/LLVMgold.so"
+//
+// Test that -Os and -Oz are not passed to the plugin
+// RUN: %clang -### %t.o -flto -Os 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Os"
+// RUN: %clang -### %t.o -flto -Oz 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Oz"
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -368,9 +368,13 @@
 if (A->getOption().matches(options::OPT_O4) ||
 A->getOption().matches(options::OPT_Ofast))
   OOpt = "3";
-else if (A->getOption().matches(options::OPT_O))
-  OOpt = A->getValue();
-else if (A->getOption().matches(options::OPT_O0))
+else if (A->getOption().matches(options::OPT_O)) {
+  StringRef OptLevel = A->getValue();
+  // Do not pass optimization levels pertaining to code size to the plugin.
+  // They are captured by corresponding function attributes.
+  if (OptLevel != "s" && OptLevel != "z")
+OOpt = OptLevel;
+} else if (A->getOption().matches(options::OPT_O0))
   OOpt = "0";
 if (!OOpt.empty())
   CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt));


Index: test/Driver/gold-lto.c
===
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -26,3 +26,9 @@
 // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID
 // CHECK-X86-ANDROID: "-plugin" "{{.*}}/LLVMgold.so"
+//
+// Test that -Os and -Oz are not passed to the plugin
+// RUN: %clang -### %t.o -flto -Os 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Os"
+// RUN: %clang -### %t.o -flto -Oz 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Oz"
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -368,9 +368,13 @@
 if (A->getOption().matches(options::OPT_O4) ||
 A->getOption().matches(options::OPT_Ofast))
   OOpt = "3";
-else if (A->getOption().matches(options::OPT_O))
-  OOpt = A->getValue();
-else if (A->getOption().matches(options::OPT_O0))
+else if (A->getOption().matches(options::OPT_O)) {
+  StringRef OptLevel = A->getValue();
+  // Do not pass optimization levels pertaining to code size to the plugin.
+  // They are captured by corresponding function attributes.
+  if (OptLevel != "s" && OptLevel != "z")
+OOpt = OptLevel;
+} else if (A->getOption().matches(options::OPT_O0))
   OOpt = "0";
 if (!OOpt.empty())
   CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-13 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama created this revision.
Herald added a subscriber: mehdi_amini.

Address PR32155: Skip passing -Os and -Oz to the Gold plugin using
-plugin-opt.


https://reviews.llvm.org/D30920

Files:
  lib/Driver/ToolChains/CommonArgs.cpp
  test/Driver/gold-lto.c


Index: test/Driver/gold-lto.c
===
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -26,3 +26,9 @@
 // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID
 // CHECK-X86-ANDROID: "-plugin" "{{.*}}/LLVMgold.so"
+//
+// Test that -Os and -Oz are not passed to the plugin
+// RUN: %clang -### %t.o -flto -Os 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Os"
+// RUN: %clang -### %t.o -flto -Os 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Oz"
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -366,12 +366,17 @@
   if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
 StringRef OOpt;
 if (A->getOption().matches(options::OPT_O4) ||
-A->getOption().matches(options::OPT_Ofast))
+A->getOption().matches(options::OPT_Ofast)) {
   OOpt = "3";
-else if (A->getOption().matches(options::OPT_O))
-  OOpt = A->getValue();
-else if (A->getOption().matches(options::OPT_O0))
+} else if (A->getOption().matches(options::OPT_O)) {
+  StringRef OptLevel = A->getValue();
+  // Do not pass optimization levels pertaining to code size to the plugin.
+  // They are captured by corresponding function attributes.
+  if (!OptLevel.equals("s") && !OptLevel.equals("z"))
+OOpt = OptLevel;
+} else if (A->getOption().matches(options::OPT_O0)) {
   OOpt = "0";
+}
 if (!OOpt.empty())
   CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt));
   }


Index: test/Driver/gold-lto.c
===
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -26,3 +26,9 @@
 // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID
 // CHECK-X86-ANDROID: "-plugin" "{{.*}}/LLVMgold.so"
+//
+// Test that -Os and -Oz are not passed to the plugin
+// RUN: %clang -### %t.o -flto -Os 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Os"
+// RUN: %clang -### %t.o -flto -Os 2>&1 \
+// RUN: | FileCheck %s --implicit-check-not "-plugin-opt=Oz"
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -366,12 +366,17 @@
   if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
 StringRef OOpt;
 if (A->getOption().matches(options::OPT_O4) ||
-A->getOption().matches(options::OPT_Ofast))
+A->getOption().matches(options::OPT_Ofast)) {
   OOpt = "3";
-else if (A->getOption().matches(options::OPT_O))
-  OOpt = A->getValue();
-else if (A->getOption().matches(options::OPT_O0))
+} else if (A->getOption().matches(options::OPT_O)) {
+  StringRef OptLevel = A->getValue();
+  // Do not pass optimization levels pertaining to code size to the plugin.
+  // They are captured by corresponding function attributes.
+  if (!OptLevel.equals("s") && !OptLevel.equals("z"))
+OOpt = OptLevel;
+} else if (A->getOption().matches(options::OPT_O0)) {
   OOpt = "0";
+}
 if (!OOpt.empty())
   CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt));
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30733: [Driver] Add arch-specific rpath for libc++

2017-03-13 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added inline comments.



Comment at: lib/Driver/ToolChain.cpp:652
+// libc++ may be installed per arch.
+addArchSpecificRPath(*this, Args, CmdArgs);
 break;

Hahnfeld wrote:
> pirama wrote:
> > `addArchSpecificRPath` is a static function in Tools.cpp and isn't visible 
> > here.
> No, it's not since recent refactoring. I do compile test my changes usually 
> ;-)
My bad.  I'd have found about it if I actually sync to ToT more often than once 
a week.


https://reviews.llvm.org/D30733



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30700: [Driver] Always add arch-specific-subdir to -rpath

2017-03-13 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama updated this revision to Diff 91635.
pirama added a comment.

*Actually* add the command line flags.


https://reviews.llvm.org/D30700

Files:
  include/clang/Driver/Options.td
  lib/Driver/ToolChains/CommonArgs.cpp
  test/Driver/arch-specific-libdir-rpath.c
  test/Driver/arch-specific-libdir.c
  test/lit.cfg

Index: test/lit.cfg
===
--- test/lit.cfg
+++ test/lit.cfg
@@ -397,10 +397,6 @@
 if config.host_triple == config.target_triple:
 config.available_features.add("native")
 
-# Test Driver/arch-specific-libdir-rpath.c is restricted to x86_64-linux
-if re.match(r'^x86_64.*-linux', config.target_triple):
-config.available_features.add("x86_64-linux")
-
 # Case-insensitive file system
 def is_filesystem_case_insensitive():
 handle, path = tempfile.mkstemp(prefix='case-test', dir=config.test_exec_root)
Index: test/Driver/arch-specific-libdir.c
===
--- test/Driver/arch-specific-libdir.c
+++ test/Driver/arch-specific-libdir.c
@@ -1,8 +1,6 @@
 // Test that the driver adds an arch-specific subdirectory in
 // {RESOURCE_DIR}/lib/linux to the search path.
 //
-// REQUIRES: linux
-//
 // RUN: %clang %s -### 2>&1 -target i386-unknown-linux \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
 // RUN:   | FileCheck --check-prefixes=FILEPATH,ARCHDIR-i386 %s
Index: test/Driver/arch-specific-libdir-rpath.c
===
--- test/Driver/arch-specific-libdir-rpath.c
+++ test/Driver/arch-specific-libdir-rpath.c
@@ -1,50 +1,85 @@
 // Test that the driver adds an arch-specific subdirectory in
-// {RESOURCE_DIR}/lib/linux to the linker search path and to '-rpath' for native
-// compilations.
+// {RESOURCE_DIR}/lib/linux to the linker search path and to '-rpath'
 //
-// -rpath only gets added during native compilation.  To keep the test simple,
-// just test for x86_64-linux native compilation.
-// REQUIRES: x86_64-linux
+// Test the default behavior when neither -frtlib-add-rpath nor
+// -fno-rtlib-add-rpath is specified, which is to skip -rpath
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
+// RUN: -fsanitize=address -shared-libasan \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
+//
+// Test that -rpath is not added under -fno-rtlib-add-rpath even if other
+// conditions are met.
+// RUN: %clang %s -### 2>&1 -target x86_64-linux \
+// RUN: -fsanitize=address -shared-libasan \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH-X86_64 %s
+//
+// Test that -rpath is added only under the right circumstance even if
+// -frtlib-add-rpath is specified.
 //
 // Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan
-// RUN: %clang %s -### 2>&1 -fsanitize=undefined \
+// RUN: %clang %s -### 2>&1 -target x86_64-linux -fsanitize=undefined \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
+//
+// Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan
+// RUN: %clang %s -### 2>&1 -target x86_64-linux -fsanitize=undefined \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
-// RUN:   | FileCheck --check-prefixes=FILEPATH,LIBPATH,NO-RPATH %s
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,NO-RPATH %s
 //
 // Add LIBPATH, RPATH for -fsanitize=address -shared-libasan
 // RUN: %clang %s -### 2>&1 -target x86_64-linux \
 // RUN: -fsanitize=address -shared-libasan \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
-// RUN:   | FileCheck --check-prefixes=FILEPATH,LIBPATH,RPATH %s
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
+//
+// Add LIBPATH, RPATH for -fsanitize=address -shared-libasan on aarch64
+// RUN: %clang %s -### 2>&1 -target aarch64-linux \
+// RUN: -fsanitize=address -shared-libasan \
+// RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-AArch64,RPATH-AArch64 %s
 //
 // Add LIBPATH, RPATH with -fsanitize=address for Android
 // RUN: %clang %s -### 2>&1 -target x86_64-linux-android -fsanitize=address \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_arch_subdir \
-// RUN:   | FileCheck --check-prefixes=FILEPATH,LIBPATH,RPATH %s
+// RUN: -frtlib-add-rpath \
+// RUN:   | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
 //
 // Add LIBPATH, RPATH for OpenMP
-// RUN: %clang %s -### 2>&1 -fopenmp \
+// RUN: %clang %s 

  1   2   >