[PATCH] D11765: [sanitizer] Enable tsan for aarch64

2015-08-05 Thread Adhemerval Zanella
zatrazz created this revision.
zatrazz added reviewers: rengolin, t.p.northover, aemerson, pcc.
zatrazz added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

This patch enables the -fsanitizer=thread option for Linux/aarch64.

http://reviews.llvm.org/D11765

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3626,10 +3626,10 @@
   Res |= SanitizerKind::Vptr;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::DataFlow;
-  if (IsX86_64 || IsMIPS64) {
+  if (IsX86_64 || IsMIPS64)
 Res |= SanitizerKind::Leak;
+  if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;
-  }
   if (IsX86_64 || IsMIPS64 || IsPowerPC64)
 Res |= SanitizerKind::Memory;
   if (IsX86 || IsX86_64) {


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3626,10 +3626,10 @@
   Res |= SanitizerKind::Vptr;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::DataFlow;
-  if (IsX86_64 || IsMIPS64) {
+  if (IsX86_64 || IsMIPS64)
 Res |= SanitizerKind::Leak;
+  if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;
-  }
   if (IsX86_64 || IsMIPS64 || IsPowerPC64)
 Res |= SanitizerKind::Memory;
   if (IsX86 || IsX86_64) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D60728: [clang] [test] Add a (xfailing) test for PR41027

2019-08-07 Thread Adhemerval Zanella via cfe-commits
On 05/06/2019 05:19, Michał Górny via Phabricator via llvm-commits wrote:
> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL362587: [clang] [test] Add a (xfailing) test for PR41027 
> (authored by mgorny, committed by ).
> Herald added a project: LLVM.
> Herald added a subscriber: llvm-commits.
> 
> Changed prior to commit:
>   https://reviews.llvm.org/D60728?vs=195518&id=203097#toc
> 
> Repository:
>   rL LLVM
> 
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D60728/new/
> 
> https://reviews.llvm.org/D60728
> 
> Files:
>   cfe/trunk/test/Sema/pr41027.c

This patch is failing on aarch64-linux bot [1], I think you need to add a 
'requires: x86_64'.

[1] http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/7694

> 
> 
> Index: cfe/trunk/test/Sema/pr41027.c
> ===
> --- cfe/trunk/test/Sema/pr41027.c
> +++ cfe/trunk/test/Sema/pr41027.c
> @@ -0,0 +1,10 @@
> +// RUN: %clang_cc1 -triple x86_64 -fsyntax-only %s
> +// XFAIL: *
> +
> +inline void pr41027(unsigned a, unsigned b) {
> +  if (__builtin_constant_p(a)) {
> +__asm__ volatile("outl %0,%w1" : : "a"(b), "n"(a));
> +  } else {
> +__asm__ volatile("outl %0,%w1" : : "a"(b), "d"(a));
> +  }
> +}
> 
> 
> 
> ___
> llvm-commits mailing list
> llvm-comm...@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r360896 - [clang] Handle lround/llround builtins

2019-05-16 Thread Adhemerval Zanella via cfe-commits
Author: azanella
Date: Thu May 16 06:43:25 2019
New Revision: 360896

URL: http://llvm.org/viewvc/llvm-project?rev=360896&view=rev
Log:
[clang] Handle lround/llround builtins

As for other floating-point rounding builtins that can be optimized
when build with -fno-math-errno, this patch adds support for lround
and llround.  It currently only optimize for AArch64 backend.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D61392


Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/builtins.c
cfe/trunk/test/CodeGen/math-builtins.c
cfe/trunk/test/CodeGen/math-libcalls.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=360896&r1=360895&r2=360896&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu May 16 06:43:25 2019
@@ -1721,6 +1721,27 @@ RValue CodeGenFunction::EmitBuiltinExpr(
 case Builtin::BI__builtin_truncl:
   return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::trunc));
 
+case Builtin::BIlround:
+case Builtin::BIlroundf:
+case Builtin::BIlroundl:
+case Builtin::BI__builtin_lround:
+case Builtin::BI__builtin_lroundf:
+case Builtin::BI__builtin_lroundl: {
+  llvm::Type *ResultType = ConvertType(E->getType());
+  int Width = ResultType->getPrimitiveSizeInBits();
+  return RValue::get(emitUnaryBuiltin(*this, E,
+  Width == 32 ? Intrinsic::lround_i32
+  : 
Intrinsic::lround_i64));
+}
+
+case Builtin::BIllround:
+case Builtin::BIllroundf:
+case Builtin::BIllroundl:
+case Builtin::BI__builtin_llround:
+case Builtin::BI__builtin_llroundf:
+case Builtin::BI__builtin_llroundl:
+  return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::llround));
+
 default:
   break;
 }

