[PATCH] D54082: [Driver] Use -Bstatic/dynamic for libc++ on Fuchsia

2018-11-03 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr accepted this revision.
mcgrathr added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rC Clang

https://reviews.llvm.org/D54082



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


[PATCH] D53854: [Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia

2018-11-03 Thread Petr Hosek via Phabricator via cfe-commits
phosek closed this revision.
phosek added inline comments.



Comment at: lib/Driver/ToolChains/Fuchsia.cpp:128
 if (OnlyLibstdcxxStatic)
-  CmdArgs.push_back("-Bstatic");
+  CmdArgs.push_back("-static");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);

mcgrathr wrote:
> mcgrathr wrote:
> > MaskRay wrote:
> > > If Fuchsia doesn't use gold, it is fine. gold diverges from ld.bfd (lld) 
> > > in that `-static` switches the whole link to its special static mode. (as 
> > > usually while you link libstdc++/libc++ statically, you can still link 
> > > other libraries normally)
> > > 
> > > In ld.bfd/lld, `-Bstatic` is synonym with `-static`.
> > I think this part of the change was unintentional and should be undone.
> > Using `--pop-state` obviates the need for `-Bdynamic` to undo `-Bstatic`, 
> > but `-Bstatic` is still the right switch here.
> Actually, it's wrong two ways: the `--pop-state` should come before `-lm`.  
> Neither `-static` nor `-Bstatic` should apply to `-lm` (or to `-lc` that 
> comes later, which `-static` might).  `-static` vs `-Bstatic` is only a 
> latent bug given lld, but the `-lm` issue breaks the Zircon build today.
> 
Addressed in D54082.


Repository:
  rC Clang

https://reviews.llvm.org/D53854



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


[PATCH] D54082: [Driver] Use -Bstatic/dynamic for libc++ on Fuchsia

2018-11-03 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a reviewer: mcgrathr.
Herald added a reviewer: EricWF.
Herald added a subscriber: cfe-commits.

-static relies on lld's behavior, but -Bstatic/dynamic across all
linkers, -lm is only needed when statically linking libc++.


Repository:
  rC Clang

https://reviews.llvm.org/D54082

Files:
  clang/lib/Driver/ToolChains/Fuchsia.cpp
  clang/test/Driver/fuchsia.cpp


Index: clang/test/Driver/fuchsia.cpp
===
--- clang/test/Driver/fuchsia.cpp
+++ clang/test/Driver/fuchsia.cpp
@@ -20,7 +20,6 @@
 // CHECK: "--push-state"
 // CHECK: "--as-needed"
 // CHECK: "-lc++"
-// CHECK: "-lm"
 // CHECK: "--pop-state"
 // CHECK: 
"[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.builtins.a"
 // CHECK: "-lc"
@@ -37,8 +36,9 @@
 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC: "--push-state"
 // CHECK-STATIC: "--as-needed"
-// CHECK-STATIC: "-static"
+// CHECK-STATIC: "-Bstatic"
 // CHECK-STATIC: "-lc++"
+// CHECK-STATIC: "-Bdynamic"
 // CHECK-STATIC: "-lm"
 // CHECK-STATIC: "--pop-state"
 // CHECK-STATIC: "-lc"
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -125,9 +125,12 @@
 CmdArgs.push_back("--push-state");
 CmdArgs.push_back("--as-needed");
 if (OnlyLibstdcxxStatic)
-  CmdArgs.push_back("-static");
+  CmdArgs.push_back("-Bstatic");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-CmdArgs.push_back("-lm");
+if (OnlyLibstdcxxStatic) {
+  CmdArgs.push_back("-Bdynamic");
+  CmdArgs.push_back("-lm");
+}
 CmdArgs.push_back("--pop-state");
   }
 }


Index: clang/test/Driver/fuchsia.cpp
===
--- clang/test/Driver/fuchsia.cpp
+++ clang/test/Driver/fuchsia.cpp
@@ -20,7 +20,6 @@
 // CHECK: "--push-state"
 // CHECK: "--as-needed"
 // CHECK: "-lc++"
-// CHECK: "-lm"
 // CHECK: "--pop-state"
 // CHECK: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.builtins.a"
 // CHECK: "-lc"
@@ -37,8 +36,9 @@
 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
 // CHECK-STATIC: "--push-state"
 // CHECK-STATIC: "--as-needed"
-// CHECK-STATIC: "-static"
+// CHECK-STATIC: "-Bstatic"
 // CHECK-STATIC: "-lc++"
+// CHECK-STATIC: "-Bdynamic"
 // CHECK-STATIC: "-lm"
 // CHECK-STATIC: "--pop-state"
 // CHECK-STATIC: "-lc"
Index: clang/lib/Driver/ToolChains/Fuchsia.cpp
===
--- clang/lib/Driver/ToolChains/Fuchsia.cpp
+++ clang/lib/Driver/ToolChains/Fuchsia.cpp
@@ -125,9 +125,12 @@
 CmdArgs.push_back("--push-state");
 CmdArgs.push_back("--as-needed");
 if (OnlyLibstdcxxStatic)
-  CmdArgs.push_back("-static");
+  CmdArgs.push_back("-Bstatic");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
-CmdArgs.push_back("-lm");
+if (OnlyLibstdcxxStatic) {
+  CmdArgs.push_back("-Bdynamic");
+  CmdArgs.push_back("-lm");
+}
 CmdArgs.push_back("--pop-state");
   }
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D54064: [Driver] Always match resource dir in Fuchsia driver tests