Modified: cfe/trunk/test/CodeGen/builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins.c?rev=360896&r1=360895&r2=360896&view=diff
==
--- cfe/trunk/test/CodeGen/builtins.c (original)
+++ cfe/trunk/test/CodeGen/builtins.c Thu May 16 06:43:25 2019
@@ -256,6 +256,8 @@ void test_float_builtin_ops(float F, dou
   volatile float resf;
   volatile double resd;
   volatile long double resld;
+  volatile long int resli;
+  volatile long long int reslli;
 
   resf = __builtin_fmodf(F,F);
   // CHECK: frem float
@@ -380,6 +382,14 @@ void test_float_builtin_ops(float F, dou
   resld = __builtin_roundl(LD);
   // CHECK: call x86_fp80 @llvm.round.f80
 
+  resli = __builtin_lroundf (F);
+  // CHECK: call i64 @llvm.lround.i64.f32
+
+  resli = __builtin_lround (D);
+  // CHECK: call i64 @llvm.lround.i64.f64
+
+  resli = __builtin_lroundl (LD);
+  // CHECK: call i64 @llvm.lround.i64.f80
 }
 
 // __builtin_longjmp isn't supported on all platforms, so only test it on X86.

Modified: cfe/trunk/test/CodeGen/math-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/math-builtins.c?rev=360896&r1=360895&r2=360896&view=diff
==
--- cfe/trunk/test/CodeGen/math-builtins.c (original)
+++ cfe/trunk/test/CodeGen/math-builtins.c Thu May 16 06:43:25 2019
@@ -362,9 +362,9 @@ void foo(double *d, float f, float *fp,
 
   __builtin_llround(f);__builtin_llroundf(f);   __builtin_llroundl(f);
 
-// NO__ERRNO: declare i64 @llround(double) [[READNONE]]
-// NO__ERRNO: declare i64 @llroundf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @llroundl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.llround.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llround.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llround.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @llround(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llroundf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llroundl(x86_fp80) [[NOT_READNONE]]
@@ -425,9 +425,9 @@ void foo(double *d, float f, float *fp,
 
   __builtin_lround(f); __builtin_lroundf(f);__builtin_lroundl(f);
 
-// NO__ERRNO: declare i64 @lround(double) [[READNONE]]
-// NO__ERRNO: declare i64 @lroundf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @lroundl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.lround.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lround.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lround.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @lround(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lroundf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lroundl(x86_fp80) [[NOT_READNONE]]

Modified: cfe/trunk/test/CodeGen/math-libcalls.

r361878 - [clang] Handle lrint/llrint builtins

2019-05-28 Thread Adhemerval Zanella via cfe-commits
Author: azanella
Date: Tue May 28 14:16:04 2019
New Revision: 361878

URL: http://llvm.org/viewvc/llvm-project?rev=361878&view=rev
Log:
[clang] Handle lrint/llrint builtins

As for other floating-point rounding builtins that can be optimized
when build with -fno-math-errno, this patch adds support for lrint
and llrint.  It currently only optimize for AArch64 backend.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D62019

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/builtins.c
cfe/trunk/test/CodeGen/math-builtins.c
cfe/trunk/test/CodeGen/math-libcalls.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=361878&r1=361877&r2=361878&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue May 28 14:16:04 2019
@@ -1741,6 +1741,22 @@ RValue CodeGenFunction::EmitBuiltinExpr(
 case Builtin::BI__builtin_llroundl:
   return RValue::get(emitFPToIntRoundBuiltin(*this, E, 
Intrinsic::llround));
 
+case Builtin::BIlrint:
+case Builtin::BIlrintf:
+case Builtin::BIlrintl:
+case Builtin::BI__builtin_lrint:
+case Builtin::BI__builtin_lrintf:
+case Builtin::BI__builtin_lrintl:
+  return RValue::get(emitFPToIntRoundBuiltin(*this, E, Intrinsic::lrint));
+
+case Builtin::BIllrint:
+case Builtin::BIllrintf:
+case Builtin::BIllrintl:
+case Builtin::BI__builtin_llrint:
+case Builtin::BI__builtin_llrintf:
+case Builtin::BI__builtin_llrintl:
+  return RValue::get(emitFPToIntRoundBuiltin(*this, E, Intrinsic::llrint));
+
 default:
   break;
 }

Modified: cfe/trunk/test/CodeGen/builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins.c?rev=361878&r1=361877&r2=361878&view=diff
==
--- cfe/trunk/test/CodeGen/builtins.c (original)
+++ cfe/trunk/test/CodeGen/builtins.c Tue May 28 14:16:04 2019
@@ -390,6 +390,15 @@ void test_float_builtin_ops(float F, dou
 
   resli = __builtin_lroundl (LD);
   // CHECK: call i64 @llvm.lround.i64.f80
+
+  resli = __builtin_lrintf (F);
+  // CHECK: call i64 @llvm.lrint.i64.f32
+
+  resli = __builtin_lrint (D);
+  // CHECK: call i64 @llvm.lrint.i64.f64
+
+  resli = __builtin_lrintl (LD);
+  // CHECK: call i64 @llvm.lrint.i64.f80
 }
 
 // __builtin_longjmp isn't supported on all platforms, so only test it on X86.

Modified: cfe/trunk/test/CodeGen/math-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/math-builtins.c?rev=361878&r1=361877&r2=361878&view=diff
==
--- cfe/trunk/test/CodeGen/math-builtins.c (original)
+++ cfe/trunk/test/CodeGen/math-builtins.c Tue May 28 14:16:04 2019
@@ -353,9 +353,9 @@ void foo(double *d, float f, float *fp,
 
   __builtin_llrint(f); __builtin_llrintf(f);__builtin_llrintl(f);
 
-// NO__ERRNO: declare i64 @llrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.llrint.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llrint.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @llrint(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llrintf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llrintl(x86_fp80) [[NOT_READNONE]]
@@ -416,9 +416,9 @@ void foo(double *d, float f, float *fp,
 
   __builtin_lrint(f);  __builtin_lrintf(f); __builtin_lrintl(f);
 
-// NO__ERRNO: declare i64 @lrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @lrintf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @lrintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @lrint(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lrintf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lrintl(x86_fp80) [[NOT_READNONE]]

Modified: cfe/trunk/test/CodeGen/math-libcalls.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/math-libcalls.c?rev=361878&r1=361877&r2=361878&view=diff
==
--- cfe/trunk/test/CodeGen/math-libcalls.c (original)
+++ cfe/trunk/test/CodeGen/math-libcalls.c Tue May 28 14:16:04 2019
@@ -308,9 +308,9 @@ void foo(double *d, float f, float *fp,
 
   llrint(f); llrintf(f);llrintl(f);
 
-// NO__ERRNO: declare i64 @llrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintf(

[clang-tools-extra] [libc] [clang] [flang] [llvm] [compiler-rt] [X86] Do not end 'note.gnu.property' section with -fcf-protection (PR #79360)

2024-01-26 Thread Adhemerval Zanella via cfe-commits

https://github.com/zatrazz updated 
https://github.com/llvm/llvm-project/pull/79360

>From 240ec1a6b9dda5e6c625e096c52d70eb6458180b Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella 
Date: Wed, 24 Jan 2024 16:49:30 -0300
Subject: [PATCH] [X86] Do not end 'note.gnu.property' section with
 -fcf-protection

The glibc now adds the required minimum ISA level for libc-nonshared.a
(linked on all programs) and this is done with a inline asm along with
.note.gnu.property an .pushsection/.popsection.  However, x86 backend
always end the 'note.gnu.property' section when building with
-fcf-protection, leading to assert failure:

llvm/llvm-project-git/llvm/lib/MC/MCStreamer.cpp:1251: virtual void
llvm::MCStreamer::switchSection(llvm::MCSection*, const llvm::MCExpr*):
Assertion `!Section->hasEnded() && "Section already ended"' failed.

[1] 
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86/isa-level.c;h=3f1b269848a52f994275bab6f60dded3ded6b144;hb=HEAD
---
 llvm/lib/Target/X86/X86AsmPrinter.cpp |  1 -
 .../X86/note-cet-property-inlineasm.ll| 30 +++
 2 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 llvm/test/CodeGen/X86/note-cet-property-inlineasm.ll

diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp 
b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 9f0fd4d0938e97f..87ec8aa23080e00 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -877,7 +877,6 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) {
   OutStreamer->emitInt32(FeatureFlagsAnd);// data
   emitAlignment(WordSize == 4 ? Align(4) : Align(8)); // padding
 
-  OutStreamer->endSection(Nt);
   OutStreamer->switchSection(Cur);
 }
   }
diff --git a/llvm/test/CodeGen/X86/note-cet-property-inlineasm.ll 
b/llvm/test/CodeGen/X86/note-cet-property-inlineasm.ll
new file mode 100644
index 000..a0e5b4add1b386e
--- /dev/null
+++ b/llvm/test/CodeGen/X86/note-cet-property-inlineasm.ll
@@ -0,0 +1,30 @@
+; RUN: llc -mtriple x86_64-unknown-linux-gnu %s -o %t.o -filetype=obj
+; RUN: llvm-readobj -n %t.o | FileCheck %s
+
+module asm ".pushsection \22.note.gnu.property\22,\22a\22,@note"
+module asm " .p2align 3"
+module asm " .long 1f - 0f"
+module asm " .long 4f - 1f"
+module asm " .long 5"
+module asm "0:   .asciz \22GNU\22"
+module asm "1:   .p2align 3"
+module asm " .long 0xc0008002"
+module asm " .long 3f - 2f"
+module asm "2:   .long ((1U << 0) | 0 | 0 | 0)"
+module asm "3:   .p2align 3"
+module asm "4:"
+module asm " .popsection"
+
+!llvm.module.flags = !{!0, !1}
+
+!0 = !{i32 4, !"cf-protection-return", i32 1}
+!1 = !{i32 4, !"cf-protection-branch", i32 1}
+
+; CHECK:  Type: NT_GNU_PROPERTY_TYPE_0
+; CHECK-NEXT: Property [
+; CHECK-NEXT:   x86 feature: IBT, SHSTK
+; CHECK-NEXT: ]
+; CHECK:  Type: NT_GNU_PROPERTY_TYPE_0
+; CHECK-NEXT: Property [
+; CHECK-NEXT:   x86 ISA needed: x86-64-baseline
+; CHECK-NEXT: ]

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


[clang] 92e1723 - [clang][Headers] Only define FLT_EVAL_METHOD for C99 and later

2022-11-08 Thread Adhemerval Zanella via cfe-commits

Author: Adhemerval Zanella
Date: 2022-11-08T13:58:37-03:00
New Revision: 92e172309cf6624487ef6b3a79a5445276f9

URL: 
https://github.com/llvm/llvm-project/commit/92e172309cf6624487ef6b3a79a5445276f9
DIFF: 
https://github.com/llvm/llvm-project/commit/92e172309cf6624487ef6b3a79a5445276f9.diff

LOG: [clang][Headers] Only define FLT_EVAL_METHOD for C99 and later

It was reported by glibc conform test [1].

[1] 
https://sourceware.org/git/?p=glibc.git;a=blob;f=conform/data/float.h-data;h=7b98fc03447b8918da4a0cf47d41fb3e17f4f791;hb=HEAD

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D137267

Added: 


Modified: 
clang/lib/Headers/float.h

Removed: 




diff  --git a/clang/lib/Headers/float.h b/clang/lib/Headers/float.h
index 5dace7a47c9fa..0e73bca0a2d6e 100644
--- a/clang/lib/Headers/float.h
+++ b/clang/lib/Headers/float.h
@@ -86,7 +86,10 @@
 
 /* Characteristics of floating point types, C99 5.2.4.2.2 */
 
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) ||  
\
+(defined(__cplusplus) && __cplusplus >= 201103L)
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#endif
 #define FLT_ROUNDS (__builtin_flt_rounds())
 #define FLT_RADIX __FLT_RADIX__
 



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


[clang] 9e95699 - [clang][Headers] Do not define varargs macros for __need___va_list

2022-11-08 Thread Adhemerval Zanella via cfe-commits

Author: Adhemerval Zanella
Date: 2022-11-08T16:29:35-03:00
New Revision: 9e956995db1fc7e792e3dfb3a465a52626195557

URL: 
https://github.com/llvm/llvm-project/commit/9e956995db1fc7e792e3dfb3a465a52626195557
DIFF: 
https://github.com/llvm/llvm-project/commit/9e956995db1fc7e792e3dfb3a465a52626195557.diff

LOG: [clang][Headers] Do not define varargs macros for __need___va_list

The glibc uses the define to avoid namespace polution on headers
that requires variadic argument, where the inclusion of stdarg.h is
required to obtain the va_list definition.

For such cases only __gnuc_va_list is required.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D137268

Added: 


Modified: 
clang/lib/Headers/stdarg.h
compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp

Removed: 




diff  --git a/clang/lib/Headers/stdarg.h b/clang/lib/Headers/stdarg.h
index dc7becff670f4..4fbfe0985a160 100644
--- a/clang/lib/Headers/stdarg.h
+++ b/clang/lib/Headers/stdarg.h
@@ -8,8 +8,16 @@
  */
 
 #ifndef __STDARG_H
-#define __STDARG_H
 
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST
+typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#ifdef __need___va_list
+#undef __need___va_list
+#else
+#define __STDARG_H
 #ifndef _VA_LIST
 typedef __builtin_va_list va_list;
 #define _VA_LIST
@@ -29,9 +37,6 @@ typedef __builtin_va_list va_list;
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)
 #endif
 
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST 1
-typedef __builtin_va_list __gnuc_va_list;
-#endif
-
 #endif /* __STDARG_H */
+
+#endif /* not __STDARG_H */

diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp 
b/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
index 84084b9291a70..f5dcc4bc3208c 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



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


[libcxx] r278745 - libcxx: Fix path.compare.pass expected result

2016-08-15 Thread Adhemerval Zanella via cfe-commits
Author: azanella
Date: Mon Aug 15 16:24:50 2016
New Revision: 278745

URL: http://llvm.org/viewvc/llvm-project?rev=278745&view=rev
Log:
libcxx: Fix path.compare.pass expected result

The expected 'filesystem::path::compare' result states that for different
path only result sign contains the information about passed arguments
(not its integer value).  This is due it uses the output of other compare
functions (basic_string_view and char_traits) without further handling and
char_traits uses memcmp for final buffer comparison.

However for GLIBC on AArch64 the code:

  int ret = memcmp ("b/a/c", "a/b/c", 1);

Results in '64' where for x86_64 it results in '1'.

This patch fixes the expected 'filesystem::path::compare' by normalizing
all the results before assert comparison.

Modified:

libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp?rev=278745&r1=278744&r2=278745&view=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
 Mon Aug 15 16:24:50 2016
@@ -73,6 +73,11 @@ const PathCompareTest CompareTestCases[]
 #undef LONGC
 #undef LONGD
 
+static inline int normalize_ret(int ret)
+{
+  return ret < 0 ? -1 : (ret > 0 ? 1 : 0);
+}
+
 int main()
 {
   using namespace fs;
@@ -86,13 +91,12 @@ int main()
   DisableAllocationGuard g; // none of these operations should allocate
 
   // check runtime results
-  int ret1 = p1.compare(p2);
-  int ret2 = p1.compare(R);
-  int ret3 = p1.compare(TC.RHS);
-  int ret4 = p1.compare(RV);
+  int ret1 = normalize_ret(p1.compare(p2));
+  int ret2 = normalize_ret(p1.compare(R));
+  int ret3 = normalize_ret(p1.compare(TC.RHS));
+  int ret4 = normalize_ret(p1.compare(RV));
   assert(ret1 == ret2 && ret1 == ret3 && ret1 == ret4);
-  int normalized_ret = ret1 < 0 ? -1 : (ret1 > 0 ? 1 : 0);
-  assert(normalized_ret == E);
+  assert(ret1 == E);
 
   // check signatures
   ASSERT_NOEXCEPT(p1.compare(p2));


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


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-22 Thread Adhemerval Zanella via cfe-commits
zatrazz added a comment.

Ping (x2).


https://reviews.llvm.org/D23420



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


[libcxx] r279552 - libcxx: Fix libcxx tests on aarch64 with libunwind

2016-08-23 Thread Adhemerval Zanella via cfe-commits
Author: azanella
Date: Tue Aug 23 14:25:12 2016
New Revision: 279552

URL: http://llvm.org/viewvc/llvm-project?rev=279552&view=rev
Log:
libcxx: Fix libcxx tests on aarch64 with libunwind

Some tests uses 'long double' to/from conversions and for some targets
they are provided by compiler runtime (either compiler-rt or libgcc).
However when building libcxx with linunwinder current test configuration
at target_info.py do not include the required libraries, as:

  not llvm_unwinder:
"-lc++" "-lm" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" "-lgcc"

  llvm_unwinder
"-lc++" "-lm" "-lpthread" "-lc" "-lunwind" "-ldl"

This causes some tests build issues with missing symbols on aarch64,
for instance, where 'long double' is a binary float with 128-bits with
mostly of internal operations being provided by software routines.

This patch changes how to define the default linker flags with libunwinder by
adding libgcc regardless.

I checked and aarch64 and x86_64 with libcxx and libunwind (with and without
LIBCXXABI_USE_LLVM_UNWINDER).

Modified:
libcxx/trunk/test/libcxx/test/target_info.py

Modified: libcxx/trunk/test/libcxx/test/target_info.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/target_info.py?rev=279552&r1=279551&r2=279552&view=diff
==
--- libcxx/trunk/test/libcxx/test/target_info.py (original)
+++ libcxx/trunk/test/libcxx/test/target_info.py Tue Aug 23 14:25:12 2016
@@ -180,7 +180,8 @@ class LinuxLocalTI(DefaultTargetInfo):
 if llvm_unwinder:
 flags += ['-lunwind', '-ldl']
 else:
-flags += ['-lgcc_s', '-lgcc']
+flags += ['-lgcc_s']
+flags += ['-lgcc']
 use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
 if use_libatomic:
 flags += ['-latomic']


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


[PATCH] D12708: [PATCH] [AArch64] Enable memory sanitizer on clang

2015-09-08 Thread Adhemerval Zanella via cfe-commits
zatrazz created this revision.
zatrazz added reviewers: t.p.northover, aemerson, pcc, rengolin.
zatrazz added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

This patch enables MSan for aarch64/linux.

http://reviews.llvm.org/D12708

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3736,7 +3736,7 @@
 Res |= SanitizerKind::Leak;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;
-  if (IsX86_64 || IsMIPS64 || IsPowerPC64)
+  if (IsX86_64 || IsMIPS64 || IsPowerPC64 || IsAArch64)
 Res |= SanitizerKind::Memory;
   if (IsX86 || IsX86_64) {
 Res |= SanitizerKind::Function;


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3736,7 +3736,7 @@
 Res |= SanitizerKind::Leak;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;
-  if (IsX86_64 || IsMIPS64 || IsPowerPC64)
+  if (IsX86_64 || IsMIPS64 || IsPowerPC64 || IsAArch64)
 Res |= SanitizerKind::Memory;
   if (IsX86 || IsX86_64) {
 Res |= SanitizerKind::Function;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r247808 - [sanitizers] Enable memory sanitizer on clang

2015-09-16 Thread Adhemerval Zanella via cfe-commits
Author: azanella
Date: Wed Sep 16 10:11:21 2015
New Revision: 247808

URL: http://llvm.org/viewvc/llvm-project?rev=247808&view=rev
Log:
[sanitizers] Enable memory sanitizer on clang

This patch enables MSan for aarch64/linux

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=247808&r1=247807&r2=247808&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Sep 16 10:11:21 2015
@@ -3761,7 +3761,7 @@ SanitizerMask Linux::getSupportedSanitiz
 Res |= SanitizerKind::Leak;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;
-  if (IsX86_64 || IsMIPS64 || IsPowerPC64)
+  if (IsX86_64 || IsMIPS64 || IsPowerPC64 || IsAArch64)
 Res |= SanitizerKind::Memory;
   if (IsX86 || IsX86_64) {
 Res |= SanitizerKind::Function;


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


[PATCH] D13109: [sanitizer] Enable lsan for AArch64

2015-09-23 Thread Adhemerval Zanella via cfe-commits
zatrazz created this revision.
zatrazz added reviewers: rengolin, pcc, aemerson, t.p.northover.
zatrazz added a subscriber: cfe-commits.
Herald added subscribers: rengolin, aemerson.

compiler-rt related patch: http://reviews.llvm.org/D13108

http://reviews.llvm.org/D13109

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3760,7 +3760,7 @@
   Res |= SanitizerKind::Vptr;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::DataFlow;
-  if (IsX86_64 || IsMIPS64)
+  if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Leak;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3760,7 +3760,7 @@
   Res |= SanitizerKind::Vptr;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::DataFlow;
-  if (IsX86_64 || IsMIPS64)
+  if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Leak;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r249338 - [sanitizer] Enable lsan for AArch64

2015-10-05 Thread Adhemerval Zanella via cfe-commits
Author: azanella
Date: Mon Oct  5 14:16:42 2015
New Revision: 249338

URL: http://llvm.org/viewvc/llvm-project?rev=249338&view=rev
Log:
[sanitizer] Enable lsan for AArch64

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=249338&r1=249337&r2=249338&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct  5 14:16:42 2015
@@ -3803,7 +3803,7 @@ SanitizerMask Linux::getSupportedSanitiz
   Res |= SanitizerKind::SafeStack;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::DataFlow;
-  if (IsX86_64 || IsMIPS64)
+  if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Leak;
   if (IsX86_64 || IsMIPS64 || IsAArch64)
 Res |= SanitizerKind::Thread;


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


[PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-11 Thread Adhemerval Zanella via cfe-commits
zatrazz created this revision.
zatrazz added reviewers: jroelofs, danalbert.
zatrazz added subscribers: rengolin, cfe-commits.
Herald added a subscriber: aemerson.

Some tests uses 'long double' to/from conversions and for some targets
they are provided by compiler runtime (either compiler-rt or libgcc).
However when building libcxx with linunwinder current test configuration
at target_info.py do not include the required libraries, as:

  not llvm_unwinder:
[-lgcc_s] [-lgcc] [...] [-lgcc_s] [-lgcc]

  llvm_unwinder
[-lunwind] [-ldl]

This causes some tests build issues with missing symbols on aarch64,
for instance, where 'long double' is a binary float with 128-bits with
mostly of internal operations being provided by software routines.

This patch changes how to define the default linker flags by:

  not llvm_unwinder:
[-lgcc_s] [-lgcc]

  llvm_unwinder
[-lunwind] [-ldl] [-lgcc_s] [-lgcc]

I checked and aarch64 and x86_64 with libcxx and libunwind (with and without
LIBCXXABI_USE_LLVM_UNWINDER).

https://reviews.llvm.org/D23420

Files:
  test/libcxx/test/target_info.py

Index: test/libcxx/test/target_info.py
===
--- test/libcxx/test/target_info.py
+++ test/libcxx/test/target_info.py
@@ -170,17 +170,14 @@
 llvm_unwinder = self.full_config.get_lit_bool('llvm_unwinder', False)
 shared_libcxx = self.full_config.get_lit_bool('enable_shared', True)
 flags += ['-lm']
-if not llvm_unwinder:
-flags += ['-lgcc_s', '-lgcc']
 if enable_threads:
 flags += ['-lpthread']
 if not shared_libcxx:
   flags += ['-lrt']
 flags += ['-lc']
 if llvm_unwinder:
 flags += ['-lunwind', '-ldl']
-else:
-flags += ['-lgcc_s', '-lgcc']
+flags += ['-lgcc_s', '-lgcc']
 use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
 if use_libatomic:
 flags += ['-latomic']


Index: test/libcxx/test/target_info.py
===
--- test/libcxx/test/target_info.py
+++ test/libcxx/test/target_info.py
@@ -170,17 +170,14 @@
 llvm_unwinder = self.full_config.get_lit_bool('llvm_unwinder', False)
 shared_libcxx = self.full_config.get_lit_bool('enable_shared', True)
 flags += ['-lm']
-if not llvm_unwinder:
-flags += ['-lgcc_s', '-lgcc']
 if enable_threads:
 flags += ['-lpthread']
 if not shared_libcxx:
   flags += ['-lrt']
 flags += ['-lc']
 if llvm_unwinder:
 flags += ['-lunwind', '-ldl']
-else:
-flags += ['-lgcc_s', '-lgcc']
+flags += ['-lgcc_s', '-lgcc']
 use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
 if use_libatomic:
 flags += ['-latomic']
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-11 Thread Adhemerval Zanella via cfe-commits
zatrazz added a comment.

I tried to find why exactly libgcc has to appear before and after but I 
couldn't get any information from commit history. On my system (aarch64/linux) 
I am also getting "-lc++" "-lm" "-lgcc_s" "-lgcc" "-lpthread" "-lc" "-lgcc_s" 
"-lgcc".

I think we can got by the safe side and just add the final libgcc at the end 
for the soft-fp symbols.


https://reviews.llvm.org/D23420



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


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-12 Thread Adhemerval Zanella via cfe-commits
zatrazz updated this revision to Diff 67835.
zatrazz added a comment.

What about this version? The only difference is for libunwind libgcc is still 
included.


https://reviews.llvm.org/D23420

Files:
  test/libcxx/test/target_info.py

Index: test/libcxx/test/target_info.py
===
--- test/libcxx/test/target_info.py
+++ test/libcxx/test/target_info.py
@@ -179,8 +179,7 @@
 flags += ['-lc']
 if llvm_unwinder:
 flags += ['-lunwind', '-ldl']
-else:
-flags += ['-lgcc_s', '-lgcc']
+flags += ['-lgcc_s', '-lgcc']
 use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
 if use_libatomic:
 flags += ['-latomic']


Index: test/libcxx/test/target_info.py
===
--- test/libcxx/test/target_info.py
+++ test/libcxx/test/target_info.py
@@ -179,8 +179,7 @@
 flags += ['-lc']
 if llvm_unwinder:
 flags += ['-lunwind', '-ldl']
-else:
-flags += ['-lgcc_s', '-lgcc']
+flags += ['-lgcc_s', '-lgcc']
 use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
 if use_libatomic:
 flags += ['-latomic']
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D23449: libcxx: Fix path.compare.pass expected result

2016-08-12 Thread Adhemerval Zanella via cfe-commits
zatrazz created this revision.
zatrazz added reviewers: jroelofs, danalbert, EricWF.
zatrazz added subscribers: rmaprath, aemerson, rengolin, cfe-commits.

The expected 'filesystem::path::compare' result states that for different
only the sign of result integer contains the information about passed
arguments.  This is because it uses the output of other compare function
(basic_string_view and char_traits) without further handling and
char_traits uses memcmp for final buffer comparison.

However for GLIBC on AArch64 the code:

  int ret = memcmp ("b/a/c", "a/b/c", 1);

Results in '64' where for x86_64 it results in '1'.

This patch fixes the expected 'filesystem::path::compare' by normalizing
all the results before assert comparison.

https://reviews.llvm.org/D23449

Files:
  test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp

Index: 
test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
===
--- 
test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
+++ 
test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
@@ -73,6 +73,11 @@
 #undef LONGC
 #undef LONGD
 
+static inline int normalize_ret(int ret)
+{
+  return ret < 0 ? -1 : (ret > 0 ? 1 : 0);
+}
+
 int main()
 {
   using namespace fs;
@@ -86,13 +91,12 @@
   DisableAllocationGuard g; // none of these operations should allocate
 
   // check runtime results
-  int ret1 = p1.compare(p2);
-  int ret2 = p1.compare(R);
-  int ret3 = p1.compare(TC.RHS);
-  int ret4 = p1.compare(RV);
+  int ret1 = normalize_ret(p1.compare(p2));
+  int ret2 = normalize_ret(p1.compare(R));
+  int ret3 = normalize_ret(p1.compare(TC.RHS));
+  int ret4 = normalize_ret(p1.compare(RV));
   assert(ret1 == ret2 && ret1 == ret3 && ret1 == ret4);
-  int normalized_ret = ret1 < 0 ? -1 : (ret1 > 0 ? 1 : 0);
-  assert(normalized_ret == E);
+  assert(ret1 == E);
 
   // check signatures
   ASSERT_NOEXCEPT(p1.compare(p2));


Index: test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
===
--- test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
+++ test/std/experimental/filesystem/class.path/path.member/path.compare.pass.cpp
@@ -73,6 +73,11 @@
 #undef LONGC
 #undef LONGD
 
+static inline int normalize_ret(int ret)
+{
+  return ret < 0 ? -1 : (ret > 0 ? 1 : 0);
+}
+
 int main()
 {
   using namespace fs;
@@ -86,13 +91,12 @@
   DisableAllocationGuard g; // none of these operations should allocate
 
   // check runtime results
-  int ret1 = p1.compare(p2);
-  int ret2 = p1.compare(R);
-  int ret3 = p1.compare(TC.RHS);
-  int ret4 = p1.compare(RV);
+  int ret1 = normalize_ret(p1.compare(p2));
+  int ret2 = normalize_ret(p1.compare(R));
+  int ret3 = normalize_ret(p1.compare(TC.RHS));
+  int ret4 = normalize_ret(p1.compare(RV));
   assert(ret1 == ret2 && ret1 == ret3 && ret1 == ret4);
-  int normalized_ret = ret1 < 0 ? -1 : (ret1 > 0 ? 1 : 0);
-  assert(normalized_ret == E);
+  assert(ret1 == E);
 
   // check signatures
   ASSERT_NOEXCEPT(p1.compare(p2));
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-12 Thread Adhemerval Zanella via cfe-commits
zatrazz added a comment.

Yes, but my understaning is the proposed link order will force libc++ to link 
against _Unwind* symbols from libunwind (this is what I am observing also).


https://reviews.llvm.org/D23420



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


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-12 Thread Adhemerval Zanella via cfe-commits
zatrazz added a comment.

Yes, although in pratice for shared libraries this is not an issue (at least on 
Linux with current linker strategies). And I open for suggestion on how to 
proceed in this case since we have some other options:

1. Add the required soft-sp implementations when building for Linux (this might 
happen not only on aarch64, but any other ABI that defines long double using 
fallback soft-fp)
2. Remove the possible soft-fp usages on all the tests. However this will lead 
to possible remove *all* the FP cases if libcxx should be used in a pure 
soft-fp platform
3. Only allows the libcxx + linunwind to be built against compiler-rt


https://reviews.llvm.org/D23420



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


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-12 Thread Adhemerval Zanella via cfe-commits
zatrazz added a comment.

In https://reviews.llvm.org/D23420#513824, @jroelofs wrote:

> In https://reviews.llvm.org/D23420#513820, @zatrazz wrote:
>
> > Yes, although in pratice for shared libraries this is not an issue (at 
> > least on Linux with current linker strategies). And I open for suggestion 
> > on how to proceed in this case since we have some other options:
> >
> > 1. Add the required soft-sp implementations when building for Linux (this 
> > might happen not only on aarch64, but any other ABI that defines long 
> > double using fallback soft-fp)
>
>
> Are the softfp symbols you need not contained in libgcc.a?


Good call, I think just using 'lgcc' should be suffice. I will change the patch.


https://reviews.llvm.org/D23420



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


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-12 Thread Adhemerval Zanella via cfe-commits
zatrazz updated this revision to Diff 67850.
zatrazz added a comment.

I think patch should be safe now.


https://reviews.llvm.org/D23420

Files:
  test/libcxx/test/target_info.py

Index: test/libcxx/test/target_info.py
===
--- test/libcxx/test/target_info.py
+++ test/libcxx/test/target_info.py
@@ -180,7 +180,8 @@
 if llvm_unwinder:
 flags += ['-lunwind', '-ldl']
 else:
-flags += ['-lgcc_s', '-lgcc']
+flags += ['-lgcc_s']
+flags += ['-lgcc']
 use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
 if use_libatomic:
 flags += ['-latomic']


Index: test/libcxx/test/target_info.py
===
--- test/libcxx/test/target_info.py
+++ test/libcxx/test/target_info.py
@@ -180,7 +180,8 @@
 if llvm_unwinder:
 flags += ['-lunwind', '-ldl']
 else:
-flags += ['-lgcc_s', '-lgcc']
+flags += ['-lgcc_s']
+flags += ['-lgcc']
 use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
 if use_libatomic:
 flags += ['-latomic']
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23449: libcxx: Fix path.compare.pass expected result

2016-08-15 Thread Adhemerval Zanella via cfe-commits
zatrazz added a comment.

Ping.


https://reviews.llvm.org/D23449



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


Re: [PATCH] D23420: libcxx: Fix libcxx test on aarch64 with libunwind

2016-08-15 Thread Adhemerval Zanella via cfe-commits
zatrazz added a comment.

Ping.


https://reviews.llvm.org/D23420



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


[PATCH] D61392: [clang] Handle lround/llround builtins

2019-05-01 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz created this revision.
zatrazz added reviewers: efriedma, rengolin, javed.absar, huntergr, 
SjoerdMeijer, t.p.northover, echristo, evandro.
zatrazz added a project: clang.
Herald added subscribers: kristina, kristof.beyls.

As for other floating-point rounding builtins that can be optimized
when build with -fno-math-errno, this patch adds support for lround
and llround.  It currently only optimized for AArch64 backend.

This patch depends on https://reviews.llvm.org/D61390


Repository:
  rC Clang

https://reviews.llvm.org/D61392

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins.c
  clang/test/CodeGen/math-builtins.c
  clang/test/CodeGen/math-libcalls.c

Index: clang/test/CodeGen/math-libcalls.c
===
--- clang/test/CodeGen/math-libcalls.c
+++ clang/test/CodeGen/math-libcalls.c
@@ -317,9 +317,9 @@
 
   llround(f);llroundf(f);   llroundl(f);
 
-// NO__ERRNO: declare i64 @llround(double) [[READNONE]]
-// NO__ERRNO: declare i64 @llroundf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @llroundl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.llround.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llround.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llround.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @llround(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llroundf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llroundl(x86_fp80) [[NOT_READNONE]]
@@ -380,9 +380,9 @@
 
   lround(f); lroundf(f);lroundl(f);
 
-// NO__ERRNO: declare i64 @lround(double) [[READNONE]]
-// NO__ERRNO: declare i64 @lroundf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @lroundl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.lround.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lround.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lround.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @lround(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lroundf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lroundl(x86_fp80) [[NOT_READNONE]]
Index: clang/test/CodeGen/math-builtins.c
===
--- clang/test/CodeGen/math-builtins.c
+++ clang/test/CodeGen/math-builtins.c
@@ -362,9 +362,9 @@
 
   __builtin_llround(f);__builtin_llroundf(f);   __builtin_llroundl(f);
 
-// NO__ERRNO: declare i64 @llround(double) [[READNONE]]
-// NO__ERRNO: declare i64 @llroundf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @llroundl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.llround.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llround.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llround.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @llround(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llroundf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llroundl(x86_fp80) [[NOT_READNONE]]
@@ -425,9 +425,9 @@
 
   __builtin_lround(f); __builtin_lroundf(f);__builtin_lroundl(f);
 
-// NO__ERRNO: declare i64 @lround(double) [[READNONE]]
-// NO__ERRNO: declare i64 @lroundf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @lroundl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.lround.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lround.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lround.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @lround(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lroundf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lroundl(x86_fp80) [[NOT_READNONE]]
Index: clang/test/CodeGen/builtins.c
===
--- clang/test/CodeGen/builtins.c
+++ clang/test/CodeGen/builtins.c
@@ -256,6 +256,8 @@
   volatile float resf;
   volatile double resd;
   volatile long double resld;
+  volatile long int resli;
+  volatile long long int reslli;
 
   resf = __builtin_fmodf(F,F);
   // CHECK: frem float
@@ -380,6 +382,14 @@
   resld = __builtin_roundl(LD);
   // CHECK: call x86_fp80 @llvm.round.f80
 
+  resli = __builtin_lroundf (F);
+  // CHECK: call i64 @llvm.lround.i64.f32
+
+  resli = __builtin_lround (D);
+  // CHECK: call i64 @llvm.lround.i64.f64
+
+  resli = __builtin_lroundl (LD);
+  // CHECK: call i64 @llvm.lround.i64.f80
 }
 
 // __builtin_longjmp isn't supported on all platforms, so only test it on X86.
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -1721,6 +1721,27 @@
 case Builtin::BI__builtin_truncl:
   return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::trunc));
 
+case Builtin::BIlround:
+case Builtin::BIlroundf:
+case Builtin::BIlroundl:
+case Bui

[PATCH] D62019: [clang] Handle lrint/llrint builtins

2019-05-16 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz created this revision.
zatrazz added reviewers: efriedma, rengolin, javed.absar, huntergr, 
SjoerdMeijer, t.p.northover, echristo, evandro.
zatrazz added a project: clang.
Herald added subscribers: kristina, kristof.beyls.

As for other floating-point rounding builtins that can be optimized
when build with -fno-math-errno, this patch adds support for lrint
and llrint.  It currently only optimize for AArch64 backend.

This patch depends on https://reviews.llvm.org/D62017.


Repository:
  rC Clang

https://reviews.llvm.org/D62019

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins.c
  clang/test/CodeGen/math-builtins.c
  clang/test/CodeGen/math-libcalls.c

Index: clang/test/CodeGen/math-libcalls.c
===
--- clang/test/CodeGen/math-libcalls.c
+++ clang/test/CodeGen/math-libcalls.c
@@ -308,9 +308,9 @@
 
   llrint(f); llrintf(f);llrintl(f);
 
-// NO__ERRNO: declare i64 @llrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.llrint.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llrint.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llrint.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @llrint(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llrintf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llrintl(x86_fp80) [[NOT_READNONE]]
@@ -371,9 +371,9 @@
 
   lrint(f);  lrintf(f); lrintl(f);
 
-// NO__ERRNO: declare i64 @lrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @lrintf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @lrintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @lrint(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lrintf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lrintl(x86_fp80) [[NOT_READNONE]]
Index: clang/test/CodeGen/math-builtins.c
===
--- clang/test/CodeGen/math-builtins.c
+++ clang/test/CodeGen/math-builtins.c
@@ -353,9 +353,9 @@
 
   __builtin_llrint(f); __builtin_llrintf(f);__builtin_llrintl(f);
 
-// NO__ERRNO: declare i64 @llrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.llrint.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llrint.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llrint.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @llrint(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llrintf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llrintl(x86_fp80) [[NOT_READNONE]]
@@ -416,9 +416,9 @@
 
   __builtin_lrint(f);  __builtin_lrintf(f); __builtin_lrintl(f);
 
-// NO__ERRNO: declare i64 @lrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @lrintf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @lrintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @lrint(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lrintf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lrintl(x86_fp80) [[NOT_READNONE]]
Index: clang/test/CodeGen/builtins.c
===
--- clang/test/CodeGen/builtins.c
+++ clang/test/CodeGen/builtins.c
@@ -390,6 +390,15 @@
 
   resli = __builtin_lroundl (LD);
   // CHECK: call i64 @llvm.lround.i64.f80
+
+  resli = __builtin_lrintf (F);
+  // CHECK: call i64 @llvm.lrint.i64.f32
+
+  resli = __builtin_lrint (D);
+  // CHECK: call i64 @llvm.lrint.i64.f64
+
+  resli = __builtin_lrintl (LD);
+  // CHECK: call i64 @llvm.lrint.i64.f80
 }
 
 // __builtin_longjmp isn't supported on all platforms, so only test it on X86.
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -1742,6 +1742,27 @@
 case Builtin::BI__builtin_llroundl:
   return RValue::get(emitUnaryBuiltin(*this, E, Intrinsic::llround));
 
+case Builtin::BIlrint:
+case Builtin::BIlrintf:
+case Builtin::BIlrintl:
+case Builtin::BI__builtin_lrint:
+case Builtin::BI__builtin_lrintf:
+case Builtin::BI__builtin_lrintl: {
+  llvm::Type *ResultType = ConvertType(E->getType());
+  int Width = ResultType->getPrimitiveSizeInBits();
+  return RValue::get(emitUnaryBuiltin

[PATCH] D62019: [clang] Handle lrint/llrint builtins

2019-05-20 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz updated this revision to Diff 200291.
zatrazz added a comment.

Updated patch based on D62026 .


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

https://reviews.llvm.org/D62019

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins.c
  clang/test/CodeGen/math-builtins.c
  clang/test/CodeGen/math-libcalls.c

Index: clang/test/CodeGen/math-libcalls.c
===
--- clang/test/CodeGen/math-libcalls.c
+++ clang/test/CodeGen/math-libcalls.c
@@ -308,9 +308,9 @@
 
   llrint(f); llrintf(f);llrintl(f);
 
-// NO__ERRNO: declare i64 @llrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.llrint.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llrint.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @llrint(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llrintf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llrintl(x86_fp80) [[NOT_READNONE]]
@@ -371,9 +371,9 @@
 
   lrint(f);  lrintf(f); lrintl(f);
 
-// NO__ERRNO: declare i64 @lrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @lrintf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @lrintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @lrint(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lrintf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lrintl(x86_fp80) [[NOT_READNONE]]
Index: clang/test/CodeGen/math-builtins.c
===
--- clang/test/CodeGen/math-builtins.c
+++ clang/test/CodeGen/math-builtins.c
@@ -353,9 +353,9 @@
 
   __builtin_llrint(f); __builtin_llrintf(f);__builtin_llrintl(f);
 
-// NO__ERRNO: declare i64 @llrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @llrintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.llrint.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llrint.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.llrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @llrint(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llrintf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @llrintl(x86_fp80) [[NOT_READNONE]]
@@ -416,9 +416,9 @@
 
   __builtin_lrint(f);  __builtin_lrintf(f); __builtin_lrintl(f);
 
-// NO__ERRNO: declare i64 @lrint(double) [[READNONE]]
-// NO__ERRNO: declare i64 @lrintf(float) [[READNONE]]
-// NO__ERRNO: declare i64 @lrintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare i64 @llvm.lrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare i64 @lrint(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lrintf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare i64 @lrintl(x86_fp80) [[NOT_READNONE]]
Index: clang/test/CodeGen/builtins.c
===
--- clang/test/CodeGen/builtins.c
+++ clang/test/CodeGen/builtins.c
@@ -390,6 +390,15 @@
 
   resli = __builtin_lroundl (LD);
   // CHECK: call i64 @llvm.lround.i64.f80
+
+  resli = __builtin_lrintf (F);
+  // CHECK: call i64 @llvm.lrint.i64.f32
+
+  resli = __builtin_lrint (D);
+  // CHECK: call i64 @llvm.lrint.i64.f64
+
+  resli = __builtin_lrintl (LD);
+  // CHECK: call i64 @llvm.lrint.i64.f80
 }
 
 // __builtin_longjmp isn't supported on all platforms, so only test it on X86.
Index: clang/lib/CodeGen/CGBuiltin.cpp
===
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -1749,6 +1749,22 @@
 case Builtin::BI__builtin_llroundl:
   return RValue::get(emitFPToIntRoundBuiltin(*this, E, Intrinsic::llround));
 
+case Builtin::BIlrint:
+case Builtin::BIlrintf:
+case Builtin::BIlrintl:
+case Builtin::BI__builtin_lrint:
+case Builtin::BI__builtin_lrintf:
+case Builtin::BI__builtin_lrintl:
+  return RValue::get(emitFPToIntRoundBuiltin(*this, E, Intrinsic::lrint));
+
+case Builtin::BIllrint:
+case Builtin::BIllrintf:
+case Builtin::BIllrintl:
+case Builtin::BI__builtin_llrint:
+case Builtin::BI__builtin_llrintf:
+case Builtin::BI__builtin_llrintl:
+  return RValue::get(emitFPToIntRoundBuiltin(*this, E, Intrinsic::llrint));
+
 default:
   break;
 }
__

[PATCH] D131307: [Clang] Allow downgrading to a warning the diagnostic for setting a non fixed enum to a value outside the range of the enumeration values

2022-08-09 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz added a comment.

This commit seems to have broken test-suite on aarch64 [1]. The warning shows:

  FAILED: MultiSource/Benchmarks/PAQ8p/CMakeFiles/paq8p.dir/paq8p.cpp.o
  /home/adhemerval.zanella/projects/llvm/test-suite-build/tools/timeit 
--summary MultiSource/Benchmarks/PAQ8p/CMakeFiles/paq8p.dir/paq8p.cpp.o.time 
/home/adhemerval.zanella/projects/llvm/llvm-src-build-stage1-buildbot/bin/clang++
 -DNDEBUG  -O3 -DNDEBUG   -w -Werror=date-time -DNOASM -DLLVM -MD -MT 
MultiSource/Benchmarks/PAQ8p/CMakeFiles/paq8p.dir/paq8p.cpp.o -MF 
MultiSource/Benchmarks/PAQ8p/CMakeFiles/paq8p.dir/paq8p.cpp.o.d -o 
MultiSource/Benchmarks/PAQ8p/CMakeFiles/paq8p.dir/paq8p.cpp.o -c 
/home/adhemerval.zanella/projects/llvm/test-suite/MultiSource/Benchmarks/PAQ8p/paq8p.cpp
  
/home/adhemerval.zanella/projects/llvm/test-suite/MultiSource/Benchmarks/PAQ8p/paq8p.cpp:3606:24:
 error: integer value -1 is outside the valid range of values [0, 15] for this 
enumeration type [-Wenum-constexpr-conversion]
  if (c==EOF) return (Filetype)(-1);
 ^
  1 error generated.

I am not sure if this is an existing issue with test-suite.

[1] https://lab.llvm.org/staging/#/builders/158/builds/344


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131307

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


[PATCH] D131528: [Clang] Restrict non fixed enum to a value outside the range of the enumeration values warning to context requiring a constant expression

2022-08-10 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz added a comment.

It does help on test-suite, thanks.


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

https://reviews.llvm.org/D131528

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


[PATCH] D71111: [Sema] Improve diagnostic about addr spaces for overload candidates

2019-12-30 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz added a comment.

Hi,

I am investigating a recurring regression on aarch64-linux bots and bisecting 
the commits on the build [1] that introduced the regression it points to this 
one. I don't understand exactly what is triggering the issue, but it only 
happen on the stage2 build with stage1 clang built with different compilers 
(gcc 5.4, gcc-7.4.0, and gcc-8.3.0). The issue is on clang itself while trying 
to execute the Analysis/uninit-sometimes.cpp test:

   TEST 'Clang :: Analysis/uninit-sometimes.cpp' FAILED 

  Script:
  --
  : 'RUN: at line 1';   
/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/bin/clang -cc1 
-internal-isystem 
/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/lib/clang/10.0.0/include
 -nostdsysteminc -std=gnu++11 -Wsometimes-uninitialized -verify 
/home/buildslave/buildslave/clang-cmake-aarch64-full/llvm/clang/test/Analysis/uninit-sometimes.cpp
  : 'RUN: at line 2';   
/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/bin/clang -cc1 
-internal-isystem 
/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/lib/clang/10.0.0/include
 -nostdsysteminc -std=gnu++11 -Wsometimes-uninitialized 
-fdiagnostics-parseable-fixits 
/home/buildslave/buildslave/clang-cmake-aarch64-full/llvm/clang/test/Analysis/uninit-sometimes.cpp
 2>&1 | 
/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/bin/FileCheck 
/home/buildslave/buildslave/clang-cmake-aarch64-full/llvm/clang/test/Analysis/uninit-sometimes.cpp
  --
  Exit Code: 134
  
  Command Output (stderr):
  --
  clang: 
/home/buildslave/buildslave/clang-cmake-aarch64-full/llvm/clang/lib/Basic/Diagnostic.cpp:591:
 void HandleSelectModifier(const clang::Diagnostic &, unsigned int, const char 
*, unsigned int, SmallVectorImpl &): Assertion `NextVal != ArgumentEnd && 
"Value for integer select modifier was" " larger than the number of options in 
the diagnostic string!"' failed.
  Stack dump:
  0.Program arguments: 
/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/bin/clang -cc1 
-internal-isystem 
/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/lib/clang/10.0.0/include
 -nostdsysteminc -std=gnu++11 -Wsometimes-uninitialized -verify 
/home/buildslave/buildslave/clang-cmake-aarch64-full/llvm/clang/test/Analysis/uninit-sometimes.cpp
 
  1.
/home/buildslave/buildslave/clang-cmake-aarch64-full/llvm/clang/test/Analysis/uninit-sometimes.cpp:161:1:
 current parser token 'int'
  2.
/home/buildslave/buildslave/clang-cmake-aarch64-full/llvm/clang/test/Analysis/uninit-sometimes.cpp:146:32:
 parsing function body 'test_for_range_true'
  #0 0x0182be04 PrintStackTraceSignalHandler(void*) 
(/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/bin/clang+0x182be04)
  
/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/tools/clang/test/Analysis/Output/uninit-sometimes.cpp.script:
 line 2: 63297 Aborted (core dumped) 
/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/bin/clang -cc1 
-internal-isystem 
/home/buildslave/buildslave/clang-cmake-aarch64-full/stage2/lib/clang/10.0.0/include
 -nostdsysteminc -std=gnu++11 -Wsometimes-uninitialized -verify 
/home/buildslave/buildslave/clang-cmake-aarch64-full/llvm/clang/test/Analysis/uninit-sometimes.cpp

The bots run a ubuntu 16.04 container and I can't reproduce on a different one, 
I am still trying to come up with a better reproduce case. Also, moving the 
both DiagnosticBuilder::AddString and DiagnosticBuilder::AddTaggedVal outside 
clang/include/clang/Basic/Diagnostic.h to clang/lib/Basic/Diagnostic.cpp 
"fixes" the issue (indicating the something is wrong at code generation). This 
issue has been shown for some time on aarch64-linux bot [2]. Any idea if this 
is an environmental issue or a real issue?

[1] http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/8562
[2] http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D7



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


[PATCH] D72449: [PATCH] [llvm-ranlib] Take in consideration UTC offset for D-flag.test

2020-01-09 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz created this revision.
zatrazz added reviewers: arichardson, emaste, rupprecht.
Herald added a subscriber: kristof.beyls.
Herald added a project: LLVM.

The llvm-ar uses localtime to print the object timestamp and it is
subject to UTC offset (daylight for instance).  The patch changes
the test to check against output of a 'date' command.

It fixes the D-flag.test failure on some aarch64 and arm bots,
which are situated on GMT with currently BST timezone.


https://reviews.llvm.org/D72449

Files:
  llvm/test/tools/llvm-ranlib/D-flag.test


Index: llvm/test/tools/llvm-ranlib/D-flag.test
===
--- llvm/test/tools/llvm-ranlib/D-flag.test
+++ llvm/test/tools/llvm-ranlib/D-flag.test
@@ -10,7 +10,7 @@
 
 ## Check that the -D flag clears the timestamps:
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -D %t.a
-# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s 
--check-prefix=DETERMINISTIC-VALUES
+# RUN: (env TZ=UTC date -d '@0' +%H:%M; env TZ=UTC llvm-ar tv %t.a) | 
FileCheck %s --check-prefix=DETERMINISTIC-VALUES
 
 ## Check that the -U flag maintains the timestamps:
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -U %t.a
@@ -41,5 +41,8 @@
 # RUN: not llvm-ranlib -DxD %t.a 2>&1 | FileCheck %s --check-prefix=BAD-OPT-xD
 # BAD-OPT-xD: error: Invalid option: '-xD'
 
-# DETERMINISTIC-VALUES: {{[rwx-]+}} 0/0712 Jan  1 00:00 1970 
D-flag.test.tmp.o
+## llvm-ar uses localtime to print the object timestamp and it is subject to
+## UTC offset (daylight for instance).
+# DETERMINISTIC-VALUES: [[HHMM:[0-9]+:[0-9]+]]
+# DETERMINISTIC-VALUES: {{[rwx-]+}} 0/0712 Jan  1 [[HHMM]] 1970 
D-flag.test.tmp.o
 # REAL-VALUES: {{[rwx-]+}} {{[0-9]+}}/{{[0-9]+}} 712 Jan  2 03:04 2000 
D-flag.test.tmp.o


Index: llvm/test/tools/llvm-ranlib/D-flag.test
===
--- llvm/test/tools/llvm-ranlib/D-flag.test
+++ llvm/test/tools/llvm-ranlib/D-flag.test
@@ -10,7 +10,7 @@
 
 ## Check that the -D flag clears the timestamps:
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -D %t.a
-# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=DETERMINISTIC-VALUES
+# RUN: (env TZ=UTC date -d '@0' +%H:%M; env TZ=UTC llvm-ar tv %t.a) | FileCheck %s --check-prefix=DETERMINISTIC-VALUES
 
 ## Check that the -U flag maintains the timestamps:
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -U %t.a
@@ -41,5 +41,8 @@
 # RUN: not llvm-ranlib -DxD %t.a 2>&1 | FileCheck %s --check-prefix=BAD-OPT-xD
 # BAD-OPT-xD: error: Invalid option: '-xD'
 
-# DETERMINISTIC-VALUES: {{[rwx-]+}} 0/0712 Jan  1 00:00 1970 D-flag.test.tmp.o
+## llvm-ar uses localtime to print the object timestamp and it is subject to
+## UTC offset (daylight for instance).
+# DETERMINISTIC-VALUES: [[HHMM:[0-9]+:[0-9]+]]
+# DETERMINISTIC-VALUES: {{[rwx-]+}} 0/0712 Jan  1 [[HHMM]] 1970 D-flag.test.tmp.o
 # REAL-VALUES: {{[rwx-]+}} {{[0-9]+}}/{{[0-9]+}} 712 Jan  2 03:04 2000 D-flag.test.tmp.o
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72449: [PATCH] [llvm-ranlib] Take in consideration UTC offset for D-flag.test

2020-01-09 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz marked 2 inline comments as done.
zatrazz added inline comments.



Comment at: llvm/test/tools/llvm-ranlib/D-flag.test:13
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -D %t.a
-# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s 
--check-prefix=DETERMINISTIC-VALUES
+# RUN: (env TZ=UTC date -d '@0' +%H:%M; env TZ=UTC llvm-ar tv %t.a) | 
FileCheck %s --check-prefix=DETERMINISTIC-VALUES
 

kristof.beyls wrote:
> I wonder if 'date' is available on all platforms that LLVM builds on. For 
> example, is it available on Windows (with GnuWin32 installed, as per the 
> requirements listed at https://llvm.org/docs/GettingStartedVS.html)? 
> http://gnuwin32.sourceforge.net/packages.html doesn't seem to list "date" 
> explicitly?
It is provided by coreutils 
(http://gnuwin32.sourceforge.net/packages/coreutils.htm).



Comment at: llvm/test/tools/llvm-ranlib/D-flag.test:23
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -UUD %t.a
 # RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s 
--check-prefix=DETERMINISTIC-VALUES
 

arichardson wrote:
> Wouldn't this line also have to change?
It does and I updated the patch.


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

https://reviews.llvm.org/D72449



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


[PATCH] D72449: [PATCH] [llvm-ranlib] Take in consideration UTC offset for D-flag.test

2020-01-09 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz updated this revision to Diff 237134.
zatrazz added a comment.

Updated patch based on previous comments.


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

https://reviews.llvm.org/D72449

Files:
  llvm/test/tools/llvm-ranlib/D-flag.test


Index: llvm/test/tools/llvm-ranlib/D-flag.test
===
--- llvm/test/tools/llvm-ranlib/D-flag.test
+++ llvm/test/tools/llvm-ranlib/D-flag.test
@@ -10,7 +10,7 @@
 
 ## Check that the -D flag clears the timestamps:
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -D %t.a
-# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s 
--check-prefix=DETERMINISTIC-VALUES
+# RUN: (env TZ=UTC date -d '@0' +%H:%M; env TZ=UTC llvm-ar tv %t.a) | 
FileCheck %s --check-prefix=DETERMINISTIC-VALUES
 
 ## Check that the -U flag maintains the timestamps:
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -U %t.a
@@ -20,7 +20,7 @@
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -UDU %t.a
 # RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=REAL-VALUES
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -UUD %t.a
-# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s 
--check-prefix=DETERMINISTIC-VALUES
+# RUN: (env TZ=UTC date -d '@0' +%H:%M; env TZ=UTC llvm-ar tv %t.a) | 
FileCheck %s --check-prefix=DETERMINISTIC-VALUES
 
 ## Check arguments can be passed before and after the file name
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -U %t.a -D -U
@@ -41,5 +41,8 @@
 # RUN: not llvm-ranlib -DxD %t.a 2>&1 | FileCheck %s --check-prefix=BAD-OPT-xD
 # BAD-OPT-xD: error: Invalid option: '-xD'
 
-# DETERMINISTIC-VALUES: {{[rwx-]+}} 0/0712 Jan  1 00:00 1970 
D-flag.test.tmp.o
+## llvm-ar uses localtime to print the object timestamp and it is subject to
+## UTC offset (daylight for instance).
+# DETERMINISTIC-VALUES: [[HHMM:[0-9]+:[0-9]+]]
+# DETERMINISTIC-VALUES: {{[rwx-]+}} 0/0712 Jan  1 [[HHMM]] 1970 
D-flag.test.tmp.o
 # REAL-VALUES: {{[rwx-]+}} {{[0-9]+}}/{{[0-9]+}} 712 Jan  2 03:04 2000 
D-flag.test.tmp.o


Index: llvm/test/tools/llvm-ranlib/D-flag.test
===
--- llvm/test/tools/llvm-ranlib/D-flag.test
+++ llvm/test/tools/llvm-ranlib/D-flag.test
@@ -10,7 +10,7 @@
 
 ## Check that the -D flag clears the timestamps:
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -D %t.a
-# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=DETERMINISTIC-VALUES
+# RUN: (env TZ=UTC date -d '@0' +%H:%M; env TZ=UTC llvm-ar tv %t.a) | FileCheck %s --check-prefix=DETERMINISTIC-VALUES
 
 ## Check that the -U flag maintains the timestamps:
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -U %t.a
@@ -20,7 +20,7 @@
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -UDU %t.a
 # RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=REAL-VALUES
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -UUD %t.a
-# RUN: env TZ=UTC llvm-ar tv %t.a | FileCheck %s --check-prefix=DETERMINISTIC-VALUES
+# RUN: (env TZ=UTC date -d '@0' +%H:%M; env TZ=UTC llvm-ar tv %t.a) | FileCheck %s --check-prefix=DETERMINISTIC-VALUES
 
 ## Check arguments can be passed before and after the file name
 # RUN: cp %t-no-index.a %t.a && llvm-ranlib -U %t.a -D -U
@@ -41,5 +41,8 @@
 # RUN: not llvm-ranlib -DxD %t.a 2>&1 | FileCheck %s --check-prefix=BAD-OPT-xD
 # BAD-OPT-xD: error: Invalid option: '-xD'
 
-# DETERMINISTIC-VALUES: {{[rwx-]+}} 0/0712 Jan  1 00:00 1970 D-flag.test.tmp.o
+## llvm-ar uses localtime to print the object timestamp and it is subject to
+## UTC offset (daylight for instance).
+# DETERMINISTIC-VALUES: [[HHMM:[0-9]+:[0-9]+]]
+# DETERMINISTIC-VALUES: {{[rwx-]+}} 0/0712 Jan  1 [[HHMM]] 1970 D-flag.test.tmp.o
 # REAL-VALUES: {{[rwx-]+}} {{[0-9]+}}/{{[0-9]+}} 712 Jan  2 03:04 2000 D-flag.test.tmp.o
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D72449: [PATCH] [llvm-ranlib] Take in consideration UTC offset for D-flag.test

2020-01-09 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz added a comment.

In D72449#1812130 , @arichardson wrote:

> I was careful in the test to use `TZ=UTC` for all commands printing dates and 
> it works fine for me in UTC+1 and in the UK which is currently UTC. Does the 
> bot in question ignore the TZ variable?


The issue is setting TZ=UTC still might use internal database with UTC offsets. 
For instance, on the buildbot
that accused the regression, setting TZ=UTC make it use the tz database 
/usr/share/zoneinfo/UTC. At least
on Linux with glibc one way to actually use UTC without transit changes are to 
set TZ=":", it won't try to
access either the default '/etc/localtime'. However, I am not sure how portable 
it is and it might be in fact
an glibc issue (https://sourceware.org/bugzilla/show_bug.cgi?id=24004).


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

https://reviews.llvm.org/D72449



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


[PATCH] D72449: [PATCH] [llvm-ranlib] Take in consideration UTC offset for D-flag.test

2020-01-09 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz added a comment.

In D72449#1812818 , @arichardson wrote:

> I'm fine with this workaround although I'm very surprised that the test is 
> not working. Especially since `deterministic-archive.test` and 
> `replace-update.test` also set TZ to get reproducible output
>
> Do you have access to any of the failing bots? If so what happens there if 
> you change the TZ variable?
>  I get the following on all systems I have access to when I run something 
> like `date && date -u && env TZ=CET date && env TZ=CET date -u && env TZ=BST 
> date && env TZ=BST date -u` I get the following output:
>
>   Thu  9 Jan 2020 20:18:10 GMT
>   Thu  9 Jan 2020 20:18:10 UTC
>   Thu  9 Jan 2020 21:18:10 CET
>   Thu  9 Jan 2020 20:18:10 UTC
>   Thu  9 Jan 2020 20:18:10 UTC
>   Thu  9 Jan 2020 20:18:10 UTC
>


I am not sure now if it was something wrong with the bot tzdata, I reinstalled 
the tzdata packages
and reconfigured the timezone and now 'TZ=UTC date -d '@0' +%H:%M' does show 
the expected
00:00.

Indeed, although the workaround shouldn't change the expected result, the issue 
I am observing
on some machine does not make sense (TZ=UTC date -d '@0' +%H:%M' not showing 
00:00).

I will hold this and investigate further.


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

https://reviews.llvm.org/D72449



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


[PATCH] D96803: EntryExitInstrumenter: Move to a module pass and enable at all optimization levels (PR49143)

2021-02-16 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz created this revision.
zatrazz added reviewers: lenary, ostannard, aeubanks.
Herald added a subscriber: hiraditya.
zatrazz requested review of this revision.
Herald added projects: clang, LLVM.

The function passes are disabled by default for optnone with the new
pass manager.  The pass is now enabled in clang backend if the
-finstrument-functions, -finstrument-function-entry-bare, or
-finstrument-functions-after-inlining instead of just for
optimization level different than -O0.

It fixes PR49143 and allows re-enable the eeprof-1.c test from
test-suite (disabled by D96521 ).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96803

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
  llvm/test/Transforms/EntryExitInstrumenter/debug-info.ll
  llvm/test/Transforms/EntryExitInstrumenter/mcount.ll

Index: llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
===
--- llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
+++ llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
@@ -1,7 +1,10 @@
-; RUN: opt -passes="function(ee-instrument),cgscc(inline),function(post-inline-ee-instrument)" -S < %s | FileCheck %s
+; RUN: opt --O0 --ee-instrument --inline --post-inline-ee-instrument -S < %s | FileCheck %s
+
+; Check if the pass is enabbled on both -O0 and higher optimization levels
+; RUN: opt --O2 --ee-instrument --post-inline-ee-instrument -S < %s | FileCheck --check-prefix=OPT %s
 
 ; Running the passes twice should not result in more instrumentation.
-; RUN: opt -passes="function(ee-instrument),function(ee-instrument),cgscc(inline),function(post-inline-ee-instrument),function(post-inline-ee-instrument)" -S < %s | FileCheck %s
+; RUN: opt -passes="ee-instrument,ee-instrument,cgscc(inline),post-inline-ee-instrument,post-inline-ee-instrument" -S < %s | FileCheck %s
 
 target datalayout = "E-m:e-i64:64-n32:64"
 target triple = "powerpc64le-unknown-linux"
@@ -18,6 +21,15 @@
 ; CHECK-NEXT: %1 = call i8* @llvm.returnaddress(i32 0)
 ; CHECK-NEXT: call void @__cyg_profile_func_exit(i8* bitcast (void ()* @leaf_function to i8*), i8* %1)
 ; CHECK-NEXT: ret void
+
+; OPT-LABEL: define void @leaf_function()
+; OPT: entry:
+; OPT-NEXT: call void @mcount()
+; OPT-NEXT: %0 = call i8* @llvm.returnaddress(i32 0)
+; OPT-NEXT: call void @__cyg_profile_func_enter(i8* bitcast (void ()* @leaf_function to i8*), i8* %0)
+; OPT-NEXT: %1 = call i8* @llvm.returnaddress(i32 0)
+; OPT-NEXT: call void @__cyg_profile_func_exit(i8* bitcast (void ()* @leaf_function to i8*), i8* %1)
+; OPT-NEXT: ret void
 }
 
 
@@ -42,6 +54,16 @@
 
 ; CHECK-NEXT: call void @__cyg_profile_func_exit(i8* bitcast (void ()* @root_function to i8*), i8* %3)
 ; CHECK-NEXT: ret void
+
+; OPT-LABEL: define void @root_function()
+; OPT: entry:
+; OPT-NEXT: call void @mcount()
+
+; OPT-NEXT: %0 = call i8* @llvm.returnaddress(i32 0)
+; OPT-NEXT: call void @__cyg_profile_func_enter(i8* bitcast (void ()* @root_function to i8*), i8* %0)
+; OPT-NEXT: %1 = call i8* @llvm.returnaddress(i32 0)
+; OPT-NEXT: call void @__cyg_profile_func_exit(i8* bitcast (void ()* @root_function to i8*), i8* %1)
+; OPT-NEXT: ret void
 }
 
 
Index: llvm/test/Transforms/EntryExitInstrumenter/debug-info.ll
===
--- llvm/test/Transforms/EntryExitInstrumenter/debug-info.ll
+++ llvm/test/Transforms/EntryExitInstrumenter/debug-info.ll
@@ -1,4 +1,4 @@
-; RUN: opt -passes="function(ee-instrument),cgscc(inline),function(post-inline-ee-instrument)" -S < %s | FileCheck %s
+; RUN: opt -passes="ee-instrument,cgscc(inline),post-inline-ee-instrument" -S < %s | FileCheck %s
 
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
Index: llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
===
--- llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
+++ llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
@@ -176,9 +176,12 @@
   return new PostInlineEntryExitInstrumenter();
 }
 
-PreservedAnalyses
-llvm::EntryExitInstrumenterPass::run(Function &F, FunctionAnalysisManager &AM) {
-  runOnFunction(F, PostInlining);
+PreservedAnalyses llvm::EntryExitInstrumenterPass::run(Module &M,
+   ModuleAnalysisManager &MAM) {
+  for (Function &F : M) {
+runOnFunction(F, PostInlining);
+  }
+
   PreservedAnalyses PA;
   PA.preserveSet();
   return PA;
Index: llvm/lib/Passes/PassRegistry.def
===
--- llvm/lib/Passes/PassRegistry.def
+++ llvm/lib/Passes/PassRegistry.def
@@ -120,6 +120,8 @@
 MODULE_PASS("memprof-module", ModuleMemProfilerPass())
 MODULE_PASS("poison-checking", PoisonCheckingPas

[PATCH] D96803: EntryExitInstrumenter: Move to a module pass and enable at all optimization levels (PR49143)

2021-02-17 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz added a comment.

In D96803#2566322 , @aeubanks wrote:

> why is this now a module pass?

Mainly to avoid the default rule from new pass manager to *not* apply any 
FunctionPass for optnone (which is the main issue for PR49143). Is there a 
better way to accomplish it? I noted also that 
createModuleToFunctionPassAdaptor basically creates a adaptor that applies the 
pass to all function on the module.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96803

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


[PATCH] D96803: EntryExitInstrumenter: Move to a module pass and enable at all optimization levels (PR49143)

2021-02-18 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz added a comment.

In D96803#2569436 , @aeubanks wrote:

> In D96803#2568179 , @zatrazz wrote:
>
>> In D96803#2566322 , @aeubanks wrote:
>>
>>> why is this now a module pass?
>>
>> Mainly to avoid the default rule from new pass manager to *not* apply any 
>> FunctionPass for optnone (which is the main issue for PR49143). Is there a 
>> better way to accomplish it? I noted also that 
>> createModuleToFunctionPassAdaptor basically creates a adaptor that applies 
>> the pass to all function on the module.
>
> It's always good to make the pass as specific as possible (e.g. prefer a 
> function pass rather than a module pass) so it doesn't have to worry about 
> infra. For example, just iterating over functions doesn't skip declarations.

I modeled it after AlwaysInlinerPass, since it seems that it was enabled at -O0 
as well. To keep EntryExitInstrumenterPass a function pass and enable it with 
-O0 I think we will need a way to communicate to the pass manager that the pass 
should be run even with optnone, my understanding was that a ModulePass will 
the way to do it. Do we have a way to advertise that a function pass should be 
run regardless of ' optnone' ?

> The whole point of `isRequired()` is to make the pass always run when it's 
> added to the pipeline, so making it a module pass shouldn't be necessary with 
> that line.

Indeed, I have added to fix a testcase but it does seem unrequired. I will 
remove it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96803

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


[PATCH] D96803: EntryExitInstrumenter: Enable at all optimization levels (PR49143)

2021-02-19 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz updated this revision to Diff 325004.
zatrazz retitled this revision from "EntryExitInstrumenter: Move to a module 
pass and enable at all optimization levels (PR49143)" to 
"EntryExitInstrumenter: Enable at all optimization levels (PR49143)".
zatrazz edited the summary of this revision.
zatrazz added a comment.

Updated patch based on previous comments.


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

https://reviews.llvm.org/D96803

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
  llvm/test/Transforms/EntryExitInstrumenter/mcount.ll


Index: llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
===
--- llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
+++ llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
@@ -1,4 +1,7 @@
-; RUN: opt 
-passes="function(ee-instrument),cgscc(inline),function(post-inline-ee-instrument)"
 -S < %s | FileCheck %s
+; RUN: opt --O0 --ee-instrument --inline --post-inline-ee-instrument -S < %s | 
FileCheck %s
+
+; Check if the pass is enabbled on both -O0 and higher optimization levels
+; RUN: opt --O2 --ee-instrument --post-inline-ee-instrument -S < %s | 
FileCheck --check-prefix=OPT %s
 
 ; Running the passes twice should not result in more instrumentation.
 ; RUN: opt 
-passes="function(ee-instrument),function(ee-instrument),cgscc(inline),function(post-inline-ee-instrument),function(post-inline-ee-instrument)"
 -S < %s | FileCheck %s
@@ -18,6 +21,15 @@
 ; CHECK-NEXT: %1 = call i8* @llvm.returnaddress(i32 0)
 ; CHECK-NEXT: call void @__cyg_profile_func_exit(i8* bitcast (void ()* 
@leaf_function to i8*), i8* %1)
 ; CHECK-NEXT: ret void
+
+; OPT-LABEL: define void @leaf_function()
+; OPT: entry:
+; OPT-NEXT: call void @mcount()
+; OPT-NEXT: %0 = call i8* @llvm.returnaddress(i32 0)
+; OPT-NEXT: call void @__cyg_profile_func_enter(i8* bitcast (void ()* 
@leaf_function to i8*), i8* %0)
+; OPT-NEXT: %1 = call i8* @llvm.returnaddress(i32 0)
+; OPT-NEXT: call void @__cyg_profile_func_exit(i8* bitcast (void ()* 
@leaf_function to i8*), i8* %1)
+; OPT-NEXT: ret void
 }
 
 
@@ -42,6 +54,16 @@
 
 ; CHECK-NEXT: call void @__cyg_profile_func_exit(i8* bitcast (void ()* 
@root_function to i8*), i8* %3)
 ; CHECK-NEXT: ret void
+
+; OPT-LABEL: define void @root_function()
+; OPT: entry:
+; OPT-NEXT: call void @mcount()
+
+; OPT-NEXT: %0 = call i8* @llvm.returnaddress(i32 0)
+; OPT-NEXT: call void @__cyg_profile_func_enter(i8* bitcast (void ()* 
@root_function to i8*), i8* %0)
+; OPT-NEXT: %1 = call i8* @llvm.returnaddress(i32 0)
+; OPT-NEXT: call void @__cyg_profile_func_exit(i8* bitcast (void ()* 
@root_function to i8*), i8* %1)
+; OPT-NEXT: ret void
 }
 
 
Index: llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
===
--- llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
+++ llvm/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
@@ -19,8 +19,6 @@
 
 namespace llvm {
 
-class Function;
-
 struct EntryExitInstrumenterPass
 : public PassInfoMixin {
   EntryExitInstrumenterPass(bool PostInlining) : PostInlining(PostInlining) {}
@@ -28,6 +26,8 @@
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
   bool PostInlining;
+
+  static bool isRequired() { return true; }
 };
 
 } // namespace llvm
Index: clang/lib/CodeGen/BackendUtil.cpp
===
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1312,7 +1312,9 @@
/*DropTypeTests=*/true));
   });
 
-if (Level != PassBuilder::OptimizationLevel::O0) {
+if (CodeGenOpts.InstrumentFunctions ||
+CodeGenOpts.InstrumentFunctionsAfterInlining ||
+CodeGenOpts.InstrumentFunctionEntryBare) {
   PB.registerPipelineStartEPCallback(
   [](ModulePassManager &MPM, PassBuilder::OptimizationLevel Level) {
 MPM.addPass(createModuleToFunctionPassAdaptor(


Index: llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
===
--- llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
+++ llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
@@ -1,4 +1,7 @@
-; RUN: opt -passes="function(ee-instrument),cgscc(inline),function(post-inline-ee-instrument)" -S < %s | FileCheck %s
+; RUN: opt --O0 --ee-instrument --inline --post-inline-ee-instrument -S < %s | FileCheck %s
+
+; Check if the pass is enabbled on both -O0 and higher optimization levels
+; RUN: opt --O2 --ee-instrument --post-inline-ee-instrument -S < %s | FileCheck --check-prefix=OPT %s
 
 ; Running the passes twice should not result in more instrumentation.
 ; RUN: opt -passes="function(ee-instrument),function(ee-instrument),cgscc(inline),function(post-inline-ee-instrument),function(post-inline-ee-instrument)" -S < %s | FileCheck 

[PATCH] D137267: [clang][Headers] Only define FLT_EVAL_METHOD for C99 and later

2022-11-02 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz created this revision.
zatrazz added reviewers: jfb, eli.friedman, MaskRay.
Herald added a subscriber: StephenFan.
Herald added a project: All.
zatrazz requested review of this revision.
Herald added a project: clang.

It was reported by glibc conform test [1].

[1] 
https://sourceware.org/git/?p=glibc.git;a=blob;f=conform/data/float.h-data;h=7b98fc03447b8918da4a0cf47d41fb3e17f4f791;hb=HEAD


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137267

Files:
  clang/lib/Headers/float.h


Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -86,7 +86,10 @@
 
 /* Characteristics of floating point types, C99 5.2.4.2.2 */
 
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) ||  
\
+(defined(__cplusplus) && __cplusplus >= 201103L)
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#endif
 #define FLT_ROUNDS (__builtin_flt_rounds())
 #define FLT_RADIX __FLT_RADIX__
 


Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -86,7 +86,10 @@
 
 /* Characteristics of floating point types, C99 5.2.4.2.2 */
 
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) ||  \
+(defined(__cplusplus) && __cplusplus >= 201103L)
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#endif
 #define FLT_ROUNDS (__builtin_flt_rounds())
 #define FLT_RADIX __FLT_RADIX__
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137268: [clang][Headers] Do not define varargs macros for __need___va_list

2022-11-02 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz created this revision.
zatrazz added reviewers: jfb, eli.friedman, MaskRay.
Herald added subscribers: Enna1, StephenFan.
Herald added a project: All.
zatrazz requested review of this revision.
Herald added projects: clang, Sanitizers.
Herald added a subscriber: Sanitizers.

The glibc uses the define to avoid namespace polution on headers
that requires variadic argument, where the inclusion of stdarg.h is
required to obtain the va_list definition.

For such cases only __gnuc_va_list is required.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137268

Files:
  clang/lib/Headers/stdarg.h
  compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp


Index: compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
===
--- compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
+++ compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
Index: clang/lib/Headers/stdarg.h
===
--- clang/lib/Headers/stdarg.h
+++ clang/lib/Headers/stdarg.h
@@ -8,7 +8,17 @@
  */
 
 #ifndef __STDARG_H
+#ifndef __need___va_list
 #define __STDARG_H
+#endif /* __need___va_list */
+#undef __need___va_list
+
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST 1
+typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#ifdef __STDARG_H
 
 #ifndef _VA_LIST
 typedef __builtin_va_list va_list;
@@ -29,9 +39,6 @@
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)
 #endif
 
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST 1
-typedef __builtin_va_list __gnuc_va_list;
-#endif
-
 #endif /* __STDARG_H */
+
+#endif /* not __STDARG_H */


Index: compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
===
--- compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
+++ compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
Index: clang/lib/Headers/stdarg.h
===
--- clang/lib/Headers/stdarg.h
+++ clang/lib/Headers/stdarg.h
@@ -8,7 +8,17 @@
  */
 
 #ifndef __STDARG_H
+#ifndef __need___va_list
 #define __STDARG_H
+#endif /* __need___va_list */
+#undef __need___va_list
+
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST 1
+typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#ifdef __STDARG_H
 
 #ifndef _VA_LIST
 typedef __builtin_va_list va_list;
@@ -29,9 +39,6 @@
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)
 #endif
 
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST 1
-typedef __builtin_va_list __gnuc_va_list;
-#endif
-
 #endif /* __STDARG_H */
+
+#endif /* not __STDARG_H */
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137267: [clang][Headers] Only define FLT_EVAL_METHOD for C99 and later

2022-11-08 Thread Adhemerval Zanella via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92e172309cf6: [clang][Headers] Only define FLT_EVAL_METHOD 
for C99 and later (authored by zatrazz).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137267

Files:
  clang/lib/Headers/float.h


Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -86,7 +86,10 @@
 
 /* Characteristics of floating point types, C99 5.2.4.2.2 */
 
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) ||  
\
+(defined(__cplusplus) && __cplusplus >= 201103L)
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#endif
 #define FLT_ROUNDS (__builtin_flt_rounds())
 #define FLT_RADIX __FLT_RADIX__
 


Index: clang/lib/Headers/float.h
===
--- clang/lib/Headers/float.h
+++ clang/lib/Headers/float.h
@@ -86,7 +86,10 @@
 
 /* Characteristics of floating point types, C99 5.2.4.2.2 */
 
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) ||  \
+(defined(__cplusplus) && __cplusplus >= 201103L)
 #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#endif
 #define FLT_ROUNDS (__builtin_flt_rounds())
 #define FLT_RADIX __FLT_RADIX__
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137268: [clang][Headers] Do not define varargs macros for __need___va_list

2022-11-08 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz marked 2 inline comments as done.
zatrazz added inline comments.



Comment at: clang/lib/Headers/stdarg.h:17
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST 1
+typedef __builtin_va_list __gnuc_va_list;

MaskRay wrote:
> To match gcc stdarg.h, `#define __GNUC_VA_LIST`
Ack.



Comment at: clang/lib/Headers/stdarg.h:21
+
+#ifdef __STDARG_H
 

efriedma wrote:
> Maybe the following is a little more readable?
> 
> ```
> #ifndef __STDARG_H
> 
> #ifndef __GNUC_VA_LIST
> #define __GNUC_VA_LIST 1
> typedef __builtin_va_list __gnuc_va_list;
> #endif
> 
> #ifdef __need___va_list
> #undef __need___va_list
> #else
> #define __STDARG_H
> [...]
> ```
Ack.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137268

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


[PATCH] D137268: [clang][Headers] Do not define varargs macros for __need___va_list

2022-11-08 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz updated this revision to Diff 474028.
zatrazz marked 2 inline comments as done.
zatrazz added a comment.

Update review based on reviewers comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137268

Files:
  clang/lib/Headers/stdarg.h
  compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp


Index: compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
===
--- compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
+++ compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
Index: clang/lib/Headers/stdarg.h
===
--- clang/lib/Headers/stdarg.h
+++ clang/lib/Headers/stdarg.h
@@ -8,8 +8,16 @@
  */
 
 #ifndef __STDARG_H
-#define __STDARG_H
 
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST
+typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#ifdef __need___va_list
+#undef __need___va_list
+#else
+#define __STDARG_H
 #ifndef _VA_LIST
 typedef __builtin_va_list va_list;
 #define _VA_LIST
@@ -29,9 +37,6 @@
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)
 #endif
 
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST 1
-typedef __builtin_va_list __gnuc_va_list;
-#endif
-
 #endif /* __STDARG_H */
+
+#endif /* not __STDARG_H */


Index: compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
===
--- compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
+++ compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
Index: clang/lib/Headers/stdarg.h
===
--- clang/lib/Headers/stdarg.h
+++ clang/lib/Headers/stdarg.h
@@ -8,8 +8,16 @@
  */
 
 #ifndef __STDARG_H
-#define __STDARG_H
 
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST
+typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#ifdef __need___va_list
+#undef __need___va_list
+#else
+#define __STDARG_H
 #ifndef _VA_LIST
 typedef __builtin_va_list va_list;
 #define _VA_LIST
@@ -29,9 +37,6 @@
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)
 #endif
 
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST 1
-typedef __builtin_va_list __gnuc_va_list;
-#endif
-
 #endif /* __STDARG_H */
+
+#endif /* not __STDARG_H */
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137268: [clang][Headers] Do not define varargs macros for __need___va_list

2022-11-08 Thread Adhemerval Zanella via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9e956995db1f: [clang][Headers] Do not define varargs macros 
for __need___va_list (authored by zatrazz).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137268

Files:
  clang/lib/Headers/stdarg.h
  compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp


Index: compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
===
--- compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
+++ compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
Index: clang/lib/Headers/stdarg.h
===
--- clang/lib/Headers/stdarg.h
+++ clang/lib/Headers/stdarg.h
@@ -8,8 +8,16 @@
  */
 
 #ifndef __STDARG_H
-#define __STDARG_H
 
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST
+typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#ifdef __need___va_list
+#undef __need___va_list
+#else
+#define __STDARG_H
 #ifndef _VA_LIST
 typedef __builtin_va_list va_list;
 #define _VA_LIST
@@ -29,9 +37,6 @@
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)
 #endif
 
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST 1
-typedef __builtin_va_list __gnuc_va_list;
-#endif
-
 #endif /* __STDARG_H */