2018-11-03 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL346088: [Driver] Always match resource dir in Fuchsia driver 
tests (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54064?vs=172479=172512#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54064

Files:
  cfe/trunk/test/Driver/fuchsia.c
  cfe/trunk/test/Driver/fuchsia.cpp

Index: cfe/trunk/test/Driver/fuchsia.c
===
--- cfe/trunk/test/Driver/fuchsia.c
+++ cfe/trunk/test/Driver/fuchsia.c
@@ -10,6 +10,7 @@
 // CHECK: "--mrelax-relocations"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
+// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
 // CHECK: "-fsanitize=safe-stack"
@@ -25,8 +26,8 @@
 // CHECK-NOT: crti.o
 // CHECK-NOT: crtbegin.o
 // CHECK: "-L[[SYSROOT]]{{/|}}lib"
-// CHECK-X86_64: "{{.*[/\\]}}libclang_rt.builtins.a"
-// CHECK-AARCH64: "{{.*[/\\]}}libclang_rt.builtins.a"
+// CHECK-X86_64: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.builtins.a"
+// CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|}}aarch64-fuchsia{{/|}}lib{{/|}}libclang_rt.builtins.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
 // CHECK-NOT: crtn.o
@@ -57,8 +58,9 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-SAFESTACK
+// CHECK-SAFESTACK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-SAFESTACK: "-fsanitize=safe-stack"
-// CHECK-SAFESTACK-NOT: "{{.*[/\\]}}libclang_rt.safestack.a"
+// CHECK-SAFESTACK-NOT: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.safestack.a"
 // CHECK-SAFESTACK-NOT: "__safestack_init"
 
 // RUN: %clang %s -### --target=x86_64-fuchsia \
@@ -94,52 +96,58 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-ASAN-SHARED
+// CHECK-ASAN-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-ASAN-SHARED: "-fsanitize=address"
 // CHECK-ASAN-SHARED: "-fsanitize-address-globals-dead-stripping"
-// CHECK-ASAN-SHARED: "{{.*[/\\]}}libclang_rt.asan.so"
-// CHECK-ASAN-SHARED-NOT: "{{.*[/\\]}}libclang_rt.asan-preinit.a"
+// CHECK-ASAN-SHARED: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.asan.so"
+// CHECK-ASAN-SHARED-NOT: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.asan-preinit.a"
 
 // RUN: %clang %s -### --target=x86_64-fuchsia \
 // RUN: -fsanitize=fuzzer 2>&1 \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-X86
+// CHECK-FUZZER-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-FUZZER-X86: "-fsanitize=fuzzer,fuzzer-no-link,safe-stack"
-// CHECK-FUZZER-X86: "{{.*[/\\]}}libclang_rt.fuzzer.a"
+// CHECK-FUZZER-X86: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.fuzzer.a"
 
 // RUN: %clang %s -### --target=aarch64-fuchsia \
 // RUN: -fsanitize=fuzzer 2>&1 \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-AARCH64
+// CHECK-FUZZER-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-FUZZER-AARCH64: "-fsanitize=fuzzer,fuzzer-no-link,safe-stack"
-// CHECK-FUZZER-AARCH64: "{{.*[/\\]}}libclang_rt.fuzzer.a"
+// CHECK-FUZZER-AARCH64: "[[RESOURCE_DIR]]{{/|}}aarch64-fuchsia{{/|}}lib{{/|}}libclang_rt.fuzzer.a"
 
 // RUN: %clang %s -### --target=x86_64-fuchsia \
 // RUN: -fsanitize=scudo 2>&1 \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-X86
+// CHECK-SCUDO-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-SCUDO-X86: "-fsanitize=safe-stack,scudo"
 // CHECK-SCUDO-X86: "-pie"
-// CHECK-SCUDO-X86: "{{.*[/\\]}}libclang_rt.scudo.so"
+// CHECK-SCUDO-X86: "[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.scudo.so"
 
 // RUN: %clang %s -### --target=aarch64-fuchsia \
 // RUN: -fsanitize=scudo 2>&1 \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-AARCH64
+// CHECK-SCUDO-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-SCUDO-AARCH64: "-fsanitize=safe-stack,scudo"
 // CHECK-SCUDO-AARCH64: "-pie"
-// CHECK-SCUDO-AARCH64: "{{.*[/\\]}}libclang_rt.scudo.so"
+// CHECK-SCUDO-AARCH64: "[[RESOURCE_DIR]]{{/|}}aarch64-fuchsia{{/|}}lib{{/|}}libclang_rt.scudo.so"
 
 // RUN: %clang %s -### 

r346088 - [Driver] Always match resource dir in Fuchsia driver tests

2018-11-03 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Sat Nov  3 20:53:07 2018
New Revision: 346088

URL: http://llvm.org/viewvc/llvm-project?rev=346088=rev
Log:
[Driver] Always match resource dir in Fuchsia driver tests

This makes the tests stricter by not only matching the runtime file
name, but the entire path into the resource directory.

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

Modified:
cfe/trunk/test/Driver/fuchsia.c
cfe/trunk/test/Driver/fuchsia.cpp

Modified: cfe/trunk/test/Driver/fuchsia.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fuchsia.c?rev=346088=346087=346088=diff
==
--- cfe/trunk/test/Driver/fuchsia.c (original)
+++ cfe/trunk/test/Driver/fuchsia.c Sat Nov  3 20:53:07 2018
@@ -10,6 +10,7 @@
 // CHECK: "--mrelax-relocations"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
+// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
 // CHECK: "-fsanitize=safe-stack"
@@ -25,8 +26,8 @@
 // CHECK-NOT: crti.o
 // CHECK-NOT: crtbegin.o
 // CHECK: "-L[[SYSROOT]]{{/|}}lib"
-// CHECK-X86_64: "{{.*[/\\]}}libclang_rt.builtins.a"
-// CHECK-AARCH64: "{{.*[/\\]}}libclang_rt.builtins.a"
+// CHECK-X86_64: 
"[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.builtins.a"
+// CHECK-AARCH64: 
"[[RESOURCE_DIR]]{{/|}}aarch64-fuchsia{{/|}}lib{{/|}}libclang_rt.builtins.a"
 // CHECK: "-lc"
 // CHECK-NOT: crtend.o
 // CHECK-NOT: crtn.o
@@ -57,8 +58,9 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-SAFESTACK
+// CHECK-SAFESTACK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-SAFESTACK: "-fsanitize=safe-stack"
-// CHECK-SAFESTACK-NOT: "{{.*[/\\]}}libclang_rt.safestack.a"
+// CHECK-SAFESTACK-NOT: 
"[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.safestack.a"
 // CHECK-SAFESTACK-NOT: "__safestack_init"
 
 // RUN: %clang %s -### --target=x86_64-fuchsia \
@@ -94,52 +96,58 @@
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-ASAN-SHARED
+// CHECK-ASAN-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-ASAN-SHARED: "-fsanitize=address"
 // CHECK-ASAN-SHARED: "-fsanitize-address-globals-dead-stripping"
-// CHECK-ASAN-SHARED: "{{.*[/\\]}}libclang_rt.asan.so"
-// CHECK-ASAN-SHARED-NOT: "{{.*[/\\]}}libclang_rt.asan-preinit.a"
+// CHECK-ASAN-SHARED: 
"[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.asan.so"
+// CHECK-ASAN-SHARED-NOT: 
"[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.asan-preinit.a"
 
 // RUN: %clang %s -### --target=x86_64-fuchsia \
 // RUN: -fsanitize=fuzzer 2>&1 \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-X86
+// CHECK-FUZZER-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-FUZZER-X86: "-fsanitize=fuzzer,fuzzer-no-link,safe-stack"
-// CHECK-FUZZER-X86: "{{.*[/\\]}}libclang_rt.fuzzer.a"
+// CHECK-FUZZER-X86: 
"[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.fuzzer.a"
 
 // RUN: %clang %s -### --target=aarch64-fuchsia \
 // RUN: -fsanitize=fuzzer 2>&1 \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-AARCH64
+// CHECK-FUZZER-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-FUZZER-AARCH64: "-fsanitize=fuzzer,fuzzer-no-link,safe-stack"
-// CHECK-FUZZER-AARCH64: "{{.*[/\\]}}libclang_rt.fuzzer.a"
+// CHECK-FUZZER-AARCH64: 
"[[RESOURCE_DIR]]{{/|}}aarch64-fuchsia{{/|}}lib{{/|}}libclang_rt.fuzzer.a"
 
 // RUN: %clang %s -### --target=x86_64-fuchsia \
 // RUN: -fsanitize=scudo 2>&1 \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-X86
+// CHECK-SCUDO-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-SCUDO-X86: "-fsanitize=safe-stack,scudo"
 // CHECK-SCUDO-X86: "-pie"
-// CHECK-SCUDO-X86: "{{.*[/\\]}}libclang_rt.scudo.so"
+// CHECK-SCUDO-X86: 
"[[RESOURCE_DIR]]{{/|}}x86_64-fuchsia{{/|}}lib{{/|}}libclang_rt.scudo.so"
 
 // RUN: %clang %s -### --target=aarch64-fuchsia \
 // RUN: -fsanitize=scudo 2>&1 \
 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
 // RUN: -fuse-ld=lld \
 // RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-AARCH64
+// CHECK-SCUDO-AARCH64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-SCUDO-AARCH64: "-fsanitize=safe-stack,scudo"
 // CHECK-SCUDO-AARCH64: "-pie"
-// CHECK-SCUDO-AARCH64: 

[PATCH] D53854: [Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia

2018-11-03 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr reopened this revision.
mcgrathr added inline comments.
This revision is now accepted and ready to land.



Comment at: lib/Driver/ToolChains/Fuchsia.cpp:128
 if (OnlyLibstdcxxStatic)
-  CmdArgs.push_back("-Bstatic");
+  CmdArgs.push_back("-static");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);

mcgrathr wrote:
> MaskRay wrote:
> > If Fuchsia doesn't use gold, it is fine. gold diverges from ld.bfd (lld) in 
> > that `-static` switches the whole link to its special static mode. (as 
> > usually while you link libstdc++/libc++ statically, you can still link 
> > other libraries normally)
> > 
> > In ld.bfd/lld, `-Bstatic` is synonym with `-static`.
> I think this part of the change was unintentional and should be undone.
> Using `--pop-state` obviates the need for `-Bdynamic` to undo `-Bstatic`, but 
> `-Bstatic` is still the right switch here.
Actually, it's wrong two ways: the `--pop-state` should come before `-lm`.  
Neither `-static` nor `-Bstatic` should apply to `-lm` (or to `-lc` that comes 
later, which `-static` might).  `-static` vs `-Bstatic` is only a latent bug 
given lld, but the `-lm` issue breaks the Zircon build today.



Repository:
  rC Clang

https://reviews.llvm.org/D53854



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


[PATCH] D54048: [AST] Get aliased type info from an aliased TemplateSpecialization.

2018-11-03 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

That looks a lot better, thanks.  Did you check whether any other tests needed 
adjustment?  That's not uncommon from this kind of desugaring change.

If not, LGTM.


https://reviews.llvm.org/D54048



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


[libclc] r346086 - Remove redundant OVERRRIDES file

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:54:46 2018
New Revision: 346086

URL: http://llvm.org/viewvc/llvm-project?rev=346086=rev
Log:
Remove redundant OVERRRIDES file

Signed-off-by: Jan Vesely 
Reviewed-By: Aaron Watry 

Removed:
libclc/trunk/amdgpu/lib/OVERRIDES

Removed: libclc/trunk/amdgpu/lib/OVERRIDES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgpu/lib/OVERRIDES?rev=346085=auto
==
--- libclc/trunk/amdgpu/lib/OVERRIDES (original)
+++ libclc/trunk/amdgpu/lib/OVERRIDES (removed)
@@ -1,2 +0,0 @@
-workitem/get_group_id.cl
-workitem/get_global_size.cl


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


[libclc] r346085 - configure: Provide symlink for amdgcn-mesa3d instead of configure hack

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:54:45 2018
New Revision: 346085

URL: http://llvm.org/viewvc/llvm-project?rev=346085=rev
Log:
configure: Provide symlink for amdgcn-mesa3d instead of configure hack

Signed-off-by: Jan Vesely 
Reviewed-By: Aaron Watry 

Added:
libclc/trunk/amdgcn-mesa3d   (with props)
Modified:
libclc/trunk/configure.py

Added: libclc/trunk/amdgcn-mesa3d
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-mesa3d?rev=346085=auto
==
--- libclc/trunk/amdgcn-mesa3d (added)
+++ libclc/trunk/amdgcn-mesa3d Sat Nov  3 17:54:45 2018
@@ -0,0 +1 @@
+link amdgcn-amdhsa
\ No newline at end of file

Propchange: libclc/trunk/amdgcn-mesa3d
--
svn:special = *

Modified: libclc/trunk/configure.py
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/configure.py?rev=346085=346084=346085=diff
==
--- libclc/trunk/configure.py (original)
+++ libclc/trunk/configure.py Sat Nov  3 17:54:45 2018
@@ -187,8 +187,6 @@ for target in targets:
   for arch in archs:
 subdirs.append("%s-%s-%s" % (arch, t_vendor, t_os))
 subdirs.append("%s-%s" % (arch, t_os))
-if t_os == 'mesa3d':
-subdirs.append('amdgcn-amdhsa')
 subdirs.append(arch)
 if arch == 'amdgcn' or arch == 'r600':
 subdirs.append('amdgpu')


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


[libclc] r346084 - travis: Check tahiti-amdgcn-mesa-mesa3d.bc

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:54:43 2018
New Revision: 346084

URL: http://llvm.org/viewvc/llvm-project?rev=346084=rev
Log:
travis: Check tahiti-amdgcn-mesa-mesa3d.bc

Signed-off-by: Jan Vesely 
Reviewed-By: Aaron Watry 

Modified:
libclc/trunk/.travis.yml

Modified: libclc/trunk/.travis.yml
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/.travis.yml?rev=346084=346083=346084=diff
==
--- libclc/trunk/.travis.yml (original)
+++ libclc/trunk/.travis.yml Sat Nov  3 17:54:43 2018
@@ -28,7 +28,7 @@ matrix:
 - LABEL="make gcc LLVM-4.0"
 - LLVM_VERSION=4.0
 - LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc nvptx--nvidiacl.bc 
nvptx64--nvidiacl.bc"
+- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc 
tahiti-amdgcn-mesa-mesa3d.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc"
   addons:
 apt:
   sources:
@@ -43,7 +43,7 @@ matrix:
 - LABEL="make gcc LLVM-5.0"
 - LLVM_VERSION=5.0
 - LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc nvptx--nvidiacl.bc 
nvptx64--nvidiacl.bc"
+- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc 
tahiti-amdgcn-mesa-mesa3d.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc"
   addons:
 apt:
   sources:
@@ -58,7 +58,7 @@ matrix:
 - LABEL="make gcc LLVM-6.0"
 - LLVM_VERSION=6.0
 - LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc nvptx--nvidiacl.bc 
nvptx64--nvidiacl.bc"
+- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc 
tahiti-amdgcn-mesa-mesa3d.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc"
 # llvm passes -Werror=date-time which is only supported in gcc-4.9+
 - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
   addons:
@@ -77,7 +77,7 @@ matrix:
 - LABEL="make gcc LLVM-7"
 - LLVM_VERSION=7
 - LLVM_CONFIG="llvm-config-${LLVM_VERSION}"
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc nvptx--nvidiacl.bc 
nvptx64--nvidiacl.bc"
+- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc 
tahiti-amdgcn-mesa-mesa3d.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc"
 # llvm passes -Werror=date-time which is only supported in gcc-4.9+
 - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
   addons:


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


[libclc] r346082 - amdgcn: Move __clc_amdgcn_s_waitcnt definition to clc file

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:39:27 2018
New Revision: 346082

URL: http://llvm.org/viewvc/llvm-project?rev=346082=rev
Log:
amdgcn: Move __clc_amdgcn_s_waitcnt definition to clc file

Signed-off-by: Jan Vesely 
Reviewed-By: Aaron Watry 

Removed:
libclc/trunk/amdgcn/lib/mem_fence/waitcnt.ll
Modified:
libclc/trunk/amdgcn/lib/SOURCES_3.9
libclc/trunk/amdgcn/lib/SOURCES_4.0
libclc/trunk/amdgcn/lib/mem_fence/fence.cl

Modified: libclc/trunk/amdgcn/lib/SOURCES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_3.9?rev=346082=346081=346082=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_3.9 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_3.9 Sat Nov  3 17:39:27 2018
@@ -1,2 +1 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
-mem_fence/waitcnt.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_4.0?rev=346082=346081=346082=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_4.0 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_4.0 Sat Nov  3 17:39:27 2018
@@ -1,2 +1 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
-mem_fence/waitcnt.ll

Modified: libclc/trunk/amdgcn/lib/mem_fence/fence.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/mem_fence/fence.cl?rev=346082=346081=346082=diff
==
--- libclc/trunk/amdgcn/lib/mem_fence/fence.cl (original)
+++ libclc/trunk/amdgcn/lib/mem_fence/fence.cl Sat Nov  3 17:39:27 2018
@@ -14,6 +14,7 @@ void __clc_amdgcn_s_waitcnt(unsigned fla
 #  define __waitcnt(x) __builtin_amdgcn_s_waitcnt(x)
 #else
 #  define __waitcnt(x) __clc_amdgcn_s_waitcnt(x)
+_CLC_DEF void __clc_amdgcn_s_waitcnt(unsigned)  __asm("llvm.amdgcn.s.waitcnt");
 #endif
 
 _CLC_DEF void mem_fence(cl_mem_fence_flags flags)

Removed: libclc/trunk/amdgcn/lib/mem_fence/waitcnt.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/mem_fence/waitcnt.ll?rev=346081=auto
==
--- libclc/trunk/amdgcn/lib/mem_fence/waitcnt.ll (original)
+++ libclc/trunk/amdgcn/lib/mem_fence/waitcnt.ll (removed)
@@ -1,13 +0,0 @@
-declare void @llvm.amdgcn.s.waitcnt(i32) #0
-
-target datalayout = 
"e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
-
-; Export waitcnt intrinsic for clang < 5
-define void @__clc_amdgcn_s_waitcnt(i32 %flags) #1 {
-entry:
-  tail call void @llvm.amdgcn.s.waitcnt(i32 %flags)
-  ret void
-}
-
-attributes #0 = { nounwind }
-attributes #1 = { nounwind alwaysinline }


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


[libclc] r346083 - amdgcn-amdhsa: Convert get_{global, local}_size to clc for all llvm versions

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:39:30 2018
New Revision: 346083

URL: http://llvm.org/viewvc/llvm-project?rev=346083=rev
Log:
amdgcn-amdhsa: Convert get_{global,local}_size to clc for all llvm versions

Signed-off-by: Jan Vesely 
Acked-By: Aaron Watry 

Removed:
libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES
libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_3.9
libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_4.0
libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_5.0
libclc/trunk/amdgcn-amdhsa/lib/SOURCES_3.9
libclc/trunk/amdgcn-amdhsa/lib/SOURCES_4.0
libclc/trunk/amdgcn-amdhsa/lib/SOURCES_5.0
libclc/trunk/amdgcn-amdhsa/lib/workitem/get_global_size.39.ll
libclc/trunk/amdgcn-amdhsa/lib/workitem/get_global_size.50.ll
libclc/trunk/amdgcn-amdhsa/lib/workitem/get_local_size.39.ll
libclc/trunk/amdgcn-amdhsa/lib/workitem/get_local_size.50.ll
Modified:
libclc/trunk/amdgcn-amdhsa/lib/workitem/get_global_size.cl
libclc/trunk/amdgcn-amdhsa/lib/workitem/get_local_size.cl

Removed: libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES?rev=346082=auto
==
--- libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES (original)
+++ libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES (removed)
@@ -1,6 +0,0 @@
-workitem/get_num_groups.ll
-workitem/get_global_size.ll
-workitem/get_local_size.ll
-workitem/get_num_groups.40.ll
-workitem/get_global_size.40.ll
-workitem/get_local_size.40.ll

Removed: libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_3.9?rev=346082=auto
==
--- libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_3.9 (original)
+++ libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_3.9 (removed)
@@ -1,3 +0,0 @@
-workitem/get_global_size.cl
-workitem/get_local_size.cl
-workitem/get_num_groups.39.ll

Removed: libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_4.0?rev=346082=auto
==
--- libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_4.0 (original)
+++ libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_4.0 (removed)
@@ -1,2 +0,0 @@
-workitem/get_global_size.cl
-workitem/get_local_size.cl

Removed: libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_5.0?rev=346082=auto
==
--- libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_5.0 (original)
+++ libclc/trunk/amdgcn-amdhsa/lib/OVERRIDES_5.0 (removed)
@@ -1,2 +0,0 @@
-workitem/get_global_size.cl
-workitem/get_local_size.cl

Removed: libclc/trunk/amdgcn-amdhsa/lib/SOURCES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-amdhsa/lib/SOURCES_3.9?rev=346082=auto
==
--- libclc/trunk/amdgcn-amdhsa/lib/SOURCES_3.9 (original)
+++ libclc/trunk/amdgcn-amdhsa/lib/SOURCES_3.9 (removed)
@@ -1,2 +0,0 @@
-workitem/get_global_size.39.ll
-workitem/get_local_size.39.ll

Removed: libclc/trunk/amdgcn-amdhsa/lib/SOURCES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-amdhsa/lib/SOURCES_4.0?rev=346082=auto
==
--- libclc/trunk/amdgcn-amdhsa/lib/SOURCES_4.0 (original)
+++ libclc/trunk/amdgcn-amdhsa/lib/SOURCES_4.0 (removed)
@@ -1,2 +0,0 @@
-workitem/get_global_size.50.ll
-workitem/get_local_size.50.ll

Removed: libclc/trunk/amdgcn-amdhsa/lib/SOURCES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-amdhsa/lib/SOURCES_5.0?rev=346082=auto
==
--- libclc/trunk/amdgcn-amdhsa/lib/SOURCES_5.0 (original)
+++ libclc/trunk/amdgcn-amdhsa/lib/SOURCES_5.0 (removed)
@@ -1,2 +0,0 @@
-workitem/get_global_size.50.ll
-workitem/get_local_size.50.ll

Removed: libclc/trunk/amdgcn-amdhsa/lib/workitem/get_global_size.39.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn-amdhsa/lib/workitem/get_global_size.39.ll?rev=346082=auto
==
--- libclc/trunk/amdgcn-amdhsa/lib/workitem/get_global_size.39.ll (original)
+++ libclc/trunk/amdgcn-amdhsa/lib/workitem/get_global_size.39.ll (removed)
@@ -1,36 +0,0 @@
-declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() #0
-
-define i32 @get_global_size(i32 %dim) #1 {
-  %dispatch_ptr = call noalias nonnull dereferenceable(64) i8 addrspace(2)* 
@llvm.amdgcn.dispatch.ptr()
-  switch i32 %dim, label %default [
-i32 0, label %x
-i32 1, label %y
-i32 2, label %z
-  ]
-
-x:
-  %ptr_x = getelementptr inbounds i8, i8 addrspace(2)* %dispatch_ptr, i32 12
-  %ptr_x32 = bitcast i8 

[libclc] r346081 - amdgcn: Convert get_num_groups to clc

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:39:25 2018
New Revision: 346081

URL: http://llvm.org/viewvc/llvm-project?rev=346081=rev
Log:
amdgcn: Convert get_num_groups to clc

Signed-off-by: Jan Vesely 
Reviewed-By: Aaron Watry 

Added:
libclc/trunk/amdgcn/lib/workitem/get_num_groups.cl
Removed:
libclc/trunk/amdgcn/lib/workitem/get_num_groups.39.ll
libclc/trunk/amdgcn/lib/workitem/get_num_groups.40.ll
libclc/trunk/amdgcn/lib/workitem/get_num_groups.ll
Modified:
libclc/trunk/amdgcn/lib/OVERRIDES_3.9
libclc/trunk/amdgcn/lib/OVERRIDES_4.0
libclc/trunk/amdgcn/lib/OVERRIDES_5.0
libclc/trunk/amdgcn/lib/OVERRIDES_6.0
libclc/trunk/amdgcn/lib/SOURCES
libclc/trunk/amdgcn/lib/SOURCES_3.9
libclc/trunk/amdgcn/lib/SOURCES_4.0
libclc/trunk/amdgcn/lib/SOURCES_5.0
libclc/trunk/amdgcn/lib/SOURCES_6.0

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_3.9?rev=346081=346080=346081=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_3.9 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_3.9 Sat Nov  3 17:39:25 2018
@@ -1,2 +1 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
-workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_4.0?rev=346081=346080=346081=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_4.0 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_4.0 Sat Nov  3 17:39:25 2018
@@ -1,2 +1 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
-workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_5.0?rev=346081=346080=346081=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_5.0 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_5.0 Sat Nov  3 17:39:25 2018
@@ -1,2 +1 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
-workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_6.0?rev=346081=346080=346081=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_6.0 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_6.0 Sat Nov  3 17:39:25 2018
@@ -1,2 +1 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
-workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES?rev=346081=346080=346081=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES (original)
+++ libclc/trunk/amdgcn/lib/SOURCES Sat Nov  3 17:39:25 2018
@@ -10,5 +10,5 @@ workitem/get_group_id.cl
 workitem/get_global_size.cl
 workitem/get_local_id.cl
 workitem/get_local_size.cl
-workitem/get_num_groups.ll
+workitem/get_num_groups.cl
 workitem/get_work_dim.cl

Modified: libclc/trunk/amdgcn/lib/SOURCES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_3.9?rev=346081=346080=346081=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_3.9 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_3.9 Sat Nov  3 17:39:25 2018
@@ -1,3 +1,2 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
 mem_fence/waitcnt.ll
-workitem/get_num_groups.39.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_4.0?rev=346081=346080=346081=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_4.0 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_4.0 Sat Nov  3 17:39:25 2018
@@ -1,3 +1,2 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
 mem_fence/waitcnt.ll
-workitem/get_num_groups.40.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_5.0?rev=346081=346080=346081=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_5.0 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_5.0 Sat Nov  3 17:39:25 2018
@@ -1,2 +1 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
-workitem/get_num_groups.40.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_6.0?rev=346081=346080=346081=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_6.0 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_6.0 Sat Nov  3 17:39:25 2018
@@ -1,2 +1 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll

[libclc] r346080 - amdgcn: Convert get_global_size to clc

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:39:20 2018
New Revision: 346080

URL: http://llvm.org/viewvc/llvm-project?rev=346080=rev
Log:
amdgcn: Convert get_global_size to clc

Signed-off-by: Jan Vesely 
Reviewed-By: Aaron Watry 

Added:
libclc/trunk/amdgcn/lib/workitem/get_global_size.cl
Removed:
libclc/trunk/amdgcn/lib/workitem/get_global_size.39.ll
libclc/trunk/amdgcn/lib/workitem/get_global_size.40.ll
libclc/trunk/amdgcn/lib/workitem/get_global_size.ll
Modified:
libclc/trunk/amdgcn/lib/OVERRIDES_3.9
libclc/trunk/amdgcn/lib/OVERRIDES_4.0
libclc/trunk/amdgcn/lib/OVERRIDES_5.0
libclc/trunk/amdgcn/lib/OVERRIDES_6.0
libclc/trunk/amdgcn/lib/SOURCES
libclc/trunk/amdgcn/lib/SOURCES_3.9
libclc/trunk/amdgcn/lib/SOURCES_4.0
libclc/trunk/amdgcn/lib/SOURCES_5.0
libclc/trunk/amdgcn/lib/SOURCES_6.0

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_3.9?rev=346080=346079=346080=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_3.9 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_3.9 Sat Nov  3 17:39:20 2018
@@ -1,3 +1,2 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
-workitem/get_global_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_4.0?rev=346080=346079=346080=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_4.0 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_4.0 Sat Nov  3 17:39:20 2018
@@ -1,3 +1,2 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
-workitem/get_global_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_5.0?rev=346080=346079=346080=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_5.0 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_5.0 Sat Nov  3 17:39:20 2018
@@ -1,3 +1,2 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
-workitem/get_global_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_6.0?rev=346080=346079=346080=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_6.0 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_6.0 Sat Nov  3 17:39:20 2018
@@ -1,3 +1,2 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
-workitem/get_global_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES?rev=346080=346079=346080=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES (original)
+++ libclc/trunk/amdgcn/lib/SOURCES Sat Nov  3 17:39:20 2018
@@ -7,7 +7,7 @@ mem_fence/fence.cl
 synchronization/barrier.cl
 workitem/get_global_offset.cl
 workitem/get_group_id.cl
-workitem/get_global_size.ll
+workitem/get_global_size.cl
 workitem/get_local_id.cl
 workitem/get_local_size.cl
 workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_3.9?rev=346080=346079=346080=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_3.9 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_3.9 Sat Nov  3 17:39:20 2018
@@ -1,4 +1,3 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
 mem_fence/waitcnt.ll
-workitem/get_global_size.39.ll
 workitem/get_num_groups.39.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_4.0?rev=346080=346079=346080=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_4.0 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_4.0 Sat Nov  3 17:39:20 2018
@@ -1,4 +1,3 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
 mem_fence/waitcnt.ll
-workitem/get_global_size.40.ll
 workitem/get_num_groups.40.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_5.0?rev=346080=346079=346080=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_5.0 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_5.0 Sat Nov  3 17:39:20 2018
@@ -1,3 +1,2 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
-workitem/get_global_size.40.ll
 workitem/get_num_groups.40.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES_6.0
URL: 

[libclc] r346079 - amdgcn: Convert get_local_size to clc

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:39:16 2018
New Revision: 346079

URL: http://llvm.org/viewvc/llvm-project?rev=346079=rev
Log:
amdgcn: Convert get_local_size to clc

Signed-off-by: Jan Vesely 
Reviewed-By: Aaron Watry 

Added:
libclc/trunk/amdgcn/lib/workitem/get_local_size.cl
Removed:
libclc/trunk/amdgcn/lib/workitem/get_local_size.39.ll
libclc/trunk/amdgcn/lib/workitem/get_local_size.40.ll
libclc/trunk/amdgcn/lib/workitem/get_local_size.ll
Modified:
libclc/trunk/amdgcn/lib/OVERRIDES_3.9
libclc/trunk/amdgcn/lib/OVERRIDES_4.0
libclc/trunk/amdgcn/lib/OVERRIDES_5.0
libclc/trunk/amdgcn/lib/OVERRIDES_6.0
libclc/trunk/amdgcn/lib/SOURCES
libclc/trunk/amdgcn/lib/SOURCES_3.9
libclc/trunk/amdgcn/lib/SOURCES_4.0
libclc/trunk/amdgcn/lib/SOURCES_5.0
libclc/trunk/amdgcn/lib/SOURCES_6.0

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_3.9?rev=346079=346078=346079=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_3.9 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_3.9 Sat Nov  3 17:39:16 2018
@@ -1,4 +1,3 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
 workitem/get_global_size.ll
-workitem/get_local_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_4.0?rev=346079=346078=346079=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_4.0 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_4.0 Sat Nov  3 17:39:16 2018
@@ -1,4 +1,3 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
 workitem/get_global_size.ll
-workitem/get_local_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_5.0?rev=346079=346078=346079=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_5.0 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_5.0 Sat Nov  3 17:39:16 2018
@@ -1,4 +1,3 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
 workitem/get_global_size.ll
-workitem/get_local_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/OVERRIDES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/OVERRIDES_6.0?rev=346079=346078=346079=diff
==
--- libclc/trunk/amdgcn/lib/OVERRIDES_6.0 (original)
+++ libclc/trunk/amdgcn/lib/OVERRIDES_6.0 Sat Nov  3 17:39:16 2018
@@ -1,4 +1,3 @@
 cl_khr_int64_extended_atomics/minmax_helpers.ll
 workitem/get_global_size.ll
-workitem/get_local_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES?rev=346079=346078=346079=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES (original)
+++ libclc/trunk/amdgcn/lib/SOURCES Sat Nov  3 17:39:16 2018
@@ -9,6 +9,6 @@ workitem/get_global_offset.cl
 workitem/get_group_id.cl
 workitem/get_global_size.ll
 workitem/get_local_id.cl
-workitem/get_local_size.ll
+workitem/get_local_size.cl
 workitem/get_num_groups.ll
 workitem/get_work_dim.cl

Modified: libclc/trunk/amdgcn/lib/SOURCES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_3.9?rev=346079=346078=346079=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_3.9 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_3.9 Sat Nov  3 17:39:16 2018
@@ -1,5 +1,4 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
 mem_fence/waitcnt.ll
 workitem/get_global_size.39.ll
-workitem/get_local_size.39.ll
 workitem/get_num_groups.39.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_4.0?rev=346079=346078=346079=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_4.0 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_4.0 Sat Nov  3 17:39:16 2018
@@ -1,5 +1,4 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
 mem_fence/waitcnt.ll
 workitem/get_global_size.40.ll
-workitem/get_local_size.40.ll
 workitem/get_num_groups.40.ll

Modified: libclc/trunk/amdgcn/lib/SOURCES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/SOURCES_5.0?rev=346079=346078=346079=diff
==
--- libclc/trunk/amdgcn/lib/SOURCES_5.0 (original)
+++ libclc/trunk/amdgcn/lib/SOURCES_5.0 Sat Nov  3 17:39:16 2018
@@ -1,4 +1,3 @@
 cl_khr_int64_extended_atomics/minmax_helpers.39.ll
 workitem/get_global_size.40.ll
-workitem/get_local_size.40.ll
 

[libclc] r346075 - r600: Convert get_local_size to clc

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:35:03 2018
New Revision: 346075

URL: http://llvm.org/viewvc/llvm-project?rev=346075=rev
Log:
r600: Convert get_local_size to clc

Signed-off-by: Jan Vesely 
Reviewer: Aaron Watry

Added:
libclc/trunk/r600/lib/workitem/get_local_size.cl
Removed:
libclc/trunk/r600/lib/workitem/get_local_size.39.ll
libclc/trunk/r600/lib/workitem/get_local_size.ll
Modified:
libclc/trunk/r600/lib/OVERRIDES_3.9
libclc/trunk/r600/lib/OVERRIDES_4.0
libclc/trunk/r600/lib/OVERRIDES_5.0
libclc/trunk/r600/lib/OVERRIDES_6.0
libclc/trunk/r600/lib/SOURCES
libclc/trunk/r600/lib/SOURCES_3.9
libclc/trunk/r600/lib/SOURCES_4.0
libclc/trunk/r600/lib/SOURCES_5.0
libclc/trunk/r600/lib/SOURCES_6.0

Modified: libclc/trunk/r600/lib/OVERRIDES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_3.9?rev=346075=346074=346075=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_3.9 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_3.9 Sat Nov  3 17:35:03 2018
@@ -1,4 +1,3 @@
 synchronization/barrier_impl.ll
 workitem/get_global_size.ll
-workitem/get_local_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/OVERRIDES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_4.0?rev=346075=346074=346075=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_4.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_4.0 Sat Nov  3 17:35:03 2018
@@ -1,4 +1,3 @@
 synchronization/barrier_impl.ll
 workitem/get_global_size.ll
-workitem/get_local_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/OVERRIDES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_5.0?rev=346075=346074=346075=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_5.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_5.0 Sat Nov  3 17:35:03 2018
@@ -1,4 +1,3 @@
 synchronization/barrier_impl.ll
 workitem/get_global_size.ll
-workitem/get_local_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/OVERRIDES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_6.0?rev=346075=346074=346075=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_6.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_6.0 Sat Nov  3 17:35:03 2018
@@ -1,4 +1,3 @@
 synchronization/barrier_impl.ll
 workitem/get_global_size.ll
-workitem/get_local_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES?rev=346075=346074=346075=diff
==
--- libclc/trunk/r600/lib/SOURCES (original)
+++ libclc/trunk/r600/lib/SOURCES Sat Nov  3 17:35:03 2018
@@ -5,6 +5,6 @@ workitem/get_global_offset.cl
 workitem/get_group_id.cl
 workitem/get_global_size.ll
 workitem/get_local_id.cl
-workitem/get_local_size.ll
+workitem/get_local_size.cl
 workitem/get_num_groups.ll
 workitem/get_work_dim.cl

Modified: libclc/trunk/r600/lib/SOURCES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_3.9?rev=346075=346074=346075=diff
==
--- libclc/trunk/r600/lib/SOURCES_3.9 (original)
+++ libclc/trunk/r600/lib/SOURCES_3.9 Sat Nov  3 17:35:03 2018
@@ -15,5 +15,4 @@ image/write_imageui.cl
 image/write_image_impl.ll
 synchronization/barrier_impl.39.ll
 workitem/get_global_size.39.ll
-workitem/get_local_size.39.ll
 workitem/get_num_groups.39.ll

Modified: libclc/trunk/r600/lib/SOURCES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_4.0?rev=346075=346074=346075=diff
==
--- libclc/trunk/r600/lib/SOURCES_4.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_4.0 Sat Nov  3 17:35:03 2018
@@ -1,4 +1,3 @@
 synchronization/barrier_impl.39.ll
 workitem/get_global_size.39.ll
-workitem/get_local_size.39.ll
 workitem/get_num_groups.39.ll

Modified: libclc/trunk/r600/lib/SOURCES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_5.0?rev=346075=346074=346075=diff
==
--- libclc/trunk/r600/lib/SOURCES_5.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_5.0 Sat Nov  3 17:35:03 2018
@@ -1,4 +1,3 @@
 synchronization/barrier_impl.39.ll
 workitem/get_global_size.39.ll
-workitem/get_local_size.39.ll
 workitem/get_num_groups.39.ll

Modified: libclc/trunk/r600/lib/SOURCES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_6.0?rev=346075=346074=346075=diff
==

[libclc] r346078 - r600: Convert barrier to clc

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:35:15 2018
New Revision: 346078

URL: http://llvm.org/viewvc/llvm-project?rev=346078=rev
Log:
r600: Convert barrier to clc

Signed-off-by: Jan Vesely 
Reviewer: Aaron Watry

Added:
libclc/trunk/r600/lib/synchronization/barrier.cl
Removed:
libclc/trunk/r600/lib/OVERRIDES_3.9
libclc/trunk/r600/lib/OVERRIDES_4.0
libclc/trunk/r600/lib/OVERRIDES_5.0
libclc/trunk/r600/lib/OVERRIDES_6.0
libclc/trunk/r600/lib/SOURCES_4.0
libclc/trunk/r600/lib/SOURCES_5.0
libclc/trunk/r600/lib/SOURCES_6.0
libclc/trunk/r600/lib/synchronization/barrier_impl.39.ll
libclc/trunk/r600/lib/synchronization/barrier_impl.ll
Modified:
libclc/trunk/r600/lib/SOURCES
libclc/trunk/r600/lib/SOURCES_3.9

Removed: libclc/trunk/r600/lib/OVERRIDES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_3.9?rev=346077=auto
==
--- libclc/trunk/r600/lib/OVERRIDES_3.9 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_3.9 (removed)
@@ -1 +0,0 @@
-synchronization/barrier_impl.ll

Removed: libclc/trunk/r600/lib/OVERRIDES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_4.0?rev=346077=auto
==
--- libclc/trunk/r600/lib/OVERRIDES_4.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_4.0 (removed)
@@ -1 +0,0 @@
-synchronization/barrier_impl.ll

Removed: libclc/trunk/r600/lib/OVERRIDES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_5.0?rev=346077=auto
==
--- libclc/trunk/r600/lib/OVERRIDES_5.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_5.0 (removed)
@@ -1 +0,0 @@
-synchronization/barrier_impl.ll

Removed: libclc/trunk/r600/lib/OVERRIDES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_6.0?rev=346077=auto
==
--- libclc/trunk/r600/lib/OVERRIDES_6.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_6.0 (removed)
@@ -1 +0,0 @@
-synchronization/barrier_impl.ll

Modified: libclc/trunk/r600/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES?rev=346078=346077=346078=diff
==
--- libclc/trunk/r600/lib/SOURCES (original)
+++ libclc/trunk/r600/lib/SOURCES Sat Nov  3 17:35:15 2018
@@ -1,6 +1,6 @@
 math/fmax.cl
 math/fmin.cl
-synchronization/barrier_impl.ll
+synchronization/barrier.cl
 workitem/get_global_offset.cl
 workitem/get_group_id.cl
 workitem/get_global_size.cl

Modified: libclc/trunk/r600/lib/SOURCES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_3.9?rev=346078=346077=346078=diff
==
--- libclc/trunk/r600/lib/SOURCES_3.9 (original)
+++ libclc/trunk/r600/lib/SOURCES_3.9 Sat Nov  3 17:35:15 2018
@@ -13,4 +13,3 @@ image/write_imagef.cl
 image/write_imagei.cl
 image/write_imageui.cl
 image/write_image_impl.ll
-synchronization/barrier_impl.39.ll

Removed: libclc/trunk/r600/lib/SOURCES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_4.0?rev=346077=auto
==
--- libclc/trunk/r600/lib/SOURCES_4.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_4.0 (removed)
@@ -1 +0,0 @@
-synchronization/barrier_impl.39.ll

Removed: libclc/trunk/r600/lib/SOURCES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_5.0?rev=346077=auto
==
--- libclc/trunk/r600/lib/SOURCES_5.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_5.0 (removed)
@@ -1 +0,0 @@
-synchronization/barrier_impl.39.ll

Removed: libclc/trunk/r600/lib/SOURCES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_6.0?rev=346077=auto
==
--- libclc/trunk/r600/lib/SOURCES_6.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_6.0 (removed)
@@ -1 +0,0 @@
-synchronization/barrier_impl.39.ll

Added: libclc/trunk/r600/lib/synchronization/barrier.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/synchronization/barrier.cl?rev=346078=auto
==
--- libclc/trunk/r600/lib/synchronization/barrier.cl (added)
+++ libclc/trunk/r600/lib/synchronization/barrier.cl Sat Nov  3 17:35:15 2018
@@ -0,0 +1,9 @@
+#include 
+
+_CLC_DEF void __clc_r600_barrier(void) __asm("llvm.r600.group.barrier");
+
+_CLC_DEF void barrier(uint flags)
+{
+  // We should call mem_fence here, but that is not implemented for r600 yet
+  __clc_r600_barrier();
+}

Removed: 

[libclc] r346077 - r600: Convert get_num_groups to clc

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:35:12 2018
New Revision: 346077

URL: http://llvm.org/viewvc/llvm-project?rev=346077=rev
Log:
r600: Convert get_num_groups to clc

Signed-off-by: Jan Vesely 
Reviewer: Aaron Watry

Added:
libclc/trunk/r600/lib/workitem/get_num_groups.cl
Removed:
libclc/trunk/r600/lib/workitem/get_num_groups.39.ll
libclc/trunk/r600/lib/workitem/get_num_groups.ll
Modified:
libclc/trunk/r600/lib/OVERRIDES_3.9
libclc/trunk/r600/lib/OVERRIDES_4.0
libclc/trunk/r600/lib/OVERRIDES_5.0
libclc/trunk/r600/lib/OVERRIDES_6.0
libclc/trunk/r600/lib/SOURCES
libclc/trunk/r600/lib/SOURCES_3.9
libclc/trunk/r600/lib/SOURCES_4.0
libclc/trunk/r600/lib/SOURCES_5.0
libclc/trunk/r600/lib/SOURCES_6.0

Modified: libclc/trunk/r600/lib/OVERRIDES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_3.9?rev=346077=346076=346077=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_3.9 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_3.9 Sat Nov  3 17:35:12 2018
@@ -1,2 +1 @@
 synchronization/barrier_impl.ll
-workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/OVERRIDES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_4.0?rev=346077=346076=346077=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_4.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_4.0 Sat Nov  3 17:35:12 2018
@@ -1,2 +1 @@
 synchronization/barrier_impl.ll
-workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/OVERRIDES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_5.0?rev=346077=346076=346077=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_5.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_5.0 Sat Nov  3 17:35:12 2018
@@ -1,2 +1 @@
 synchronization/barrier_impl.ll
-workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/OVERRIDES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_6.0?rev=346077=346076=346077=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_6.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_6.0 Sat Nov  3 17:35:12 2018
@@ -1,2 +1 @@
 synchronization/barrier_impl.ll
-workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES?rev=346077=346076=346077=diff
==
--- libclc/trunk/r600/lib/SOURCES (original)
+++ libclc/trunk/r600/lib/SOURCES Sat Nov  3 17:35:12 2018
@@ -6,5 +6,5 @@ workitem/get_group_id.cl
 workitem/get_global_size.cl
 workitem/get_local_id.cl
 workitem/get_local_size.cl
-workitem/get_num_groups.ll
+workitem/get_num_groups.cl
 workitem/get_work_dim.cl

Modified: libclc/trunk/r600/lib/SOURCES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_3.9?rev=346077=346076=346077=diff
==
--- libclc/trunk/r600/lib/SOURCES_3.9 (original)
+++ libclc/trunk/r600/lib/SOURCES_3.9 Sat Nov  3 17:35:12 2018
@@ -14,4 +14,3 @@ image/write_imagei.cl
 image/write_imageui.cl
 image/write_image_impl.ll
 synchronization/barrier_impl.39.ll
-workitem/get_num_groups.39.ll

Modified: libclc/trunk/r600/lib/SOURCES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_4.0?rev=346077=346076=346077=diff
==
--- libclc/trunk/r600/lib/SOURCES_4.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_4.0 Sat Nov  3 17:35:12 2018
@@ -1,2 +1 @@
 synchronization/barrier_impl.39.ll
-workitem/get_num_groups.39.ll

Modified: libclc/trunk/r600/lib/SOURCES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_5.0?rev=346077=346076=346077=diff
==
--- libclc/trunk/r600/lib/SOURCES_5.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_5.0 Sat Nov  3 17:35:12 2018
@@ -1,2 +1 @@
 synchronization/barrier_impl.39.ll
-workitem/get_num_groups.39.ll

Modified: libclc/trunk/r600/lib/SOURCES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_6.0?rev=346077=346076=346077=diff
==
--- libclc/trunk/r600/lib/SOURCES_6.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_6.0 Sat Nov  3 17:35:12 2018
@@ -1,2 +1 @@
 synchronization/barrier_impl.39.ll
-workitem/get_num_groups.39.ll

Removed: libclc/trunk/r600/lib/workitem/get_num_groups.39.ll
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/workitem/get_num_groups.39.ll?rev=346076=auto

[libclc] r346076 - r600: Convert get_global_size to clc

2018-11-03 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sat Nov  3 17:35:08 2018
New Revision: 346076

URL: http://llvm.org/viewvc/llvm-project?rev=346076=rev
Log:
r600: Convert get_global_size to clc

Signed-off-by: Jan Vesely 
Reviewer: Aaron Watry

Added:
libclc/trunk/r600/lib/workitem/get_global_size.cl
Removed:
libclc/trunk/r600/lib/workitem/get_global_size.39.ll
libclc/trunk/r600/lib/workitem/get_global_size.ll
Modified:
libclc/trunk/r600/lib/OVERRIDES_3.9
libclc/trunk/r600/lib/OVERRIDES_4.0
libclc/trunk/r600/lib/OVERRIDES_5.0
libclc/trunk/r600/lib/OVERRIDES_6.0
libclc/trunk/r600/lib/SOURCES
libclc/trunk/r600/lib/SOURCES_3.9
libclc/trunk/r600/lib/SOURCES_4.0
libclc/trunk/r600/lib/SOURCES_5.0
libclc/trunk/r600/lib/SOURCES_6.0

Modified: libclc/trunk/r600/lib/OVERRIDES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_3.9?rev=346076=346075=346076=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_3.9 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_3.9 Sat Nov  3 17:35:08 2018
@@ -1,3 +1,2 @@
 synchronization/barrier_impl.ll
-workitem/get_global_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/OVERRIDES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_4.0?rev=346076=346075=346076=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_4.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_4.0 Sat Nov  3 17:35:08 2018
@@ -1,3 +1,2 @@
 synchronization/barrier_impl.ll
-workitem/get_global_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/OVERRIDES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_5.0?rev=346076=346075=346076=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_5.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_5.0 Sat Nov  3 17:35:08 2018
@@ -1,3 +1,2 @@
 synchronization/barrier_impl.ll
-workitem/get_global_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/OVERRIDES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/OVERRIDES_6.0?rev=346076=346075=346076=diff
==
--- libclc/trunk/r600/lib/OVERRIDES_6.0 (original)
+++ libclc/trunk/r600/lib/OVERRIDES_6.0 Sat Nov  3 17:35:08 2018
@@ -1,3 +1,2 @@
 synchronization/barrier_impl.ll
-workitem/get_global_size.ll
 workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES?rev=346076=346075=346076=diff
==
--- libclc/trunk/r600/lib/SOURCES (original)
+++ libclc/trunk/r600/lib/SOURCES Sat Nov  3 17:35:08 2018
@@ -3,7 +3,7 @@ math/fmin.cl
 synchronization/barrier_impl.ll
 workitem/get_global_offset.cl
 workitem/get_group_id.cl
-workitem/get_global_size.ll
+workitem/get_global_size.cl
 workitem/get_local_id.cl
 workitem/get_local_size.cl
 workitem/get_num_groups.ll

Modified: libclc/trunk/r600/lib/SOURCES_3.9
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_3.9?rev=346076=346075=346076=diff
==
--- libclc/trunk/r600/lib/SOURCES_3.9 (original)
+++ libclc/trunk/r600/lib/SOURCES_3.9 Sat Nov  3 17:35:08 2018
@@ -14,5 +14,4 @@ image/write_imagei.cl
 image/write_imageui.cl
 image/write_image_impl.ll
 synchronization/barrier_impl.39.ll
-workitem/get_global_size.39.ll
 workitem/get_num_groups.39.ll

Modified: libclc/trunk/r600/lib/SOURCES_4.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_4.0?rev=346076=346075=346076=diff
==
--- libclc/trunk/r600/lib/SOURCES_4.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_4.0 Sat Nov  3 17:35:08 2018
@@ -1,3 +1,2 @@
 synchronization/barrier_impl.39.ll
-workitem/get_global_size.39.ll
 workitem/get_num_groups.39.ll

Modified: libclc/trunk/r600/lib/SOURCES_5.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_5.0?rev=346076=346075=346076=diff
==
--- libclc/trunk/r600/lib/SOURCES_5.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_5.0 Sat Nov  3 17:35:08 2018
@@ -1,3 +1,2 @@
 synchronization/barrier_impl.39.ll
-workitem/get_global_size.39.ll
 workitem/get_num_groups.39.ll

Modified: libclc/trunk/r600/lib/SOURCES_6.0
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/SOURCES_6.0?rev=346076=346075=346076=diff
==
--- libclc/trunk/r600/lib/SOURCES_6.0 (original)
+++ libclc/trunk/r600/lib/SOURCES_6.0 Sat Nov  3 17:35:08 2018
@@ -1,3 +1,2 @@
 

[PATCH] D54064: [Driver] Always match resource dir in Fuchsia driver tests

2018-11-03 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr accepted this revision.
mcgrathr added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rC Clang

https://reviews.llvm.org/D54064



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


[PATCH] D53854: [Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia

2018-11-03 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr added inline comments.



Comment at: lib/Driver/ToolChains/Fuchsia.cpp:128
 if (OnlyLibstdcxxStatic)
-  CmdArgs.push_back("-Bstatic");
+  CmdArgs.push_back("-static");
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);

MaskRay wrote:
> If Fuchsia doesn't use gold, it is fine. gold diverges from ld.bfd (lld) in 
> that `-static` switches the whole link to its special static mode. (as 
> usually while you link libstdc++/libc++ statically, you can still link other 
> libraries normally)
> 
> In ld.bfd/lld, `-Bstatic` is synonym with `-static`.
I think this part of the change was unintentional and should be undone.
Using `--pop-state` obviates the need for `-Bdynamic` to undo `-Bstatic`, but 
`-Bstatic` is still the right switch here.


Repository:
  rC Clang

https://reviews.llvm.org/D53854



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


[PATCH] D52835: [Diagnostics] Check integer to floating point number implicit conversions

2018-11-03 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 updated this revision to Diff 172509.

https://reviews.llvm.org/D52835

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaChecking.cpp
  test/Sema/ext_vector_casts.c
  test/Sema/impcast-integer-float.c

Index: test/Sema/impcast-integer-float.c
===
--- test/Sema/impcast-integer-float.c
+++ test/Sema/impcast-integer-float.c
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 %s -verify -Wfloat-precision -fsyntax-only
+
+#define shift_plus_one(x) ((1ULL << x) + 1)
+
+void test(void) {
+float a1 = (1ULL << 31) + 1; // expected-warning {{implicit conversion from 'unsigned long long' to 'float' changes value from 2147483649 to 2.1474836E+9}}
+float a2 = 1ULL << 31;
+float a3 = shift_plus_one(31); // expected-warning {{implicit conversion from 'unsigned long long' to 'float' changes value from 2147483649 to 2.1474836E+9}}
+float a4 = (1ULL << 31) - 1; // expected-warning {{implicit conversion from 'unsigned long long' to 'float' changes value from 2147483647 to 2.1474836E+9}}
+
+double b1 = (1ULL << 63) + 1; // expected-warning {{implicit conversion from 'unsigned long long' to 'double' changes value from 9223372036854775809 to 9.223372036854775E+18}}
+double b2 = 1ULL << 63;
+double b3 = shift_plus_one(63); // expected-warning {{implicit conversion from 'unsigned long long' to 'double' changes value from 9223372036854775809 to 9.223372036854775E+18}}
+double b4 = (1ULL << 63) - 1; // expected-warning {{implicit conversion from 'unsigned long long' to 'double' changes value from 9223372036854775807 to 9.223372036854775E+18}} 
+
+long double c1 = ((__int128)1 << 127) + 1; // expected-warning {{implicit conversion from '__int128' to 'long double' changes value from -170141183460469231731687303715884105727 to -1.7014118346046923173E+38}}
+long double c2 = (__int128)1 << 127;
+
+_Float16 d1 = (1ULL << 15) + 1; // expected-warning {{implicit conversion from 'unsigned long long' to '_Float16' changes value from 32769 to 3.277E+4}}
+_Float16 d2 = 1ULL << 15;
+_Float16 d3 = shift_plus_one(15); // expected-warning {{implicit conversion from 'unsigned long long' to '_Float16' changes value from 32769 to 3.277E+4}}
+_Float16 d4 = (1ULL << 15) - 1; // expected-warning {{implicit conversion from 'unsigned long long' to '_Float16' changes value from 32767 to 3.277E+4}}
+
+float e = (__uint128_t)-1; // expected-warning {{implicit conversion from '__uint128_t' (aka 'unsigned __int128') to 'float' changes value from 340282366920938463463374607431768211455 to +Inf}}
+}
Index: test/Sema/ext_vector_casts.c
===
--- test/Sema/ext_vector_casts.c
+++ test/Sema/ext_vector_casts.c
@@ -118,7 +118,7 @@
   vf = l + vf;
   vf = 2.0 + vf;
   vf = d + vf; // expected-warning {{implicit conversion loses floating-point precision}}
-  vf = vf + 0x;
+  vf = vf + 0x; // expected-warning {{implicit conversion from 'unsigned int' to 'float2' (vector of 2 'float' values) changes value from 4294967295 to 4.2949673E+9}}
   vf = vf + 2.1; // expected-warning {{implicit conversion loses floating-point precision}}
   
   vd = l + vd;
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -105,6 +105,19 @@
Context.getTargetInfo());
 }
 