+
+#endif /* not __STDARG_H */


Index: compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
===
--- compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
+++ compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
@@ -5,6 +5,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
Index: clang/lib/Headers/stdarg.h
===
--- clang/lib/Headers/stdarg.h
+++ clang/lib/Headers/stdarg.h
@@ -8,8 +8,16 @@
  */
 
 #ifndef __STDARG_H
-#define __STDARG_H
 
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST
+typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#ifdef __need___va_list
+#undef __need___va_list
+#else
+#define __STDARG_H
 #ifndef _VA_LIST
 typedef __builtin_va_list va_list;
 #define _VA_LIST
@@ -29,9 +37,6 @@
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)
 #endif
 
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST 1
-typedef __builtin_va_list __gnuc_va_list;
-#endif
-
 #endif /* __STDARG_H */
+
+#endif /* not __STDARG_H */
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137268: [clang][Headers] Do not define varargs macros for __need___va_list

2023-01-20 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz added a comment.

In D137268#4069779 , @enh wrote:

> is there a corresponding glibc change so that `va_list` is exported for 
> `_POSIX_SOURCE` cases? see 
> https://android-review.git.corp.google.com/c/platform/bionic/+/2397313 where 
> i'm having to disable some bionic testing against glibc because the glibc 
> (2.17!)  now no longer exports `va_list`. i did look for a ToT glibc 
> patch to backport (until we've _actually_ switched from glibc to musl for the 
> host), but couldn't obviously find it?
>
> https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/basedefs/wchar.h.html
>  says:
> """
> The  header shall define the following types:
> ...
> va_list
> [CX] As described in .
> """
> which is why i think our " exports `va_list`" test is correct. 
> (Android doesn't support an "ISO only" mode --- you're effectively always in 
> `_POSIX_SOURCE` mode, so we build the test against glibc with `_POSIX_SOURCE` 
> defined.)