+// FIXME: Force the precision of the source value down so we don't print
+// digits which are usually useless (we don't really care here if we
+// truncate a digit by accident in edge cases).  Ideally, APFloat::toString
+// would automatically print the shortest representation, but it's a bit
+// tricky to implement.
+static void PrettyPrintFloat(const llvm::APFloat ,
+ const llvm::fltSemantics ,
+ SmallVectorImpl ) {
+  unsigned precision = llvm::APFloat::semanticsPrecision(floatSem);
+  precision = llvm::divideCeil(precision * 59, 196);
+  floatValue.toString(prettyFloatValue, precision);
+}
+
 /// Checks that a call expression's argument count is the desired number.
 /// This is useful when doing custom type-checking.  Returns true on error.
 static bool checkArgCount(Sema , CallExpr *call, unsigned desiredArgCount) {
@@ -10467,15 +10480,8 @@
 DiagID = diag::warn_impcast_float_to_integer;
   }
 
-  // FIXME: Force the precision of the source value down so we don't print
-  // digits which are usually useless (we don't really care here if we
-  // truncate a digit by accident in edge cases).  Ideally, APFloat::toString
-  // would automatically print the shortest representation, but it's a bit
-  // tricky to implement.
   SmallString<16> PrettySourceValue;
-  unsigned precision = llvm::APFloat::semanticsPrecision(Value.getSemantics());
-  precision = (precision * 59 + 195) / 196;
-  

[PATCH] D54075: [coroutines] Fix fallthrough warning on try/catch

2018-11-03 Thread Brian Gesiak via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC346074: [coroutines] Fix fallthrough warning on try/catch 
(authored by modocache, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D54075?vs=172498=172508#toc

Repository:
  rC Clang

https://reviews.llvm.org/D54075

Files:
  lib/Analysis/CFG.cpp
  test/SemaCXX/coreturn-eh.cpp

Index: test/SemaCXX/coreturn-eh.cpp
===
--- test/SemaCXX/coreturn-eh.cpp
+++ test/SemaCXX/coreturn-eh.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts -fcxx-exceptions -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify -fblocks -Wall -Wextra -Wno-error=unreachable-code
+// expected-no-diagnostics
+
+#include "Inputs/std-coroutine.h"
+
+using std::experimental::suspend_always;
+using std::experimental::suspend_never;
+
+struct awaitable {
+  bool await_ready();
+  void await_suspend(std::experimental::coroutine_handle<>); // FIXME: coroutine_handle
+  void await_resume();
+} a;
+
+struct object { ~object() {} };
+
+struct promise_void_return_value {
+  void get_return_object();
+  suspend_always initial_suspend();
+  suspend_always final_suspend();
+  void unhandled_exception();
+  void return_value(object);
+};
+
+struct VoidTagReturnValue {
+  struct promise_type {
+VoidTagReturnValue get_return_object();
+suspend_always initial_suspend();
+suspend_always final_suspend();
+void unhandled_exception();
+void return_value(object);
+  };
+};
+
+template 
+struct std::experimental::coroutine_traits { using promise_type = promise_void_return_value; };
+
+VoidTagReturnValue test() {
+  object x = {};
+  try {
+co_return {};
+  } catch (...) {
+throw;
+  }
+}
Index: lib/Analysis/CFG.cpp
===
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -571,7 +571,7 @@
   CFGBlock *VisitObjCForCollectionStmt(ObjCForCollectionStmt *S);
   CFGBlock *VisitObjCMessageExpr(ObjCMessageExpr *E, AddStmtChoice asc);
   CFGBlock *VisitPseudoObjectExpr(PseudoObjectExpr *E);
-  CFGBlock *VisitReturnStmt(ReturnStmt *R);
+  CFGBlock *VisitReturnStmt(Stmt *S);
   CFGBlock *VisitSEHExceptStmt(SEHExceptStmt *S);
   CFGBlock *VisitSEHFinallyStmt(SEHFinallyStmt *S);
   CFGBlock *VisitSEHLeaveStmt(SEHLeaveStmt *S);
@@ -2147,7 +2147,8 @@
   return VisitPseudoObjectExpr(cast(S));
 
 case Stmt::ReturnStmtClass:
-  return VisitReturnStmt(cast(S));
+case Stmt::CoreturnStmtClass:
+  return VisitReturnStmt(S);
 
 case Stmt::SEHExceptStmtClass:
   return VisitSEHExceptStmt(cast(S));
@@ -2877,31 +2878,33 @@
   return LastBlock;
 }
 