I think I have caught this because your standard conformance tests checks for 
__gnuc_va_list 
on wchar.h, wich is always defined on on GCC (git log shows it was changed to 
fix XPG7 
tests, but I am not sure exactly why the author has changed the va_list to 
__gnuc_va_list).

And it seems that glibc seems broken also using GCC stdarg.h if I fix the test 
to check for
va_list instead. I will take a look at this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137268

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


[PATCH] D137268: [clang][Headers] Do not define varargs macros for __need___va_list

2023-01-20 Thread Adhemerval Zanella via Phabricator via cfe-commits
zatrazz added a comment.

In D137268#4069935 , @enh wrote:

> In D137268#4069856 , @zatrazz wrote:
>
>> I think I have caught this because your standard conformance tests checks 
>> for __gnuc_va_list 
>> on wchar.h, wich is always defined on on GCC (git log shows it was changed 
>> to fix XPG7 
>> tests, but I am not sure exactly why the author has changed the va_list to 
>> __gnuc_va_list).
>
> bionic's tests check for `va_list`, because that's what POSIX says will be 
> visible. ISO C doesn't say that, so i think the _intention_ for glibc -- musl 
> seems to do this correctly -- is to say "if we're only compiling C source, 
> you don't get `va_list`, but if we're compiling POSIX source, you do get 
> `va_list`". so i think this `__gnuc_va_list` thing is their workaround to 
> still export the _functions_ without exporting the _type_ for ISO C?