-CFGBlock *CFGBuilder::VisitReturnStmt(ReturnStmt *R) {
+CFGBlock *CFGBuilder::VisitReturnStmt(Stmt *S) {
   // If we were in the middle of a block we stop processing that block.
   //
-  // NOTE: If a "return" appears in the middle of a block, this means that the
-  //   code afterwards is DEAD (unreachable).  We still keep a basic block
-  //   for that code; a simple "mark-and-sweep" from the entry block will be
-  //   able to report such dead blocks.
+  // NOTE: If a "return" or "co_return" appears in the middle of a block, this
+  //   means that the code afterwards is DEAD (unreachable).  We still keep
+  //   a basic block for that code; a simple "mark-and-sweep" from the entry
+  //   block will be able to report such dead blocks.
+  assert(isa(S) || isa(S));
 
   // Create the new block.
   Block = createBlock(false);
 
-  addAutomaticObjHandling(ScopePos, LocalScope::const_iterator(), R);
+  addAutomaticObjHandling(ScopePos, LocalScope::const_iterator(), S);
 
-  findConstructionContexts(
-  ConstructionContextLayer::create(cfg->getBumpVectorContext(), R),
-  R->getRetValue());
+  if (auto *R = dyn_cast(S))
+findConstructionContexts(
+ConstructionContextLayer::create(cfg->getBumpVectorContext(), R),
+R->getRetValue());
 
   // If the one of the destructors does not return, we already have the Exit
   // block as a successor.
   if (!Block->hasNoReturnElement())
 addSuccessor(Block, >getExit());
 
   // Add the return statement to the block.  This may create new blocks if R
   // contains control-flow (short-circuit operations).
-  return VisitStmt(R, AddStmtChoice::AlwaysAdd);
+  return VisitStmt(S, AddStmtChoice::AlwaysAdd);
 }
 
 CFGBlock *CFGBuilder::VisitSEHExceptStmt(SEHExceptStmt *ES) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D54075: [coroutines] Fix fallthrough warning on try/catch

2018-11-03 Thread Brian Gesiak via Phabricator via cfe-commits
modocache added a comment.

Great, thanks!


Repository:
  rC Clang

https://reviews.llvm.org/D54075



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


r346074 - [coroutines] Fix fallthrough warning on try/catch

2018-11-03 Thread Brian Gesiak via cfe-commits
Author: modocache
Date: Sat Nov  3 15:35:17 2018
New Revision: 346074

URL: http://llvm.org/viewvc/llvm-project?rev=346074=rev
Log:
[coroutines] Fix fallthrough warning on try/catch

Summary:
The test case added in this diff would incorrectly warn that control
flow may fall through without returning. Here's a standalone example:
https://godbolt.org/z/dCwXEi

The same program, but using `return` instead of `co_return`, does not
produce a warning: https://godbolt.org/z/mVldqQ

The issue was in how Clang analysis would structure its representation
of the control-flow graph. Specifically, when constructing the CFG,
`CFGBuilder::Visit` had special handling of a `ReturnStmt`, in which it
would place object destructors in the same CFG block as a `return` statement,
immediately after it. Doing so would allow the logic in
`lib/Sema/AnalysisBasedWarning.cpp` `CheckFallThrough` to work properly in the
program that used `return`, correctly determining that no "plain edges" preceded
the exit block of the function.

Because a `co_return` statement would not enjoy the same treatment when
it was being built into the control-flow graph, object destructors
would not be placed in the same CFG block as the `co_return`, thus
resulting in a "plain edge" preceding the exit block of the function,
and so the warning logic would be triggered.

Add special casing for `co_return` to Clang analysis, thereby
remedying the mistaken warning.

Test Plan: `check-clang`

Reviewers: GorNishanov, tks2103, rsmith

Reviewed By: GorNishanov

Subscribers: EricWF, lewissbaker, cfe-commits

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

Added:
cfe/trunk/test/SemaCXX/coreturn-eh.cpp
Modified:
cfe/trunk/lib/Analysis/CFG.cpp

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=346074=346073=346074=diff
==
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Sat Nov  3 15:35:17 2018
@@ -571,7 +571,7 @@ private:
   CFGBlock *VisitObjCForCollectionStmt(ObjCForCollectionStmt *S);
   CFGBlock *VisitObjCMessageExpr(ObjCMessageExpr *E, AddStmtChoice asc);
   CFGBlock *VisitPseudoObjectExpr(PseudoObjectExpr *E);
-  CFGBlock *VisitReturnStmt(ReturnStmt *R);
+  CFGBlock *VisitReturnStmt(Stmt *S);
   CFGBlock *VisitSEHExceptStmt(SEHExceptStmt *S);
   CFGBlock *VisitSEHFinallyStmt(SEHFinallyStmt *S);
   CFGBlock *VisitSEHLeaveStmt(SEHLeaveStmt *S);
@@ -2147,7 +2147,8 @@ CFGBlock *CFGBuilder::Visit(Stmt * S, Ad
   return VisitPseudoObjectExpr(cast(S));
 
 case Stmt::ReturnStmtClass:
-  return VisitReturnStmt(cast(S));
+case Stmt::CoreturnStmtClass:
+  return VisitReturnStmt(S);
 
 case Stmt::SEHExceptStmtClass:
   return VisitSEHExceptStmt(cast(S));
@@ -2877,22 +2878,24 @@ CFGBlock *CFGBuilder::VisitIfStmt(IfStmt
   return LastBlock;
 }
 
-CFGBlock *CFGBuilder::VisitReturnStmt(ReturnStmt *R) {
+CFGBlock *CFGBuilder::VisitReturnStmt(Stmt *S) {
   // If we were in the middle of a block we stop processing that block.
   //
-  // NOTE: If a "return" appears in the middle of a block, this means that the
-  //   code afterwards is DEAD (unreachable).  We still keep a basic block
-  //   for that code; a simple "mark-and-sweep" from the entry block will 
be
-  //   able to report such dead blocks.
+  // NOTE: If a "return" or "co_return" appears in the middle of a block, this
+  //   means that the code afterwards is DEAD (unreachable).  We still keep
+  //   a basic block for that code; a simple "mark-and-sweep" from the 
entry
+  //   block will be able to report such dead blocks.
+  assert(isa(S) || isa(S));
 
   // Create the new block.
   Block = createBlock(false);
 
-  addAutomaticObjHandling(ScopePos, LocalScope::const_iterator(), R);
+  addAutomaticObjHandling(ScopePos, LocalScope::const_iterator(), S);
 
-  findConstructionContexts(
-  ConstructionContextLayer::create(cfg->getBumpVectorContext(), R),
-  R->getRetValue());
+  if (auto *R = dyn_cast(S))
+findConstructionContexts(
+ConstructionContextLayer::create(cfg->getBumpVectorContext(), R),
+R->getRetValue());
 
   // If the one of the destructors does not return, we already have the Exit
   // block as a successor.
@@ -2901,7 +2904,7 @@ CFGBlock *CFGBuilder::VisitReturnStmt(Re
 
   // Add the return statement to the block.  This may create new blocks if R
   // contains control-flow (short-circuit operations).
-  return VisitStmt(R, AddStmtChoice::AlwaysAdd);
+  return VisitStmt(S, AddStmtChoice::AlwaysAdd);
 }
 
 CFGBlock *CFGBuilder::VisitSEHExceptStmt(SEHExceptStmt *ES) {

Added: cfe/trunk/test/SemaCXX/coreturn-eh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/coreturn-eh.cpp?rev=346074=auto
==
--- cfe/trunk/test/SemaCXX/coreturn-eh.cpp (added)

[PATCH] D54075: [coroutines] Fix fallthrough warning on try/catch

2018-11-03 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov accepted this revision.
GorNishanov added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rC Clang

https://reviews.llvm.org/D54075



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


[PATCH] D54048: [AST] Get aliased type info from an aliased TemplateSpecialization.

2018-11-03 Thread Matt Davis via Phabricator via cfe-commits
mattd updated this revision to Diff 172503.
mattd added a comment.

Thanks for the review @rjmccall.  I have moved the type-alias check into 
TemplateSpecializationType's desugar method.  I like this solution better.


https://reviews.llvm.org/D54048

Files:
  include/clang/AST/Type.h
  test/SemaCXX/alignof.cpp


Index: test/SemaCXX/alignof.cpp
===
--- test/SemaCXX/alignof.cpp
+++ test/SemaCXX/alignof.cpp
@@ -97,3 +97,8 @@
   typedef __attribute__((aligned(N))) int Field[sizeof(N)]; // expected-error 
{{requested alignment is dependent but declaration is not dependent}}
 };
 }
+
+typedef int __attribute__((aligned(16))) aligned_int;
+template 
+using template_alias = aligned_int;
+static_assert(alignof(template_alias) == 16, "Expected alignment of 16" 
);
Index: include/clang/AST/Type.h
===
--- include/clang/AST/Type.h
+++ include/clang/AST/Type.h
@@ -4901,7 +4901,9 @@
 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
   }
 
-  QualType desugar() const { return getCanonicalTypeInternal(); }
+  QualType desugar() const {
+return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
+  }
 
   void Profile(llvm::FoldingSetNodeID , const ASTContext ) {
 Profile(ID, Template, template_arguments(), Ctx);


Index: test/SemaCXX/alignof.cpp
===
--- test/SemaCXX/alignof.cpp
+++ test/SemaCXX/alignof.cpp
@@ -97,3 +97,8 @@
   typedef __attribute__((aligned(N))) int Field[sizeof(N)]; // expected-error {{requested alignment is dependent but declaration is not dependent}}
 };
 }
+
+typedef int __attribute__((aligned(16))) aligned_int;
+template 
+using template_alias = aligned_int;
+static_assert(alignof(template_alias) == 16, "Expected alignment of 16" );
Index: include/clang/AST/Type.h
===
--- include/clang/AST/Type.h
+++ include/clang/AST/Type.h
@@ -4901,7 +4901,9 @@
 return !isDependentType() || isCurrentInstantiation() || isTypeAlias();
   }
 
-  QualType desugar() const { return getCanonicalTypeInternal(); }
+  QualType desugar() const {
+return isTypeAlias() ? getAliasedType() : getCanonicalTypeInternal();
+  }
 
   void Profile(llvm::FoldingSetNodeID , const ASTContext ) {
 Profile(ID, Template, template_arguments(), Ctx);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D54077: [clangd] Implemented DraftFileSystem

2018-11-03 Thread Lutsenko Danil via Phabricator via cfe-commits
LutsenkoDanil created this revision.
LutsenkoDanil added reviewers: sammccall, ilya-biryukov.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay, 
ioeric.

Patch changes behavior of preamble building. If headers was changed in editor, 
preamble will be built with draft versions of them.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54077

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/DraftStore.cpp
  clangd/DraftStore.h
  clangd/FS.h
  clangd/FSProvider.h
  unittests/clangd/DraftStoreTests.cpp

Index: unittests/clangd/DraftStoreTests.cpp
===
--- unittests/clangd/DraftStoreTests.cpp
+++ unittests/clangd/DraftStoreTests.cpp
@@ -53,7 +53,7 @@
 Expected Result = DS.updateDraft(Path, {Event});
 ASSERT_TRUE(!!Result);
 EXPECT_EQ(*Result, SrcAfter.code());
-EXPECT_EQ(*DS.getDraft(Path), SrcAfter.code());
+EXPECT_EQ(DS.getDraft(Path)->Content, SrcAfter.code());
   }
 }
 
@@ -83,7 +83,7 @@
 
   ASSERT_TRUE(!!Result) << toString(Result.takeError());
   EXPECT_EQ(*Result, FinalSrc.code());
-  EXPECT_EQ(*DS.getDraft(Path), FinalSrc.code());
+  EXPECT_EQ(DS.getDraft(Path)->Content, FinalSrc.code());
 }
 
 TEST(DraftStoreIncrementalUpdateTest, Simple) {
@@ -339,9 +339,9 @@
   EXPECT_EQ(toString(Result.takeError()),
 "UTF-16 offset 100 is invalid for line 0");
 
-  Optional Contents = DS.getDraft(File);
-  EXPECT_TRUE(Contents);
-  EXPECT_EQ(*Contents, OriginalContents);
+  Optional NewDraft = DS.getDraft(File);
+  EXPECT_TRUE(NewDraft);
+  EXPECT_EQ(NewDraft->Content, OriginalContents);
 }
 
 } // namespace
Index: clangd/FSProvider.h
===
--- clangd/FSProvider.h
+++ clangd/FSProvider.h
@@ -10,6 +10,7 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_FSPROVIDER_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_FSPROVIDER_H
 
+#include "FS.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/Support/VirtualFileSystem.h"
 
@@ -38,6 +39,20 @@
   }
 };
 
+class DraftFileSystemProvider : public FileSystemProvider {
+  DraftStore 
+
+public:
+  DraftFileSystemProvider(DraftStore ) : DS(DS) {}
+
+  llvm::IntrusiveRefCntPtr
+  getFileSystem() const override {
+static llvm::IntrusiveRefCntPtr Result(
+new DraftFileSystem(llvm::vfs::getRealFileSystem(), DS));
+return Result;
+  }
+};
+
 } // namespace clangd
 } // namespace clang
 
Index: clangd/FS.h
===
--- clangd/FS.h
+++ clangd/FS.h
@@ -10,13 +10,84 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_FS_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_FS_H
 
+#include "DraftStore.h"
+#include "Logger.h"
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/VirtualFileSystem.h"
 
 namespace clang {
 namespace clangd {
 
+class DraftFile : public llvm::vfs::File {
+  std::unique_ptr F;
+  Draft DraftInfo;
+
+public:
+  DraftFile(std::unique_ptr F, Draft D)
+  : F(std::move(F)), DraftInfo(std::move(D)) {}
+
+  llvm::ErrorOr getName() override { return F->getName(); }
+
+  llvm::ErrorOr>
+  getBuffer(const Twine , int64_t FileSize, bool RequiresNullTerminator,
+bool IsVolatile) override {
+(void)IsVolatile;
+(void)RequiresNullTerminator;
+
+if (FileSize < 0) {
+  FileSize = DraftInfo.Content.size();
+}
+
+return llvm::MemoryBuffer::getMemBufferCopy(
+llvm::StringRef(DraftInfo.Content).substr(0, FileSize), Name);
+  }
+
+  llvm::ErrorOr status() override {
+auto RealStatus = F->status();
+
+if (!RealStatus) {
+  return RealStatus;
+}
+
+llvm::vfs::Status Result(
+RealStatus->getName(), RealStatus->getUniqueID(), DraftInfo.ModifyTime,
+RealStatus->getUser(), RealStatus->getGroup(), DraftInfo.Content.size(),
+RealStatus->getType(), RealStatus->getPermissions());
+
+Result.IsVFSMapped = RealStatus->IsVFSMapped;
+return Result;
+  }
+
+  std::error_code close() override { return F->close(); }
+};
+
+/// Wrapper around real FS. If file was changed in the DraftStrore, returns
+/// changed content, instead of real
+class DraftFileSystem : public llvm::vfs::ProxyFileSystem {
+  DraftStore 
+
+public:
+  DraftFileSystem(IntrusiveRefCntPtr FS, DraftStore )
+  : llvm::vfs::ProxyFileSystem(FS), DS(DS) {}
+
+  llvm::ErrorOr>
+  openFileForRead(const Twine ) override {
+auto Result = getUnderlyingFS().openFileForRead(Path);
+
+if (!Result) {
+  return Result;
+}
+
+if (auto D = DS.getDraft(Path.str())) {
+  return std::unique_ptr(
+  new DraftFile(std::move(*Result), std::move(*D)));
+}
+
+return Result;
+  }
+};
+
 /// Records status information for files open()ed or stat()ed during preamble
 /// build (except for the main file), so we can avoid stat()s on the underlying
 /// FS when reusing the preamble. For example, code completion can 

[PATCH] D54075: [coroutines] Fix fallthrough warning on try/catch

2018-11-03 Thread Brian Gesiak via Phabricator via cfe-commits
modocache created this revision.
modocache added reviewers: GorNishanov, tks2103, rsmith.
Herald added a subscriber: EricWF.

The test case added in this diff would incorrectly warn that control
flow may fall through without returning. Here's a standalone example:
https://godbolt.org/z/dCwXEi

The same program, but using `return` instead of `co_return`, does not
produce a warning: https://godbolt.org/z/mVldqQ

The issue was in how Clang analysis would structure its representation
of the control-flow graph. Specifically, when constructing the CFG,
`CFGBuilder::Visit` had special handling of a `ReturnStmt`, in which it
would place object destructors in the same CFG block as a `return` statement,
immediately after it. Doing so would allow the logic in
`lib/Sema/AnalysisBasedWarning.cpp` `CheckFallThrough` to work properly in the
program that used `return`, correctly determining that no "plain edges" preceded
the exit block of the function.

Because a `co_return` statement would not enjoy the same treatment when
it was being built into the control-flow graph, object destructors
would not be placed in the same CFG block as the `co_return`, thus
resulting in a "plain edge" preceding the exit block of the function,
and so the warning logic would be triggered.

Add special casing for `co_return` to Clang analysis, thereby
remedying the mistaken warning.

Test Plan: `check-clang`


Repository:
  rC Clang

https://reviews.llvm.org/D54075

Files:
  lib/Analysis/CFG.cpp
  test/SemaCXX/coreturn-eh.cpp

Index: test/SemaCXX/coreturn-eh.cpp
===
--- /dev/null
+++ test/SemaCXX/coreturn-eh.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 %s -std=c++14 -fcoroutines-ts -fcxx-exceptions -fsyntax-only -Wignored-qualifiers -Wno-error=return-type -verify -fblocks -Wall -Wextra -Wno-error=unreachable-code
+// expected-no-diagnostics
+
+#include "Inputs/std-coroutine.h"
+
+using std::experimental::suspend_always;
+using std::experimental::suspend_never;
+
+struct awaitable {
+  bool await_ready();
+  void await_suspend(std::experimental::coroutine_handle<>); // FIXME: coroutine_handle
+  void await_resume();
+} a;
+
+struct object { ~object() {} };
+
+struct promise_void_return_value {
+  void get_return_object();
+  suspend_always initial_suspend();
+  suspend_always final_suspend();
+  void unhandled_exception();
+  void return_value(object);
+};
+
+struct VoidTagReturnValue {
+  struct promise_type {
+VoidTagReturnValue get_return_object();
+suspend_always initial_suspend();
+suspend_always final_suspend();
+void unhandled_exception();
+void return_value(object);
+  };
+};
+
+template 
+struct std::experimental::coroutine_traits { using promise_type = promise_void_return_value; };
+
+VoidTagReturnValue test() {
+  object x = {};
+  try {
+co_return {};
+  } catch (...) {
+throw;
+  }
+}
Index: lib/Analysis/CFG.cpp
===
--- lib/Analysis/CFG.cpp
+++ lib/Analysis/CFG.cpp
@@ -571,7 +571,7 @@
   CFGBlock *VisitObjCForCollectionStmt(ObjCForCollectionStmt *S);
   CFGBlock *VisitObjCMessageExpr(ObjCMessageExpr *E, AddStmtChoice asc);
   CFGBlock *VisitPseudoObjectExpr(PseudoObjectExpr *E);
-  CFGBlock *VisitReturnStmt(ReturnStmt *R);
+  CFGBlock *VisitReturnStmt(Stmt *S);
   CFGBlock *VisitSEHExceptStmt(SEHExceptStmt *S);
   CFGBlock *VisitSEHFinallyStmt(SEHFinallyStmt *S);
   CFGBlock *VisitSEHLeaveStmt(SEHLeaveStmt *S);
@@ -2147,7 +2147,8 @@
   return VisitPseudoObjectExpr(cast(S));
 
 case Stmt::ReturnStmtClass:
-  return VisitReturnStmt(cast(S));
+case Stmt::CoreturnStmtClass:
+  return VisitReturnStmt(S);
 
 case Stmt::SEHExceptStmtClass:
   return VisitSEHExceptStmt(cast(S));
@@ -2877,31 +2878,33 @@
   return LastBlock;
 }
 
-CFGBlock *CFGBuilder::VisitReturnStmt(ReturnStmt *R) {
+CFGBlock *CFGBuilder::VisitReturnStmt(Stmt *S) {
   // If we were in the middle of a block we stop processing that block.
   //
-  // NOTE: If a "return" appears in the middle of a block, this means that the
-  //   code afterwards is DEAD (unreachable).  We still keep a basic block
-  //   for that code; a simple "mark-and-sweep" from the entry block will be
-  //   able to report such dead blocks.
+  // NOTE: If a "return" or "co_return" appears in the middle of a block, this
+  //   means that the code afterwards is DEAD (unreachable).  We still keep
+  //   a basic block for that code; a simple "mark-and-sweep" from the entry
+  //   block will be able to report such dead blocks.
+  assert(isa(S) || isa(S));
 
   // Create the new block.
   Block = createBlock(false);
 
-  addAutomaticObjHandling(ScopePos, LocalScope::const_iterator(), R);
+  addAutomaticObjHandling(ScopePos, LocalScope::const_iterator(), S);
 
-  findConstructionContexts(
-  ConstructionContextLayer::create(cfg->getBumpVectorContext(), R),
-  

[PATCH] D53780: Fix bitcast to address space cast for coerced load/stores

2018-11-03 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/CGCall.cpp:1257
+  Address Casted = CGF.Builder.CreateBitCast(Tmp, 
CGF.Int8Ty->getPointerTo(Tmp.getAddressSpace()));
+  Address SrcCasted = CGF.Builder.CreateBitCast(Src, 
CGF.Int8Ty->getPointerTo(Src.getAddressSpace()));
   CGF.Builder.CreateMemCpy(Casted, SrcCasted,

`CGBuilder` provides a convenient `CreateElementBitCast` function for this.


https://reviews.llvm.org/D53780



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


[PATCH] D54055: CXXNameMangler::mangleFunctionParam: fix assertion

2018-11-03 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Pfft, if I'm going to be held responsible for my own work, I'm in a lot of 
trouble. :)

Function name + local variable name WFM.


Repository:
  rC Clang

https://reviews.llvm.org/D54055



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


[PATCH] D51268: [libc++] Implement P0487R1 - Fixing operator>>(basic_istream&, CharT*)

2018-11-03 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 172497.
lichray added a comment.
Herald added a subscriber: libcxx-commits.

Rebased


Repository:
  rCXX libc++

https://reviews.llvm.org/D51268

Files:
  include/istream
  
test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
  
test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp
  
test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp

Index: test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp
===
--- test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp
+++ test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp
@@ -50,6 +50,17 @@
 assert(!is.fail());
 assert(std::string(s) == "abcdefghijk");
 }
+#if TEST_STD_VER > 17
+{
+testbuf sb("   abcdefghijk");
+std::istream is();
+char s[4];
+is >> s;
+assert(!is.eof());
+assert(!is.fail());
+assert(std::string(s) == "abc");
+}
+#endif
 {
 testbuf sb(L"   abcdefghijk");
 std::wistream is();
@@ -71,6 +82,17 @@
 assert(std::wstring(s) == L"abcdefghijk");
 assert(is.width() == 0);
 }
+#if TEST_STD_VER > 17
+{
+testbuf sb(L"   abcdefghijk");
+std::wistream is();
+wchar_t s[4];
+is >> s;
+assert(!is.eof());
+assert(!is.fail());
+assert(std::wstring(s) == L"abc");
+}
+#endif
 {
 testbuf sb("   abcdefghijk");
 std::istream is();
@@ -82,4 +104,15 @@
 assert(std::string(s) == "");
 assert(is.width() == 0);
 }
+#if TEST_STD_VER > 17
+{
+testbuf sb("   abcdefghijk");
+std::istream is();
+char s[1];
+is >> s;
+assert(!is.eof());
+assert( is.fail());
+assert(std::string(s) == "");
+}
+#endif
 }
Index: test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp
===
--- test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp
+++ test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp
@@ -61,6 +61,17 @@
 assert(std::string((char*)s) == "abc");
 assert(is.width() == 0);
 }
+#if TEST_STD_VER > 17
+{
+testbuf sb("   abcdefghijk");
+std::istream is();
+unsigned char s[4];
+is >> s;
+assert(!is.eof());
+assert(!is.fail());
+assert(std::string((char*)s) == "abc");
+}
+#endif
 {
 testbuf sb("   abcdefghijk");
 std::istream is();
@@ -82,4 +93,15 @@
 assert(std::string((char*)s) == "");
 assert(is.width() == 0);
 }
+#if TEST_STD_VER > 17
+{
+testbuf sb("   abcdefghijk");
+std::istream is();
+unsigned char s[1];
+is >> s;
+assert(!is.eof());
+assert( is.fail());
+assert(std::string((char*)s) == "");
+}
+#endif
 }
Index: test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
===
--- test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
+++ test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp
@@ -61,6 +61,17 @@
 assert(std::string((char*)s) == "abc");
 assert(is.width() == 0);
 }
+#if TEST_STD_VER > 17
+{
+testbuf sb("   abcdefghijk");
+std::istream is();
+signed char s[4];
+is >> s;
+assert(!is.eof());
+assert(!is.fail());
+assert(std::string((char*)s) == "abc");
+}
+#endif
 {
 testbuf sb("   abcdefghijk");
 std::istream is();
@@ -82,4 +93,15 @@
 assert(std::string((char*)s) == "");
 assert(is.width() == 0);
 }