Indeed the __gnuc_va_list is used when building for c99/c11, since va_list 
should not be defined in such cases. It seems also that glibc stdio.h does 
handle it by defining __gnuc_va_list to va_list if POSIX2001 or POSIX2008 is 
used (-D_XOPEN_SOURCE=600 or -D_XOPEN_SOURCE=700), so I think we should do the 
same for wchar.h

> here's the bionic *POSIX* test: 
> https://cs.android.com/android/platform/superproject/+/master:bionic/tests/headers/posix/wchar_h.c;l=38
>  (but note that you'll have to look at the corresponding Android.bp file to 
> see us define `_POSIX_SOURCE`.) note that our tests pass against _bionic_ 
> (and, i think, musl). it's just old-glibc-with-new-llvm they fail against.
>
>> And it seems that glibc seems broken also using GCC stdarg.h if I fix the 
>> test to check for
>> va_list instead. I will take a look at this.
>
> thanks!

Could you check if this fixes your issue? I am not sure if if applies cleans to 
the ancient glibc 2.17 you are using:

  diff --git a/conform/data/wchar.h-data b/conform/data/wchar.h-data
  index e414651a33..582a99c00b 100644
  --- a/conform/data/wchar.h-data
  +++ b/conform/data/wchar.h-data
  @@ -15,6 +15,9 @@ type size_t
   type locale_t
   # endif
   tag {struct tm}
  +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && 
!defined UNIX98
  +type va_list
  +#endif
  
   function wint_t btowc (int)
   function int fwprintf (FILE*, const wchar_t*, ...)
  diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
  index 69e920b8c2..ca145bb8d2 100644
  --- a/wcsmbs/wchar.h
  +++ b/wcsmbs/wchar.h
  @@ -37,6 +37,17 @@
   #define __need___va_list
   #include 
  
  +#if defined __USE_XOPEN2K || defined __USE_XOPEN2K8
  +# ifdef __GNUC__
  +#  ifndef _VA_LIST_DEFINED
  +typedef __gnuc_va_list va_list;
  +#   define _VA_LIST_DEFINED
  +#  endif
  +# else
  +#  include 
  +# endif
  +#endif
  +
   #include 
   #include 
   #include 

In any case, I will open a bug report on glibc fix on our side.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137268

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