+#if TEST_STD_VER > 17
+{
+testbuf sb("   abcdefghijk");
+std::istream is();
+signed char s[1];
+is >> s;
+assert(!is.eof());
+assert( is.fail());
+assert(std::string((char*)s) == "");
+}
+#endif
 }
Index: include/istream
===
--- include/istream
+++ include/istream
@@ -517,23 +517,21 @@
 }
 
 template
+_LIBCPP_INLINE_VISIBILITY
 basic_istream<_CharT, _Traits>&

[PATCH] D54048: [AST] Get aliased type info from an aliased TemplateSpecialization.

2018-11-03 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Changing how `TemplateSpecializationType` is declared in `TypeNodes.def` has 
way more implications than you're giving it credit for.

`FooType::desugar()` should always perform a single-step desugar, but on 
`TemplateSpecializationType` it's calling `getCanonicalTypeInternal()`, which 
is clearly not a single-step desugar for a template alias.  So I believe the 
fix here is as simple as just returning `getAliasedType()` from that method for 
template aliases.


https://reviews.llvm.org/D54048



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


[PATCH] D54055: CXXNameMangler::mangleFunctionParam: fix assertion

2018-11-03 Thread JF Bastien via Phabricator via cfe-commits
jfb added a comment.

In https://reviews.llvm.org/D54055#1286514, @rjmccall wrote:

> In https://reviews.llvm.org/D54055#1286397, @jfb wrote:
>
> > In https://reviews.llvm.org/D54055#1286396, @rjmccall wrote:
> >
> > > That sounds more like this use of the mangler isn't manipulating the 
> > > function type context correctly.  But actually I think the problem is 
> > > that it's ridiculous to assume that arbitrary local declarations have 
> > > meaningful manglings.  Why are we calling `getStaticDeclName` on a 
> > > variable that's obviously not static?
> >
> >
> > It was done in `CodeGenFunction::EmitAutoVarInit` a while ago. I moved it 
> > since then, but it's the same thing. I'm happy to mangle it any other way. 
> > At the end of the day we just need some name for an (unnamed address) 
> > global which is synthesized from a function-local initialization. We could 
> > just take the mangled function name and append something to it.
>
>
> Okay.  I assume this is internal-linkage and the name is just for debugging 
> purposes?  Maybe we could have an API to generate a best-effort name mangling 
> that could intentionally punt on variably-modified types.


I can do that, if you think that's the right approach. Or I can use mangled 
function name + something (instead of trying to synthesize a static mangling). 
That seems pretty simple and it'll always work.

> (I'm not really sure why the type is being mangled here anyway.)

Maybe the author of http://llvm.org/r127227 knows? :-)


Repository:
  rC Clang

https://reviews.llvm.org/D54055



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


[PATCH] D53705: [OpenCL] Postpone PSV address space diagnostic

2018-11-03 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

I'm just concerned about adding a great deal of complexity to mainline Clang in 
order to support a language that might still be in major flux and which I feel 
is likely to be forced to re-embrace qualifiers in the language model.  Maybe 
this work should happen in a branch for awhile, at least for superficial things 
— patches to e.g. generalize things at the IRGen level to handle address spaces 
in various C++ language features would still be welcome, since those are likely 
to be useful across language modes.


Repository:
  rC Clang

https://reviews.llvm.org/D53705



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


[PATCH] D54055: CXXNameMangler::mangleFunctionParam: fix assertion

2018-11-03 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D54055#1286397, @jfb wrote:

> In https://reviews.llvm.org/D54055#1286396, @rjmccall wrote:
>
> > That sounds more like this use of the mangler isn't manipulating the 
> > function type context correctly.  But actually I think the problem is that 
> > it's ridiculous to assume that arbitrary local declarations have meaningful 
> > manglings.  Why are we calling `getStaticDeclName` on a variable that's 
> > obviously not static?
>
>
> It was done in `CodeGenFunction::EmitAutoVarInit` a while ago. I moved it 
> since then, but it's the same thing. I'm happy to mangle it any other way. At 
> the end of the day we just need some name for an (unnamed address) global 
> which is synthesized from a function-local initialization. We could just take 
> the mangled function name and append something to it.


Okay.  I assume this is internal-linkage and the name is just for debugging 
purposes?  Maybe we could have an API to generate a best-effort name mangling 
that could intentionally punt on variably-modified types.  (I'm not really sure 
why the type is being mangled here anyway.)


Repository:
  rC Clang

https://reviews.llvm.org/D54055



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


[PATCH] D54061: [clang-tidy] run() doesn't update the SourceManager.

2018-11-03 Thread Stephen Kelly via Phabricator via cfe-commits
steveire added a comment.

After this change, it seems that `ClangTidyCheck::check` is not needed and all 
callers should be ported to call `run()` instead (and the private `run()` 
declaration should be removed from `ClangTidyCheck`.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54061



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


[PATCH] D54071: [Bug 39548][Clang] PGO bootstrap fails with python3: errors in perf-helper.py

2018-11-03 Thread Romain Geissler via Phabricator via cfe-commits
Romain-Geissler-1A created this revision.
Romain-Geissler-1A added reviewers: rsmith, vsk, beanz.
Herald added a subscriber: cfe-commits.
Romain-Geissler-1A edited the summary of this revision.

Hi,

Current clang fail to bootstrap in PGO mode when only python3 is available, 
because perf-helper.py is not compatible with python 3. We can see two errors:

File 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py", 
line 299
  by_count.sort(key = lambda (_,n): -n)
 ^
  SyntaxError: invalid syntax

which can be fixed by removing the parameter parenthesis.

And

  $ "/usr/bin/python3.6" 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py" 
"cc1" 
"/workdir/build/final-system/llvm-build/tools/clang/stage2-instrumented-bins/bin/clang"
 "-Wall" "-pedantic" "-c" 
"/home/jenkins/workspace/OTF_Toolchain_release_2.0-HLXHYRKCVDYQJLF23VGZ3MVAU6VGURX537LUE3KFVM2SSPMZ6IOA/output/src/llvm-7.0.0.src/tools/clang/utils/perf-training/cxx/hello_world.cpp"
  # command stderr:
  Traceback (most recent call last):
File 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py", 
line 408, in 
  main()
File 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py", 
line 405, in main
  sys.exit(f(sys.argv[2:]))
File 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py", 
line 159, in cc1
  cc1_cmd = get_cc1_command_for_args(cmd, cc1_env)
File 
"/workdir/src/llvm-7.0.0.src/tools/clang/utils/perf-training/perf-helper.py", 
line 119, in get_cc1_command_for_args
  for ln in cc_output.split('\n'):
  TypeError: a bytes-like object is required, not 'str'
  
  error: command failed with exit status: 1

which can be made both 2 and 3 compatible by using the attribute 
universal_newlines=True

Cheers,
Romain


Repository:
  rC Clang

https://reviews.llvm.org/D54071

Files:
  utils/perf-training/perf-helper.py


Index: utils/perf-training/perf-helper.py
===
--- utils/perf-training/perf-helper.py
+++ utils/perf-training/perf-helper.py
@@ -114,7 +114,7 @@
   # Find the cc1 command used by the compiler. To do this we execute the
   # compiler with '-###' to figure out what it wants to do.
   cmd = cmd + ['-###']
-  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, 
env=env).strip()
+  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env, 
universal_newlines=True).strip()
   cc_commands = []
   for ln in cc_output.split('\n'):
   # Filter out known garbage.
@@ -296,7 +296,7 @@
   counts[a] = counts.get(a,0) + 1
 
   by_count = counts.items()
-  by_count.sort(key = lambda (_,n): -n)
+  by_count.sort(key = lambda _,n: -n)
   return [s for s,n in by_count]
  
 def form_by_random(symbol_lists):
@@ -340,7 +340,7 @@
   # If the user gave us a binary, get all the symbols in the binary by
   # snarfing 'nm' output.
   if opts.binary_path is not None:
- output = subprocess.check_output(['nm', '-P', opts.binary_path])
+ output = subprocess.check_output(['nm', '-P', opts.binary_path], 
universal_newlines=True)
  lines = output.split("\n")
  all_symbols = [ln.split(' ',1)[0]
 for ln in lines


Index: utils/perf-training/perf-helper.py
===
--- utils/perf-training/perf-helper.py
+++ utils/perf-training/perf-helper.py
@@ -114,7 +114,7 @@
   # Find the cc1 command used by the compiler. To do this we execute the
   # compiler with '-###' to figure out what it wants to do.
   cmd = cmd + ['-###']
-  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env).strip()
+  cc_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env, universal_newlines=True).strip()
   cc_commands = []
   for ln in cc_output.split('\n'):
   # Filter out known garbage.
@@ -296,7 +296,7 @@
   counts[a] = counts.get(a,0) + 1
 
   by_count = counts.items()
-  by_count.sort(key = lambda (_,n): -n)
+  by_count.sort(key = lambda _,n: -n)
   return [s for s,n in by_count]
  
 def form_by_random(symbol_lists):
@@ -340,7 +340,7 @@
   # If the user gave us a binary, get all the symbols in the binary by
   # snarfing 'nm' output.
   if opts.binary_path is not None:
- output = subprocess.check_output(['nm', '-P', opts.binary_path])
+ output = subprocess.check_output(['nm', '-P', opts.binary_path], universal_newlines=True)
  lines = output.split("\n")
  all_symbols = [ln.split(' ',1)[0]
 for ln in lines
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-03 Thread Umann Kristóf via Phabricator via cfe-commits
Szelethus added a comment.

In https://reviews.llvm.org/D53974#1286434, @ztamas wrote:

> In https://reviews.llvm.org/D53974#1285930, @Szelethus wrote:
>
> > In https://reviews.llvm.org/D53974#1283759, @ZaMaZaN4iK wrote:
> >
> > > Hmm, i thought Clang has some warning for this, but I was wrong... Did 
> > > you think to implement this check as Clang warning?
> >
> >
> > That is an interesting point actually -- maybe it'd be worth doing that, 
> > and if more powerful analysis is required, Static Analyzer would be the 
> > next step. I haven't actually implemented any 'regular' clang warning, so 
> > I'm not sure.
>
>
> Well, I'm implementing it as a clang-tidy check now. I guess in the future 
> anyone can replace it with a clang warning if he/she can implement it 
> effectively (e.g. no false positives).
>
> My first impression was that having something accepted as clang static 
> analyzer check takes ages and so I expect that implementing something as a 
> clang warning takes even more time. My impression is based on bugzilla 
> activity and on some read review history. It seems to me it's not rare to 
> have comments like: "Ping, let's not abandon this change" or the author says 
> that he/she has no more time for further work, etc. However clang-tidy seems 
> more progressive. So I prefer to have something as a clang-tidy check (and 
> actually get it in the upstream tool) than implementing it as a clang warning 
> (if it can be implemented effectively at all), wait for a year of review and 
> most probably abandon the change. Of course, it's just a first impression, 
> but why should I take the risk. I think this clang-tidy check is powerful, so 
> useful to have it.


Okay, I'm sold on that :).


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974



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


r346070 - Fix test on Windows.

2018-11-03 Thread Douglas Yung via cfe-commits
Author: dyung
Date: Sat Nov  3 01:51:27 2018
New Revision: 346070

URL: http://llvm.org/viewvc/llvm-project?rev=346070=rev
Log:
Fix test on Windows.

This test checks the entire output of a help option, the problem
is that on Windows, the line break occurs in a different place
causing the CHECK to fail because it is not expecting a line break.


Modified:
cfe/trunk/test/Analysis/analyzer-list-configs.c

Modified: cfe/trunk/test/Analysis/analyzer-list-configs.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/analyzer-list-configs.c?rev=346070=346069=346070=diff
==
--- cfe/trunk/test/Analysis/analyzer-list-configs.c (original)
+++ cfe/trunk/test/Analysis/analyzer-list-configs.c Sat Nov  3 01:51:27 2018
@@ -23,7 +23,8 @@
 // CHECK:   integers are signed, greater than or equal
 // CHECK:   to the quarter of the minimum value of the
 // CHECK:   type and less than or equal to the quarter
-// CHECK:   of the maximum value of that type. A + n
+// CHECK:   of the maximum value of that type. A
+// CHECK:   + n
 // CHECK:B + m becomes A - B  m - n, where
 // CHECK:   A and B symbolic, n and m are integers.
 // CHECK:is any of '==', '!=', '<', '<=', '>',


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


Re: [llvm-dev] mips builders on LLVM buildbot?

2018-11-03 Thread Simon Atanasyan via cfe-commits
Hi Galina,

I will try to find owners of these buildbots. I hope to get results on
the next week.

On Sat, Nov 3, 2018 at 1:48 AM Daniel Sanders
 wrote:
>
> Hi Galina,
>
> I'm sad that they appear to have been abandoned but no objections from me as 
> I'm not the admin for any of these anymore. A couple of them were taken over 
> by a colleague when I left but he too has left MIPS since then. Simon 
> Atanasyan might be able to find the owners if there still are any.
>
> > On Nov 2, 2018, at 13:29, Galina Kistanova via llvm-dev 
> >  wrote:
> >
> > Hello everyone,
> >
> > There are few abandoned mips builders on LLVM buildbot:
> >
> > llvm-mips-linux
> > clang-cmake-mipsel
> > clang-cmake-mips
> >
> > I am going to remove them, if anyone has any objections, please speak up!

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


[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-03 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment.

In https://reviews.llvm.org/D53974#1285930, @Szelethus wrote:

> In https://reviews.llvm.org/D53974#1283759, @ZaMaZaN4iK wrote:
>
> > Hmm, i thought Clang has some warning for this, but I was wrong... Did you 
> > think to implement this check as Clang warning?
>
>
> That is an interesting point actually -- maybe it'd be worth doing that, and 
> if more powerful analysis is required, Static Analyzer would be the next 
> step. I haven't actually implemented any 'regular' clang warning, so I'm not 
> sure.


Well, I'm implementing it as a clang-tidy check now. I guess in the future 
anyone can replace it with a clang warning if he/she can implement it 
effectively (e.g. no false positives).

My first impression was that having something accepted as clang static analyzer 
check takes ages and so I expect that implementing something as a clang warning 
takes even more time. My impression is based on bugzilla activity and on some 
read review history. It seems to me it's not rare to have comments like: "Ping, 
let's not abandon this change" or the author says that he/she has no more time 
for further work, etc. However clang-tidy seems more progressive. So I prefer 
to have something as a clang-tidy check (and actually get it in the upstream 
tool) than implementing it as a clang warning (if it can be implemented 
effectively at all), wait for a year of review and most probably abandon the 
change. Of course, it's just a first impression, but why should I take the 
risk. I think this clang-tidy check is powerful, so useful to have it.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974



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


[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-03 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 172487.
ztamas marked an inline comment as done.
ztamas added a comment.

Update docs based on reviewer comment


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974

Files:
  clang-tidy/bugprone/BugproneTidyModule.cpp
  clang-tidy/bugprone/CMakeLists.txt
  clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
  clang-tidy/bugprone/TooSmallLoopVariableCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/bugprone-too-small-loop-variable.cpp

Index: test/clang-tidy/bugprone-too-small-loop-variable.cpp
===
--- /dev/null
+++ test/clang-tidy/bugprone-too-small-loop-variable.cpp
@@ -0,0 +1,204 @@
+// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t
+
+long size() { return 294967296l; }
+
+void voidBadForLoop() {
+  for (int i = 0; i < size(); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop2() {
+  for (int i = 0; i < size() + 10; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop3() {
+  for (int i = 0; i <= size() - 1; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop4() {
+  for (int i = 0; size() > i; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop5() {
+  for (int i = 0; size() - 1 >= i; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop6() {
+  int i = 0;
+  for (; i < size(); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidForLoopUnsignedCond() {
+  unsigned size = 3147483647;
+  for (int i = 0; i < size; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'unsigned int' [bugprone-too-small-loop-variable]
+  }
+}
+
+// False positive: because of the integer literal, loop condition has int type
+void voidForLoopFalsePositive() {
+  short size = 3;
+  bool cond = false;
+  for (short i = 0; i < (cond ? 0 : size); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: loop variable has narrower type 'short' than terminating condition 'int' [bugprone-too-small-loop-variable]
+  }
+}
+
+// A loop with a template value
+template
+void doSomething() {
+  for (short i = 0; i < size; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: loop variable has narrower type 'short' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+// A loop with a template type
+template
+void doSomething() {
+  for (T i = 0; i < size(); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: loop variable has narrower type 'short' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidForLoopInstantiation() {
+  doSomething(); // does not trigger the warning
+  doSomething(); // triggers the warning
+}
+
+// Simple use case when both expressions have the same type
+void voidGoodForLoop() {
+  for (long i = 0; i < size(); ++i) {
+  } // no warning
+}
+
+// Second simple use case when both expressions have the same type
+void voidGoodForLoop2() {
+  short loopCond = 10;
+  for (short i = 0; i < loopCond; ++i) {
+  } // no warning
+}
+
+// Because of the integer literal, the loop condition is int, but we suppress the warning here
+void voidForLoopShortPlusLiteral() {
+  short size = 3;
+  for (short i = 0; i <= (size - 1); ++i) {
+  } // no warning
+}
+
+// Additions of two short variable is converted to int, but we suppress this to avoid false positives
+void voidForLoopShortPlusShort() {
+  short size = 256;
+  short increment = 14;
+  for (short i = 0; i < size + increment; ++i) {
+  } // no warning
+}
+
+// Different integer types, but in this case the loop variable is the bigger type
+void voidForLoopReverseCond() {
+  short start = 256;
+  short end = 14;
+  for (int i = start; i >= end; --i) {
+  } // no warning
+}
+
+// TODO: handle while loop
+void voidBadWhileLoop() {
+  short i = 0;
+  while (i < size()) { // missing warning
+++i;
+  }
+}
+
+// TODO: handle do-while loop
+void voidBadDoWhileLoop() {
+  short i = 0;
+  do {
+++i;
+  } while (i < size()); // missing warning
+}
+
+// Test case with a reverse 

[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-03 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas marked 2 inline comments as done.
ztamas added inline comments.



Comment at: clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp:109
+
+if (RHSE->isInstantiationDependent() || LHSE->isInstantiationDependent())
+  return 0;

Szelethus wrote:
> You seem to have code for handling templates, but I don't see test cases for 
> it.
Thanks for mentioning it. I was overdefensive against false positives. This 
isInstantiationDependent() is not needed here. So I removed and added some test 
cases with templates.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974



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


[PATCH] D53974: [clang-tidy] new check: bugprone-too-small-loop-variable

2018-11-03 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 172486.
ztamas marked an inline comment as done.
ztamas added a comment.

- Analyze template dependant for loops too (add some test cases)
- Use double backticks for marking code in docs


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53974

Files:
  clang-tidy/bugprone/BugproneTidyModule.cpp
  clang-tidy/bugprone/CMakeLists.txt
  clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
  clang-tidy/bugprone/TooSmallLoopVariableCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/bugprone-too-small-loop-variable.cpp

Index: test/clang-tidy/bugprone-too-small-loop-variable.cpp
===
--- /dev/null
+++ test/clang-tidy/bugprone-too-small-loop-variable.cpp
@@ -0,0 +1,204 @@
+// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t
+
+long size() { return 294967296l; }
+
+void voidBadForLoop() {
+  for (int i = 0; i < size(); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop2() {
+  for (int i = 0; i < size() + 10; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop3() {
+  for (int i = 0; i <= size() - 1; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop4() {
+  for (int i = 0; size() > i; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop5() {
+  for (int i = 0; size() - 1 >= i; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidBadForLoop6() {
+  int i = 0;
+  for (; i < size(); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: loop variable has narrower type 'int' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidForLoopUnsignedCond() {
+  unsigned size = 3147483647;
+  for (int i = 0; i < size; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: loop variable has narrower type 'int' than terminating condition 'unsigned int' [bugprone-too-small-loop-variable]
+  }
+}
+
+// False positive: because of the integer literal, loop condition has int type
+void voidForLoopFalsePositive() {
+  short size = 3;
+  bool cond = false;
+  for (short i = 0; i < (cond ? 0 : size); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: loop variable has narrower type 'short' than terminating condition 'int' [bugprone-too-small-loop-variable]
+  }
+}
+
+// A loop with a template value
+template
+void doSomething() {
+  for (short i = 0; i < size; ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: loop variable has narrower type 'short' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+// A loop with a template type
+template
+void doSomething() {
+  for (T i = 0; i < size(); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: loop variable has narrower type 'short' than terminating condition 'long' [bugprone-too-small-loop-variable]
+  }
+}
+
+void voidForLoopInstantiation() {
+  doSomething(); // does not trigger the warning
+  doSomething(); // triggers the warning
+}
+
+// Simple use case when both expressions have the same type
+void voidGoodForLoop() {
+  for (long i = 0; i < size(); ++i) {
+  } // no warning
+}
+
+// Second simple use case when both expressions have the same type
+void voidGoodForLoop2() {
+  short loopCond = 10;
+  for (short i = 0; i < loopCond; ++i) {
+  } // no warning
+}
+
+// Because of the integer literal, the loop condition is int, but we suppress the warning here
+void voidForLoopShortPlusLiteral() {
+  short size = 3;
+  for (short i = 0; i <= (size - 1); ++i) {
+  } // no warning
+}
+
+// Additions of two short variable is converted to int, but we suppress this to avoid false positives
+void voidForLoopShortPlusShort() {
+  short size = 256;
+  short increment = 14;
+  for (short i = 0; i < size + increment; ++i) {
+  } // no warning
+}
+
+// Different integer types, but in this case the loop variable is the bigger type
+void voidForLoopReverseCond() {
+  short start = 256;
+  short end = 14;
+  for (int i = start; i >= end; --i) {
+  } // no warning
+}
+
+// TODO: handle while loop
+void voidBadWhileLoop() {
+  short i = 0;
+  while (i < size()) { // missing warning
+++i;
+  }
+}
+
+// TODO: handle do-while loop
+void voidBadDoWhileLoop() {
+  short i = 0;
+  do {
+++i;
+  } 

[PATCH] D51340: Add /Zc:DllexportInlines option to clang-cl

2018-11-03 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC346069: Add /Zc:DllexportInlines option to clang-cl 
(authored by tikuta, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51340?vs=172348=172485#toc

Repository:
  rC Clang

https://reviews.llvm.org/D51340

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/LangOptions.def
  include/clang/Driver/CC1Options.td
  include/clang/Driver/CLCompatOptions.td
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclCXX.cpp
  test/CodeGenCXX/dllexport-no-dllexport-inlines.cpp
  test/Driver/cl-options.c

Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -11930,14 +11930,40 @@
   assert(VD->isStaticLocal());
 
   auto *FD = dyn_cast_or_null(VD->getParentFunctionOrMethod());
+
+  // Find outermost function when VD is in lambda function.
+  while (FD && !getDLLAttr(FD) &&
+ !FD->hasAttr() &&
+ !FD->hasAttr()) {
+FD = dyn_cast_or_null(FD->getParentFunctionOrMethod());
+  }
+
   if (!FD)
 return;
 
   // Static locals inherit dll attributes from their function.
   if (Attr *A = getDLLAttr(FD)) {
 auto *NewAttr = cast(A->clone(getASTContext()));
 NewAttr->setInherited(true);
 VD->addAttr(NewAttr);
+  } else if (Attr *A = FD->getAttr()) {
+auto *NewAttr = ::new (getASTContext()) DLLExportAttr(A->getRange(),
+  getASTContext(),
+  A->getSpellingListIndex());
+NewAttr->setInherited(true);
+VD->addAttr(NewAttr);
+
+// Export this function to enforce exporting this static variable even
+// if it is not used in this compilation unit.
+if (!FD->hasAttr())
+  FD->addAttr(NewAttr);
+
+  } else if (Attr *A = FD->getAttr()) {
+auto *NewAttr = ::new (getASTContext()) DLLImportAttr(A->getRange(),
+  getASTContext(),
+  A->getSpellingListIndex());
+NewAttr->setInherited(true);
+VD->addAttr(NewAttr);
   }
 }
 
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -5707,8 +5707,28 @@
   continue;
 
 if (!getDLLAttr(Member)) {
-  auto *NewAttr =
-  cast(ClassAttr->clone(getASTContext()));
+  InheritableAttr *NewAttr = nullptr;
+
+  // Do not export/import inline function when -fno-dllexport-inlines is
+  // passed. But add attribute for later local static var check.
+  if (!getLangOpts().DllExportInlines && MD && MD->isInlined() &&
+  TSK != TSK_ExplicitInstantiationDeclaration &&
+  TSK != TSK_ExplicitInstantiationDefinition) {
+if (ClassExported) {
+  NewAttr = ::new (getASTContext())
+DLLExportStaticLocalAttr(ClassAttr->getRange(),
+ getASTContext(),
+ ClassAttr->getSpellingListIndex());
+} else {
+  NewAttr = ::new (getASTContext())
+DLLImportStaticLocalAttr(ClassAttr->getRange(),
+ getASTContext(),
+ ClassAttr->getSpellingListIndex());
+}
+  } else {
+NewAttr = cast(ClassAttr->clone(getASTContext()));
+  }
+
   NewAttr->setInherited(true);
   Member->addAttr(NewAttr);
 
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2179,6 +2179,9 @@
 }
   }
 
+  if (Args.hasArg(OPT_fno_dllexport_inlines))
+Opts.DllExportInlines = false;
+
   if (const Arg *A = Args.getLastArg(OPT_fcf_protection_EQ)) {
 StringRef Name = A->getValue();
 if (Name == "full" || Name == "branch") {
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -5504,6 +5504,11 @@
   if (VolatileOptionID == options::OPT__SLASH_volatile_ms)
 CmdArgs.push_back("-fms-volatile");
 
+ if (Args.hasFlag(options::OPT__SLASH_Zc_dllexportInlines_,
+  options::OPT__SLASH_Zc_dllexportInlines,
+  false))
+CmdArgs.push_back("-fno-dllexport-inlines");
+
   Arg *MostGeneralArg = Args.getLastArg(options::OPT__SLASH_vmg);
   Arg *BestCaseArg = Args.getLastArg(options::OPT__SLASH_vmb);
   if (MostGeneralArg && BestCaseArg)
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -2683,6 +2683,17 @@
   let 

r346069 - Add /Zc:DllexportInlines option to clang-cl

2018-11-03 Thread Takuto Ikuta via cfe-commits
Author: tikuta
Date: Fri Nov  2 23:45:00 2018
New Revision: 346069

URL: http://llvm.org/viewvc/llvm-project?rev=346069=rev
Log:
Add /Zc:DllexportInlines option to clang-cl

Summary:
This CL adds /Zc:DllexportInlines flag to clang-cl.
When Zc:DllexportInlines- is specified, inline class member function is not 
exported if the function does not have local static variables.

By not exporting inline function, code for those functions are not generated 
and that reduces both compile time and obj size. Also this flag does not import 
inline functions from dllimported class if the function does not have local 
static variables.

On my 24C48T windows10 machine, build performance of chrome target in chromium 
repository is like below.
These stats are come with 'target_cpu="x86" enable_nacl = false 
is_component_build=true dcheck_always_on=true` build config and applied
* https://chromium-review.googlesource.com/c/chromium/src/+/1212379
* https://chromium-review.googlesource.com/c/v8/v8/+/1186017

Below stats were taken with this patch applied on 
https://github.com/llvm-project/llvm-project-20170507/commit/a05115cd4c57ff76b0f529e38118765b58ed7f2e

| config  | build time | speedup | build dir size |
| with patch, PCH on, debug   | 1h10m0s| x1.13   | 35.6GB |
| without patch, PCH on, debug| 1h19m17s   | | 49.0GB |
| with patch, PCH off, debug  | 1h15m45s   | x1.16   | 33.7GB |
| without patch, PCH off, debug   | 1h28m10s   | | 52.3GB |
| with patch, PCH on, release | 1h13m13s   | x1.22   | 26.2GB |
| without patch, PCH on, release  | 1h29m57s   | | 37.5GB |
| with patch, PCH off, release| 1h23m38s   | x1.32   | 23.7GB |
| without patch, PCH off, release | 1h50m50s   | | 38.7GB |

This patch reduced obj size and the number of exported symbols largely, that 
improved link time too.
e.g. link time stats of blink_core.dll become like below
|  | cold disk cache | warm disk cache |
| with patch, PCH on, debug| 71s | 30s |
| without patch, PCH on, debug | 111s| 48s |

This patch's implementation is based on Nico Weber's patch. I modified to 
support static local variable, added tests and took stats.

Bug: https://bugs.llvm.org/show_bug.cgi?id=33628

Reviewers: hans, thakis, rnk, javed.absar

Reviewed By: hans

Subscribers: kristof.beyls, smeenai, dschuff, probinson, cfe-commits, eraman

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

Added:
cfe/trunk/test/CodeGenCXX/dllexport-no-dllexport-inlines.cpp
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=346069=346068=346069=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Nov  2 23:45:00 2018
@@ -2683,6 +2683,17 @@ def DLLExport : InheritableAttr, TargetS
   let Documentation = [DLLExportDocs];
 }
 
+def DLLExportStaticLocal : InheritableAttr, TargetSpecificAttr {
+  // This attribute is used internally only when -fno-dllexport-inlines is
+  // passed. This attribute is added to inline function of class having
+  // dllexport attribute. And if the function has static local variables, this
+  // attribute is used to whether the variables are exported or not. Also if
+  // function has local static variables, the function is dllexported too.
+  let Spellings = [];
+  let Subjects = SubjectList<[Function]>;
+  let Documentation = [Undocumented];
+}
+
 def DLLImport : InheritableAttr, TargetSpecificAttr {
   let Spellings = [Declspec<"dllimport">, GCC<"dllimport">];
   let Subjects = SubjectList<[Function, Var, CXXRecord, ObjCInterface]>;
@@ -2699,6 +2710,16 @@ public:
   }];
 }
 
+def DLLImportStaticLocal : InheritableAttr, TargetSpecificAttr {
+  // This attribute is used internally only when -fno-dllexport-inlines is
+  // passed. This attribute is added to inline function of class having
+  // dllimport attribute. And if the function has static local variables, this
+  // attribute is used to whether the variables are imported or not.
+  let Spellings = [];
+  let Subjects = SubjectList<[Function]>;
+  let Documentation = [Undocumented];
+}
+
 def SelectAny : InheritableAttr {
   let Spellings = [Declspec<"selectany">, GCC<"selectany">];
   let Documentation = [SelectAnyDocs];

Modified: