[PATCH] D99675: RFC [llvm][clang] Create new intrinsic llvm.arith.fence to control FP optimization at expression level

2021-04-16 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei added a comment.

In D99675#2695424 , @kpn wrote:

> What changes are needed for a backend, and what happens if they aren't done?

As far as I understand it, backend does optimizations based on patterns of the 
known nodes and MIs. Inserting a new node/MI will block any optimizations 
across the fence. So it respects the semantics of the intrinsic without target 
special chenges.
I'm not sure if there's room for optimization cross the `arithmetic.fence`. If 
there is and no changes for it, backend may have some performance loss under 
these circumstances.

> Having something needed for correctness silently not work seems ... 
> sub-optimal.

I think backend is conservative for optimizations when use the intrinsic. It 
won't have correctness issue silently, but performance loss might.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99675

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


[PATCH] D99543: [clang-tidy] Allow opt-in or out of some commonly occuring patterns in NarrowingConversionsCheck.

2021-04-16 Thread Stephen Concannon via Phabricator via cfe-commits
Stephen updated this revision to Diff 338273.
Stephen added a comment.

(fix patch to include all local changes)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99543

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.h
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-narrowing-conversions.rst
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-equivalentbitwidth-option.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-ignoreconversionfromtypes-option.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-intemplates-option.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-intemplates-option.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-intemplates-option.cpp
@@ -0,0 +1,35 @@
+// RUN: %check_clang_tidy -check-suffix=DEFAULT %s \
+// RUN: cppcoreguidelines-narrowing-conversions %t -- \
+// RUN: -config='{CheckOptions: [ \
+// RUN: ]}'
+
+// RUN: %check_clang_tidy -check-suffix=WARN %s \
+// RUN: cppcoreguidelines-narrowing-conversions %t -- \
+// RUN: -config='{CheckOptions: [ \
+// RUN:   {key: cppcoreguidelines-narrowing-conversions.WarnWithinTemplateInstantiation, value: 1} \
+// RUN: ]}'
+
+template 
+void assign_in_template(OrigType jj) {
+  int ii;
+  ii = jj;
+  // DEFAULT: Warning disabled because WarnWithinTemplateInstantiation=0.
+  // CHECK-MESSAGES-WARN: :[[@LINE-2]]:8: warning: narrowing conversion from 'long long' to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
+}
+
+void narrow_inside_template_not_ok() {
+  long long j = 123;
+  assign_in_template(j);
+}
+
+void assign_outside_template(long long jj) {
+  int ii;
+  ii = jj;
+  // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:8: warning: narrowing conversion from 'long long' to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
+  // CHECK-MESSAGES-WARN: :[[@LINE-2]]:8: warning: narrowing conversion from 'long long' to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
+}
+
+void narrow_outside_template_not_ok() {
+  long long j = 123;
+  assign_outside_template(j);
+}
Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-ignoreconversionfromtypes-option.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-ignoreconversionfromtypes-option.cpp
@@ -0,0 +1,84 @@
+// RUN: %check_clang_tidy -check-suffix=DEFAULT %s \
+// RUN: cppcoreguidelines-narrowing-conversions %t -- \
+// RUN: -config='{CheckOptions: [ \
+// RUN: ]}'
+
+// RUN: %check_clang_tidy -check-suffix=IGNORED %s \
+// RUN: cppcoreguidelines-narrowing-conversions %t -- \
+// RUN: -config='{CheckOptions: [ \
+// RUN:   {key: cppcoreguidelines-narrowing-conversions.IgnoreConversionFromTypes, value: "size_t;ptrdiff_t;size_type;difference_type"} \
+// RUN: ]}'
+
+typedef long long size_t;
+
+struct vector {
+  typedef long long size_type;
+  typedef long long difference_type;
+
+  size_t size() const { return 0; }
+};
+
+void narrowing_size_t() {
+  int i;
+  size_t j;
+  i = j;
+  // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:7: warning: narrowing conversion from 'size_t' (aka 'long long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
+  // IGNORED: Warning is disabled with IgnoreConversionFromTypes=size_t.
+}
+
+void narrowing_size_type() {
+  int i;
+  vector::size_type j;
+  i = j;
+  // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:7: warning: narrowing conversion from 'vector::size_type' (aka 'long long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
+  // IGNORED: Warning is disabled with IgnoreConversionFromTypes=size_type.
+}
+
+void narrowing_difference_type() {
+  int i;
+  vector::difference_type j;
+  i = j;
+  // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:7: warning: narrowing conversion from 'vector::difference_type' (aka 'long long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
+  // IGNORED: Warning is disabled with IgnoreConversionFromTypes=difference_type.
+}
+
+void narrowing_size_method() {
+  vector v;
+  int i, j;
+  i = v.size();
+  // CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:7: warning: narrowing conversion from 'size_t' (aka 'long long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
+  // IGNORED: Warning is disabled with IgnoreConversionFromTypes=size_t.
+
+  i = j + v.size();
+  // 

[PATCH] D99543: [clang-tidy] Allow opt-in or out of some commonly occuring patterns in NarrowingConversionsCheck.

2021-04-16 Thread Stephen Concannon via Phabricator via cfe-commits
Stephen requested review of this revision.
Stephen added a comment.

Thanks for the review! I think I've addressed the comments -- hopefully I kept 
it inline with what you're thinking. Please have another look at your leisure.




Comment at: 
clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp:82
+  const auto IsSizeTypeOrDifferenceType = hasType(
+  namedDecl(anyOf(hasName("size_type"), hasName("difference_type";
+

aaron.ballman wrote:
> Should this also support `size_t` and `ptrdiff_t` given that those are 
> usually the same as `size_type` and `difference_type`?
Thanks, yeah, that's a good idea. I was somewhat apprehensive to ignore all 
conversions involving size_t, but it's probably ok. Now that we are, we don't 
need the ::size() method stuff, so I removed that.

And it seemed like I might as well make the list of types configurable, so I 
rolled that in here too. So it's a bigger change that you maybe had intended, 
though hopefully not too far off the mark.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-equivalentbitwidth-off.cpp:1
+// RUN: %check_clang_tidy %s cppcoreguidelines-narrowing-conversions %t \
+// RUN: -config="{CheckOptions: [ \

hokein wrote:
> instead of having multiple individual test files, I think we can group them 
> into a single file, you can use the flag `-check-suffix=`, like
> 
> ```
> // RUN: %check_clang_tidy -check-suffix=TESTCASE1 ...
> // RUN: %check_clang_tidy -check-suffix=TESTCASE2 ...
> 
> 
> // some warning code for test-case1
> CHECK-MESSAGES-TESTCASE1: 
> ``` 
Thanks! Besides cutting down the number of files, it really helped clarify the 
distinction in behavior with the warning on/off.

I coalesced the on/off pairs into a single, but kept the options tested in 
separate files, as that seemed to be the pattern in place.

Let me know if you'd prefer to squeeze them into fewer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99543

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


[PATCH] D99543: [clang-tidy] Allow opt-in or out of some commonly occuring patterns in NarrowingConversionsCheck.

2021-04-16 Thread Stephen Concannon via Phabricator via cfe-commits
Stephen updated this revision to Diff 338272.
Stephen added a comment.

- Add ability to pass semi-colon separated list of types to ignore, instead of 
assuming only size_type and difference_type.
- Remove ability to avoid warnings on ::size() method, since it's subsumed by 
allowing narrowing conversions of size_t.
- Coalesce on/off option tests into per-option test files.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99543

Files:
  clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
  clang-tools-extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.h
  
clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-narrowing-conversions.rst
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-equivalentbitwidth-off.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-equivalentbitwidth-on.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-equivalentbitwidth-option.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-ignoreconversionfromtypes-option.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-intemplates-off.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-intemplates-on.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-intemplates-option.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-sizemethod-off.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-sizemethod-on.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-sizetypes-off.cpp
  
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-sizetypes-on.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-sizetypes-on.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-sizetypes-on.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-narrowing-conversions %t \
-// RUN: -config="{CheckOptions: [ \
-// RUN:   {key: "cppcoreguidelines-narrowing-conversions.WarnOnSizeTypeAndDifferenceType", value: 1} \
-// RUN: ]}" \
-// RUN: -- -target x86_64-unknown-linux -fsigned-char
-
-struct vector {
-  typedef long long size_type;
-  typedef long long difference_type;
-};
-
-void narrowing_size_type_is_not_ok() {
-  int i;
-  vector::size_type j;
-  i = j;
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: narrowing conversion from 'vector::size_type' (aka 'long long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
-}
-
-void narrowing_difference_type_is_not_ok() {
-  int i;
-  vector::difference_type j;
-  i = j;
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: narrowing conversion from 'vector::difference_type' (aka 'long long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
-}
Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-sizetypes-off.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-sizetypes-off.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// RUN: %check_clang_tidy %s cppcoreguidelines-narrowing-conversions %t \
-// RUN: -config="{CheckOptions: [ \
-// RUN:   {key: "cppcoreguidelines-narrowing-conversions.WarnOnSizeTypeAndDifferenceType", value: 0} \
-// RUN: ]}" \
-// RUN: -- -target x86_64-unknown-linux -fsigned-char
-struct vector {
-  typedef long long size_type;
-  typedef long long difference_type;
-};
-void narrowing_size_type_is_ok() {
-  int i;
-  vector::size_type j;
-  i = j;
-  // Warning disabled with WarnOnSizeTypeAndDifferenceType=0.
-}
-void narrowing_difference_type_is_ok() {
-  int i;
-  vector::difference_type j;
-  i = j;
-  // Warning disabled with WarnOnSizeTypeAndDifferenceType=0.
-}
-void most_narrowing_is_not_ok() {
-  int i;
-  long long j;
-  i = j;
-  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: narrowing conversion from 'long long' to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]
-}
Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-sizemethod-on.cpp
===
--- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-narrowing-conversions-sizemethod-on.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// RUN: %check_clang_tidy %s cppcoreguidelines-narrowing-conversions %t \
-// RUN: -config="{CheckOptions: [ \
-// RUN:   {key: 

[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-16 Thread Michael Kruse via Phabricator via cfe-commits
Meinersbur added inline comments.



Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:1141
   llvm::Value *IsWorker =
   Bld.CreateICmpULT(RT.getGPUThreadID(CGF), getThreadLimit(CGF));
   Bld.CreateCondBr(IsWorker, WorkerBB, MasterCheckBB);

There seem to be more unordered codegen calls, such as this one.



Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:1150
   llvm::Value *IsMaster =
   Bld.CreateICmpEQ(RT.getGPUThreadID(CGF), getMasterThreadID(CGF));
   Bld.CreateCondBr(IsMaster, MasterBB, EST.ExitBB);

There seem to be more unordered codegen calls, such as this one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D100619: [ASTReader] Only mark module out of date if not already compiled

2021-04-16 Thread Argyrios Kyrtzidis via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1206b95e0703: [ASTReader] Only mark module out of date if 
not already compiled (authored by bnbarham, committed by akyrtzi).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100619

Files:
  clang/lib/Serialization/ASTReader.cpp
  clang/test/Modules/Inputs/error/error.h
  clang/test/Modules/Inputs/error/module.modulemap
  clang/test/Modules/Inputs/error/use_error_a.h
  clang/test/Modules/Inputs/error/use_error_b.h
  clang/test/Modules/load-module-with-errors.m

Index: clang/test/Modules/load-module-with-errors.m
===
--- clang/test/Modules/load-module-with-errors.m
+++ clang/test/Modules/load-module-with-errors.m
@@ -2,10 +2,13 @@
 // matter in this test.
 
 // pcherror-error@* {{PCH file contains compiler errors}}
-@import error; // notallowerror-error {{could not build module 'error'}}
+@import use_error_a; // notallowerror-error {{could not build module 'use_error_a'}}
+@import use_error_b;
 // expected-no-diagnostics
 
 void test(Error *x) {
+  funca(x);
+  funcb(x);
   [x method];
 }
 
@@ -16,7 +19,16 @@
 // RUN: %clang_cc1 -fmodules -fallow-pcm-with-compiler-errors \
 // RUN:   -fmodule-name=error -o %t/prebuilt/error.pcm \
 // RUN:   -x objective-c -emit-module %S/Inputs/error/module.modulemap
+// RUN: %clang_cc1 -fmodules -fallow-pcm-with-compiler-errors \
+// RUN:   -fmodule-file=error=%t/prebuilt/error.pcm \
+// RUN:   -fmodule-name=use_error_a -o %t/prebuilt/use_error_a.pcm \
+// RUN:   -x objective-c -emit-module %S/Inputs/error/module.modulemap
+// RUN: %clang_cc1 -fmodules -fallow-pcm-with-compiler-errors \
+// RUN:   -fmodule-file=error=%t/prebuilt/error.pcm \
+// RUN:   -fmodule-name=use_error_b -o %t/prebuilt/use_error_b.pcm \
+// RUN:   -x objective-c -emit-module %S/Inputs/error/module.modulemap
 
+// Prebuilt modules
 // RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \
 // RUN:   -fprebuilt-module-path=%t/prebuilt -fmodules-cache-path=%t \
 // RUN:   -ast-print %s | FileCheck %s
@@ -24,33 +36,49 @@
 // RUN:   -fprebuilt-module-path=%t/prebuilt -fmodules-cache-path=%t \
 // RUN:   -verify=pcherror %s
 
+// Explicit prebuilt modules (loaded when needed)
 // RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \
-// RUN:   -fmodule-file=error=%t/prebuilt/error.pcm -fmodules-cache-path=%t \
-// RUN:   -ast-print %s | FileCheck %s
+// RUN:   -fmodule-file=error=%t/prebuilt/error.pcm \
+// RUN:   -fmodule-file=use_error_a=%t/prebuilt/use_error_a.pcm \
+// RUN:   -fmodule-file=use_error_b=%t/prebuilt/use_error_b.pcm \
+// RUN:   -fmodules-cache-path=%t -ast-print %s | FileCheck %s
 // RUN: %clang_cc1 -fsyntax-only -fmodules \
-// RUN:   -fmodule-file=error=%t/prebuilt/error.pcm -fmodules-cache-path=%t \
-// RUN:   -verify=pcherror %s
+// RUN:   -fmodule-file=error=%t/prebuilt/error.pcm \
+// RUN:   -fmodule-file=use_error_a=%t/prebuilt/use_error_a.pcm \
+// RUN:   -fmodule-file=use_error_b=%t/prebuilt/use_error_b.pcm \
+// RUN:   -fmodules-cache-path=%t -verify=pcherror %s
 
+// Explicit prebuilt modules without name (always loaded)
 // RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \
-// RUN:   -fmodule-file=%t/prebuilt/error.pcm -fmodules-cache-path=%t \
-// RUN:   -ast-print %s | FileCheck %s
+// RUN:   -fmodule-file=%t/prebuilt/error.pcm \
+// RUN:   -fmodule-file=%t/prebuilt/use_error_a.pcm \
+// RUN:   -fmodule-file=%t/prebuilt/use_error_b.pcm \
+// RUN:   -fmodules-cache-path=%t -ast-print %s | FileCheck %s
+// As the modules are always loaded, compiling will fail before even parsing
+// this file - this means that -verify can't be used, so do a grep instead.
 // RUN: not %clang_cc1 -fsyntax-only -fmodules \
-// RUN:   -fmodule-file=%t/prebuilt/error.pcm -fmodules-cache-path=%t \
-// RUN:   -verify=pcherror %s
+// RUN:   -fmodule-file=%t/prebuilt/error.pcm \
+// RUN:   -fmodule-file=%t/prebuilt/use_error_a.pcm \
+// RUN:   -fmodule-file=%t/prebuilt/use_error_b.pcm \
+// RUN:   -fmodules-cache-path=%t 2>&1 | \
+// RUN: grep "PCH file contains compiler errors"
 
-// Shouldn't build the cached module (that has errors) when not allowing errors
+// Shouldn't build the cached modules (that have errors) when not allowing
+// errors
 // RUN: not %clang_cc1 -fsyntax-only -fmodules \
 // RUN:   -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/error \
 // RUN:   -x objective-c %s
 // RUN: find %t -name "error-*.pcm" | not grep error
 
-// Should build the cached module when allowing errors
+// Should build the cached modules when allowing errors
 // RUN: %clang_cc1 -fsyntax-only -fmodules -fallow-pcm-with-compiler-errors \
 // RUN:   -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/error \
 // RUN:   -x objective-c -verify %s
 // RUN: find %t -name "error-*.pcm" | 

[clang] 1206b95 - [ASTReader] Only mark module out of date if not already compiled

2021-04-16 Thread Argyrios Kyrtzidis via cfe-commits

Author: Ben Barham
Date: 2021-04-16T17:57:03-07:00
New Revision: 1206b95e0703dc0a9b619a095d5564ac51c39d19

URL: 
https://github.com/llvm/llvm-project/commit/1206b95e0703dc0a9b619a095d5564ac51c39d19
DIFF: 
https://github.com/llvm/llvm-project/commit/1206b95e0703dc0a9b619a095d5564ac51c39d19.diff

LOG: [ASTReader] Only mark module out of date if not already compiled

If a module contains errors (ie. it was built with
-fallow-pcm-with-compiler-errors and had errors) and was from the module
cache, it is marked as out of date - see
a2c1054c303f20be006e9ef20739dbb88bd9ae02.

When a module is imported multiple times in the one compile, this caused
it to be recompiled each time - removing the existing buffer from the
module cache and replacing it. This results in various errors further
down the line.

Instead, only mark the module as out of date if it isn't already
finalized in the module cache.

Reviewed By: akyrtzi

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

Added: 
clang/test/Modules/Inputs/error/use_error_a.h
clang/test/Modules/Inputs/error/use_error_b.h

Modified: 
clang/lib/Serialization/ASTReader.cpp
clang/test/Modules/Inputs/error/error.h
clang/test/Modules/Inputs/error/module.modulemap
clang/test/Modules/load-module-with-errors.m

Removed: 




diff  --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index 72bb125397dbd..88fb35aae1b8a 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -2760,9 +2760,10 @@ ASTReader::ReadControlBlock(ModuleFile ,
 
   bool hasErrors = Record[6];
   if (hasErrors && !DisableValidation) {
-// If requested by the caller, mark modules on error as out-of-date.
-if (F.Kind == MK_ImplicitModule &&
-(ClientLoadCapabilities & ARR_TreatModuleWithErrorsAsOutOfDate))
+// If requested by the caller and the module hasn't already been read
+// or compiled, mark modules on error as out-of-date.
+if ((ClientLoadCapabilities & ARR_TreatModuleWithErrorsAsOutOfDate) &&
+!ModuleMgr.getModuleCache().isPCMFinal(F.FileName))
   return OutOfDate;
 
 if (!AllowASTWithCompilerErrors) {

diff  --git a/clang/test/Modules/Inputs/error/error.h 
b/clang/test/Modules/Inputs/error/error.h
index 1b27b21dfd635..fcdb408a4534f 100644
--- a/clang/test/Modules/Inputs/error/error.h
+++ b/clang/test/Modules/Inputs/error/error.h
@@ -1,3 +1,5 @@
+#pragma mark mark
+
 @import undefined;
 
 @interface Error

diff  --git a/clang/test/Modules/Inputs/error/module.modulemap 
b/clang/test/Modules/Inputs/error/module.modulemap
index e18239af113b2..512e7ed6529e0 100644
--- a/clang/test/Modules/Inputs/error/module.modulemap
+++ b/clang/test/Modules/Inputs/error/module.modulemap
@@ -1,3 +1,13 @@
 module error {
   header "error.h"
 }
+
+module use_error_a {
+  header "use_error_a.h"
+  export error
+}
+
+module use_error_b {
+  header "use_error_b.h"
+  export error
+}

diff  --git a/clang/test/Modules/Inputs/error/use_error_a.h 
b/clang/test/Modules/Inputs/error/use_error_a.h
new file mode 100644
index 0..1949c8346041d
--- /dev/null
+++ b/clang/test/Modules/Inputs/error/use_error_a.h
@@ -0,0 +1,3 @@
+@import error;
+
+void funca(Error *a);

diff  --git a/clang/test/Modules/Inputs/error/use_error_b.h 
b/clang/test/Modules/Inputs/error/use_error_b.h
new file mode 100644
index 0..025acb7ccf31e
--- /dev/null
+++ b/clang/test/Modules/Inputs/error/use_error_b.h
@@ -0,0 +1,3 @@
+@import error;
+
+void funcb(Error *b);

diff  --git a/clang/test/Modules/load-module-with-errors.m 
b/clang/test/Modules/load-module-with-errors.m
index 3a951d2cdaa62..6991d0feb0103 100644
--- a/clang/test/Modules/load-module-with-errors.m
+++ b/clang/test/Modules/load-module-with-errors.m
@@ -2,10 +2,13 @@
 // matter in this test.
 
 // pcherror-error@* {{PCH file contains compiler errors}}
-@import error; // notallowerror-error {{could not build module 'error'}}
+@import use_error_a; // notallowerror-error {{could not build module 
'use_error_a'}}
+@import use_error_b;
 // expected-no-diagnostics
 
 void test(Error *x) {
+  funca(x);
+  funcb(x);
   [x method];
 }
 
@@ -16,7 +19,16 @@ void test(Error *x) {
 // RUN: %clang_cc1 -fmodules -fallow-pcm-with-compiler-errors \
 // RUN:   -fmodule-name=error -o %t/prebuilt/error.pcm \
 // RUN:   -x objective-c -emit-module %S/Inputs/error/module.modulemap
+// RUN: %clang_cc1 -fmodules -fallow-pcm-with-compiler-errors \
+// RUN:   -fmodule-file=error=%t/prebuilt/error.pcm \
+// RUN:   -fmodule-name=use_error_a -o %t/prebuilt/use_error_a.pcm \
+// RUN:   -x objective-c -emit-module %S/Inputs/error/module.modulemap
+// RUN: %clang_cc1 -fmodules -fallow-pcm-with-compiler-errors \
+// RUN:   -fmodule-file=error=%t/prebuilt/error.pcm \
+// RUN:   -fmodule-name=use_error_b -o %t/prebuilt/use_error_b.pcm \
+// 

[PATCH] D99005: [clang] Implement P2266 Simpler implicit move

2021-04-16 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov updated this revision to Diff 338262.
mizvekov added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99005

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaCoroutine.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
  clang/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-cxx14.cpp
  clang/test/CXX/drs/dr3xx.cpp
  clang/test/CXX/expr/expr.prim/expr.prim.lambda/p4-cxx14.cpp
  clang/test/CXX/temp/temp.decls/temp.mem/p5.cpp
  clang/test/SemaCXX/constant-expression-cxx11.cpp
  clang/test/SemaCXX/constant-expression-cxx14.cpp
  clang/test/SemaCXX/coroutine-rvo.cpp
  clang/test/SemaCXX/coroutines.cpp
  clang/test/SemaCXX/deduced-return-type-cxx14.cpp
  clang/test/SemaCXX/return-stack-addr.cpp
  clang/test/SemaCXX/warn-return-std-move.cpp

Index: clang/test/SemaCXX/warn-return-std-move.cpp
===
--- clang/test/SemaCXX/warn-return-std-move.cpp
+++ clang/test/SemaCXX/warn-return-std-move.cpp
@@ -1,8 +1,8 @@
-// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=cxx20_2b -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20_2b -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=cxx11_17 -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=cxx20_2b,cxx2b -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=cxx20_2b   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=cxx11_17   -fcxx-exceptions -Wreturn-std-move %s
 
 // RUN: %clang_cc1 -std=c++17 -fsyntax-only -fcxx-exceptions -Wreturn-std-move -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -check-prefix=CHECK
 // RUN: %clang_cc1 -std=c++14 -fsyntax-only -fcxx-exceptions -Wreturn-std-move -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s -check-prefix=CHECK
@@ -217,8 +217,8 @@
 }
 
 // But if the return type is a reference type, then moving would be wrong.
-Derived& testRetRef1(Derived&& d) { return d; }
-Base& testRetRef2(Derived&& d) { return d; }
+Derived (Derived &) { return d; } // cxx2b-error {{on-const lvalue reference to type 'Derived' cannot bind to a temporary of type 'Derived'}}
+Base (Derived &) { return d; }// cxx2b-error {{non-const lvalue reference to type 'Base' cannot bind to a temporary of type 'Derived'}}
 #if __cplusplus >= 201402L
 auto&& testRetRef3(Derived&& d) { return d; }
 decltype(auto) testRetRef4(Derived&& d) { return (d); }
Index: clang/test/SemaCXX/return-stack-addr.cpp
===
--- clang/test/SemaCXX/return-stack-addr.cpp
+++ clang/test/SemaCXX/return-stack-addr.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected   %s
-// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected   %s
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx11 %s
+// RUN: %clang_cc1 -std=c++2b -fsyntax-only -verify=expected,cxx2b  %s
+// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx11_20   %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify=expected,cxx11_20,cxx11 %s
 
 int* ret_local() {
   int x = 1;
@@ -29,7 +29,8 @@
 
 int& ret_local_ref() {
   int x = 1;
-  return x;  // expected-warning {{reference to stack memory}}
+  return x; // cxx11_20-warning {{reference to stack memory}}
+  // cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
 }
 
 int* ret_local_addrOf() {
@@ -154,8 +155,10 @@
   (void) [&]() -> int& { return b; };
   (void) [=]() mutable -> int& { return a; };
   (void) [=]() mutable -> int& { return b; };
-  (void) [&]() -> int& { int a; return a; }; // expected-warning {{reference to stack}}
-  (void) [=]() -> int& { int a; return a; }; // expected-warning {{reference to stack}}
+  (void) [&]() -> int& { int a; return a; }; // cxx11_20-warning {{reference to stack}}
+  // cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
+  (void) [=]() -> int& { int a; return a; }; // cxx11_20-warning {{reference to stack}}
+  // cxx2b-error@-1 {{non-const lvalue reference to type 'int' cannot bind to a temporary of type 'int'}}
   (void) [&]() -> int& { int  = b; return a; };
   (void) [=]() mutable -> 

[PATCH] D100671: [ADT] Factor out in_place_t and expose in Optional ctor

2021-04-16 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

In D100671#2696123 , @scott.linder 
wrote:

> In D100671#2695923 , @dblaikie 
> wrote:
>
>> This usage doesn't seem to quite match the standard - which provides an 
>> existing instance of in_place_t for callers to use:
>>
>>   std::optional o4(std::in_place, {'a', 'b', 'c'});
>>
>> (to quote https://en.cppreference.com/w/cpp/utility/optional/optional )
>>
>> Probably good to match this sort of behavior.
>
> My understanding is that the C++17 `inline constexpr` is what makes that 
> generally "safe" wrt. ODR, but I'm not actually sure that it come up in 
> practice (i.e. I don't suspect we will ever actually cause this thing to have 
> an address).
>
> Maybe I can add the variable with a note about not doing anything with it 
> that could cause it to violate ODR? I.e. don't take its address (and probably 
> other thing I need to refresh my memory on)

I imagine whatever we do for `llvm::None` would be fine for `llvm::inplace` too.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100671

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


[PATCH] D100616: [clang][NFC] Fix a potential assert failure

2021-04-16 Thread Ben Shi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
benshi001 marked an inline comment as done.
Closed by commit rG06995fe256ec: [clang][NFC] Fix a potential assert failure 
(authored by benshi001).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100616

Files:
  clang/include/clang/Basic/TargetBuiltins.h


Index: clang/include/clang/Basic/TargetBuiltins.h
===
--- clang/include/clang/Basic/TargetBuiltins.h
+++ clang/include/clang/Basic/TargetBuiltins.h
@@ -331,9 +331,9 @@
   }
 
   static constexpr uint64_t LargestBuiltinID = std::max(
-  {NEON::FirstTSBuiltin, ARM::LastTSBuiltin, SVE::FirstTSBuiltin,
-   AArch64::LastTSBuiltin, BPF::LastTSBuiltin, PPC::LastTSBuiltin,
-   NVPTX::LastTSBuiltin, AMDGPU::LastTSBuiltin, X86::LastTSBuiltin,
+  {ARM::LastTSBuiltin, AArch64::LastTSBuiltin, BPF::LastTSBuiltin,
+   PPC::LastTSBuiltin, NVPTX::LastTSBuiltin, AMDGPU::LastTSBuiltin,
+   X86::LastTSBuiltin, VE::LastTSBuiltin, RISCV::LastTSBuiltin,
Hexagon::LastTSBuiltin, Mips::LastTSBuiltin, XCore::LastTSBuiltin,
Le64::LastTSBuiltin, SystemZ::LastTSBuiltin,
WebAssembly::LastTSBuiltin});


Index: clang/include/clang/Basic/TargetBuiltins.h
===
--- clang/include/clang/Basic/TargetBuiltins.h
+++ clang/include/clang/Basic/TargetBuiltins.h
@@ -331,9 +331,9 @@
   }
 
   static constexpr uint64_t LargestBuiltinID = std::max(
-  {NEON::FirstTSBuiltin, ARM::LastTSBuiltin, SVE::FirstTSBuiltin,
-   AArch64::LastTSBuiltin, BPF::LastTSBuiltin, PPC::LastTSBuiltin,
-   NVPTX::LastTSBuiltin, AMDGPU::LastTSBuiltin, X86::LastTSBuiltin,
+  {ARM::LastTSBuiltin, AArch64::LastTSBuiltin, BPF::LastTSBuiltin,
+   PPC::LastTSBuiltin, NVPTX::LastTSBuiltin, AMDGPU::LastTSBuiltin,
+   X86::LastTSBuiltin, VE::LastTSBuiltin, RISCV::LastTSBuiltin,
Hexagon::LastTSBuiltin, Mips::LastTSBuiltin, XCore::LastTSBuiltin,
Le64::LastTSBuiltin, SystemZ::LastTSBuiltin,
WebAssembly::LastTSBuiltin});
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 06995fe - [clang][NFC] Fix a potential assert failure

2021-04-16 Thread Ben Shi via cfe-commits

Author: Ben Shi
Date: 2021-04-17T07:17:34+08:00
New Revision: 06995fe256ec5a80092d5045c30b2c94f5ed8232

URL: 
https://github.com/llvm/llvm-project/commit/06995fe256ec5a80092d5045c30b2c94f5ed8232
DIFF: 
https://github.com/llvm/llvm-project/commit/06995fe256ec5a80092d5045c30b2c94f5ed8232.diff

LOG: [clang][NFC] Fix a potential assert failure

Reviewed By: MaskRay, craig.topper

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

Added: 


Modified: 
clang/include/clang/Basic/TargetBuiltins.h

Removed: 




diff  --git a/clang/include/clang/Basic/TargetBuiltins.h 
b/clang/include/clang/Basic/TargetBuiltins.h
index 0d99ffc8ffce..7fa688633ff6 100644
--- a/clang/include/clang/Basic/TargetBuiltins.h
+++ b/clang/include/clang/Basic/TargetBuiltins.h
@@ -331,9 +331,9 @@ namespace clang {
   }
 
   static constexpr uint64_t LargestBuiltinID = std::max(
-  {NEON::FirstTSBuiltin, ARM::LastTSBuiltin, SVE::FirstTSBuiltin,
-   AArch64::LastTSBuiltin, BPF::LastTSBuiltin, PPC::LastTSBuiltin,
-   NVPTX::LastTSBuiltin, AMDGPU::LastTSBuiltin, X86::LastTSBuiltin,
+  {ARM::LastTSBuiltin, AArch64::LastTSBuiltin, BPF::LastTSBuiltin,
+   PPC::LastTSBuiltin, NVPTX::LastTSBuiltin, AMDGPU::LastTSBuiltin,
+   X86::LastTSBuiltin, VE::LastTSBuiltin, RISCV::LastTSBuiltin,
Hexagon::LastTSBuiltin, Mips::LastTSBuiltin, XCore::LastTSBuiltin,
Le64::LastTSBuiltin, SystemZ::LastTSBuiltin,
WebAssembly::LastTSBuiltin});



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


[PATCH] D100514: [OpenMP] Added codegen for masked directive

2021-04-16 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D100514#2696106 , @cchen wrote:

>> Initially we did not have an OMPIRBuilder object unconditionally, now we 
>> have. Let's move over everything that is ready. So master and critical 
>> should be good to go as well I suppose.
>
> While using OMPIRBuilder as default, do we want to just remove codegen in 
> Clang or we have a flag for using Clang codegen?

No duplication where it is not necessary. So if the OMPIRBuilder is fully 
capable use it remove the clang codegen, please.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100514

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-16 Thread Michael Kruse via Phabricator via cfe-commits
Meinersbur added a comment.

I have not looked at the other mentioned problem yet:

> another that attribute regexes are not recognized 
> (https://reviews.llvm.org/harbormaster/unit/view/552593/ at 
> nvptx_target_codegen.cpp:723:17)

Which might still be there.

I would want for Harbormaster to complete the pre-merge check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-16 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.

With the nit to add the two reproducers, LGTM. (please make sure to run FAROS 
or some benchmarks we have before commiting).




Comment at: openmp/libomptarget/deviceRTLs/common/src/parallel.cu:294
+  // TODO: Add UNLIKELY to optimize?
+  if (!if_expr) {
+__kmpc_serialized_parallel(ident, global_tid);

ggeorgakoudis wrote:
> jdoerfert wrote:
> > This should allow us to remove the `SeqGen` in the Clang CodeGen *and* fix 
> > PR49777 *and* fix PR49779, a win-win-win situation.
> Please check
Check? Can we add the two reproducers as tests, please. One should be a clang 
test, the other maybe a runtime test, though clang test might suffice.



Comment at: openmp/libomptarget/utils/generate_microtask_cases.py:31
+if __name__ == "__main__":
+main()

Great. The output is not pretty but that was not the objective ;)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D100671: [ADT] Factor out in_place_t and expose in Optional ctor

2021-04-16 Thread Scott Linder via Phabricator via cfe-commits
scott.linder added a comment.

In D100671#2695923 , @dblaikie wrote:

> This usage doesn't seem to quite match the standard - which provides an 
> existing instance of in_place_t for callers to use:
>
>   std::optional o4(std::in_place, {'a', 'b', 'c'});
>
> (to quote https://en.cppreference.com/w/cpp/utility/optional/optional )
>
> Probably good to match this sort of behavior.

My understanding is that the C++17 `inline constexpr` is what makes that 
generally "safe" wrt. ODR, but I'm not actually sure that it come up in 
practice (i.e. I don't suspect we will ever actually cause this thing to have 
an address).

Maybe I can add the variable with a note about not doing anything with it that 
could cause it to violate ODR? I.e. don't take its address (and probably other 
thing I need to refresh my memory on)




Comment at: llvm/unittests/ADT/OptionalTest.cpp:227
+ const MultiArgConstructor ) {
+return LHS.x == RHS.x && LHS.y == RHS.y;
+  }

dblaikie wrote:
> Could write this as: `return std::tie(LHS.x, LHS.y) == std::tie(RHS.x, 
> RHS.y);` which I think is a bit tidier/easier to generalize to other 
> comparisons, etc.
Will do, thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100671

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


[PATCH] D100620: [OpenMP] Make sure classes work on the device as they do on the host

2021-04-16 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: 
clang/lib/Headers/openmp_wrappers/__clang_openmp_device_functions.h:20
+// need to `include `.
+#include 
+#endif

JonChesterfield wrote:
> I think there are legitimate use cases for writing code that doesn't include 
> new. Can we add the forms that are meant to be available without the include 
> here, instead of just pulling in all new?
Hm, what forms would you not like to see in the code by default, and why?




Comment at: clang/test/Headers/Inputs/include/cstdlib:5
 
+void *malloc(size_t);
+void free(void*);

JonChesterfield wrote:
> These are in stdlib just above, no? Possibly with noexcept tags
They are not, this is the sham layer for testing, but you are so far correct 
that they should be. I'll move them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100620

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


[PATCH] D100567: BPF: emit debuginfo for Function of DeclRefExpr if requested

2021-04-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 338252.
yonghong-song added a comment.

- isDefined() is not necessary, segfault is caused by a nullptr by causing a 
LV.getPointer(). Check nullptr instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100567

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/Targets/BPF.h
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/CodeGen/debug-info-extern-callback.c

Index: clang/test/CodeGen/debug-info-extern-callback.c
===
--- /dev/null
+++ clang/test/CodeGen/debug-info-extern-callback.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -x c -debug-info-kind=limited -triple bpf-linux-gnu -emit-llvm %s -o - | FileCheck %s
+
+extern int do_work1(int);
+long bpf_helper1(void *callback_fn);
+long prog1() {
+  return bpf_helper1(_work1);
+}
+
+extern int do_work2(int);
+long bpf_helper2(void *callback_fn);
+int do_work2(int arg) {
+  return arg;
+}
+long prog2() {
+  return bpf_helper2(_work2);
+}
+
+extern int do_work3(int);
+long bpf_helper3(void *callback_fn);
+long prog3() {
+  return bpf_helper3(_work3);
+}
+int do_work3(int arg) {
+  return arg;
+}
+
+// CHECK: declare !dbg ![[FUNC1:[0-9]+]] i32 @do_work1(i32)
+// CHECK: define dso_local i32 @do_work2(i32 %arg) #{{[0-9]+}} !dbg ![[FUNC2:[0-9]+]]
+// CHECK: define dso_local i32 @do_work3(i32 %arg) #{{[0-9]+}} !dbg ![[FUNC3:[0-9]+]]
+
+// CHECK: ![[FUNC1]] = !DISubprogram(name: "do_work1"
+// CHECK: ![[FUNC2]] = distinct !DISubprogram(name: "do_work2"
+// CHECK: ![[FUNC3]] = distinct !DISubprogram(name: "do_work3"
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -12667,7 +12667,7 @@
 Diag(Var->getLocation(), diag::note_private_extern);
   }
 
-  if (Context.getTargetInfo().allowDebugInfoForExternalVar() &&
+  if (Context.getTargetInfo().allowDebugInfoForExternalRef() &&
   !Var->isInvalidDecl() && !getLangOpts().CPlusPlus)
 ExternalDeclarations.push_back(Var);
 
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -2834,8 +2834,20 @@
 return LV;
   }
 
-  if (const auto *FD = dyn_cast(ND))
-return EmitFunctionDeclLValue(*this, E, FD);
+  if (const auto *FD = dyn_cast(ND)) {
+LValue LV = EmitFunctionDeclLValue(*this, E, FD);
+
+// Emit debuginfo for the function declaration if the target wants to.
+if (getContext().getTargetInfo().allowDebugInfoForExternalRef()) {
+  auto *Fn = dyn_cast(LV.getPointer(*this));
+  if (Fn && !Fn->getSubprogram()) {
+CGM.getModuleDebugInfo()->EmitFunctionDecl(FD, FD->getLocation(), T,
+   Fn);
+  }
+}
+
+return LV;
+  }
 
   // FIXME: While we're emitting a binding from an enclosing scope, all other
   // DeclRefExprs we see should be implicitly treated as if they also refer to
Index: clang/lib/Basic/Targets/BPF.h
===
--- clang/lib/Basic/Targets/BPF.h
+++ clang/lib/Basic/Targets/BPF.h
@@ -76,7 +76,7 @@
 return None;
   }
 
-  bool allowDebugInfoForExternalVar() const override { return true; }
+  bool allowDebugInfoForExternalRef() const override { return true; }
 
   CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
 switch (CC) {
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -1538,8 +1538,8 @@
 
   virtual void setAuxTarget(const TargetInfo *Aux) {}
 
-  /// Whether target allows debuginfo types for decl only variables.
-  virtual bool allowDebugInfoForExternalVar() const { return false; }
+  /// Whether target allows debuginfo types for decl only variables/functions.
+  virtual bool allowDebugInfoForExternalRef() const { return false; }
 
 protected:
   /// Copy type and layout related info.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D100514: [OpenMP] Added codegen for masked directive

2021-04-16 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen added a comment.

> Initially we did not have an OMPIRBuilder object unconditionally, now we 
> have. Let's move over everything that is ready. So master and critical should 
> be good to go as well I suppose.

While using OMPIRBuilder as default, do we want to just remove codegen in Clang 
or we have a flag for using Clang codegen?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100514

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


[PATCH] D100619: [ASTReader] Only mark module out of date if not already compiled

2021-04-16 Thread Ben Barham via Phabricator via cfe-commits
bnbarham added inline comments.



Comment at: clang/test/Modules/Inputs/error/error.h:1
+#pragma mark mark
+

akyrtzi wrote:
> Is this pragma relevant for the test?
I'll double check but I believe assertions are hit regardless, but with 
assertions off the test doesn't crash. Adding the #pragma causes it to crash.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100619

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


[PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

2021-04-16 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield added inline comments.



Comment at: clang/lib/Sema/SemaStmt.cpp:437
+  CompoundStmt *CS = CompoundStmt::Create(Context, Elts, L, R);
+  DiagnoseUnusedButSetVariables(CS);
+  return CS;

mbenfield wrote:
> mbenfield wrote:
> > mbenfield wrote:
> > > george.burgess.iv wrote:
> > > > It seems like these two warnings are doing analyses with identical 
> > > > requirements (e.g., the function's body must be present), but are 
> > > > taking two different sets of variables into account while doing so.
> > > > 
> > > > Is there a way we can rephrase this so we only need to walk the AST 
> > > > checking once for all of this?
> > > I'll think about this. It might be tricky. 
> > I'll implement this. It will be a fairly different approach though. 
> I have this implemented. I am going to run a performance comparison on the 
> two approaches before making a new revision here. 
An informal comparison reveals no significant performance difference between 
these two approaches. I think it's a tradeoff: if you walk each block and/or 
each function separately, you do have to do more walks, but you're likely to be 
able to terminate your walk early (because you already ran into a use of each 
variable/parameter).

OTOH, if you walk everything in one go, it is only one walk, but you definitely 
have to walk the whole thing (because you might run into another CompoundStmt 
with more declarations). 

I find the current approach conceptually simpler and so would prefer to keep it 
as-is. If you disagree let me know. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100581

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


[PATCH] D100567: BPF: emit debuginfo for Function of DeclRefExpr if requested

2021-04-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

Sorry, I know what is the segfault now after some debugging. It is because 
`auto *Fn = dyn_cast(LV.getPointer(*this));` is a NULL pointer 
after there is a definition before this. Will pose another patch but with test 
case remains to cover mix of declaration, pointer reference and definition.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100567

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


[PATCH] D100567: BPF: emit debuginfo for Function of DeclRefExpr if requested

2021-04-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

In D100567#2695827 , @dblaikie wrote:

> Generally looks OK, but could you explain more about the problems 
> with/motivation for the declaration/definition issue? (probably worth noting 
> in the patch description maybe comment in code and test)

First about testing Fn->getSubprogram(), the reason is to avoid repeatedly 
attempt to generate debuginfo, e.g.,

  extern int foo(int);
  long test() { ...  ...  ...  ... }

Without checking it will try to generate the debuginfo three times although 
later it is deduplicated, but still a waste.

But Fn->getSubprogram() alone may cause issues if the debuginfo has been 
generated for a definition,

  extern int do_work2(int);
  long bpf_helper2(void *callback_fn);
  int do_work2(int arg) {
return arg;
  }
  long prog2() {
return bpf_helper2(_work2);
  }

We will have a segfault

  #3 0x01bf2138 CrashRecoverySignalHandler(int) 
CrashRecoveryContext.cpp:0:0
 

#4 0x7f93e4fdfb20 __restore_rt sigaction.c:0:0  
   
 #5 0x01506f70 llvm::Value::getMetadata(unsigned int) const 
(/home/yhs/work/llvm-project/llvm/build.cur/install/bin/clang-13+0x1506f70) 

 #6 0x015074db llvm::Function::getSubprogram() const 
(/home/yhs/work/llvm-project/llvm/build.cur/install/bin/clang-13+0x15074db) 
   
 #7 0x021ff5cf 
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*) 
(/home/yhs/work/llvm-project/llvm/build.cur/install/bin
/clang-13+0x21ff5cf)

 #8 0x021fd866 clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr 
const*) (/home/yhs/work/llvm-project/llvm/build.cur/install/bin/clang-13+0x21
fd866)

So we need to stop calling Fn->getSubprogram() if FD->isDefined() is true. 
Hence I added FD->isDefined().

In summary, the new code

  if (!FD->isDefined() && !Fn->getSubprogram()) {
CGM.getModuleDebugInfo()->EmitFunctionDecl(FD, FD->getLocation(), T,
   Fn);
  }

is an optimization to avoid repeatedly generating the debuginfo. If 
FD->isDefined(), stop,
otherwise, if Fn->getSubprogram() which means having generated, stop. 
Otherwise, generate one.

Note that my previous code without " if (!FD->isDefined() && 
!Fn->getSubprogram())" totally
working fine, I just feel a little bit waste.

I didn't debug why we have error for this test and you may have a better idea 
from the above
stack trace.

  extern int do_work2(int);
  long bpf_helper2(void *callback_fn);
  int do_work2(int arg) {
return arg;
  }
  long prog2() {
return bpf_helper2(_work2);
  }

Apparently, do_work2 already generated a subprogram debuginfo when inside 
prog2() another attempt tried to check whether the subprogram has been 
generated or not.
I have added a test for this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100567

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis marked 4 inline comments as done.
ggeorgakoudis added inline comments.



Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:2192
 RCG(CGF);
   }
 }

jdoerfert wrote:
> Can we remove SeqGen while we are here please. We need to check in the 
> runtime anyway. That check is later folded, no need to make things more 
> complicated here.
Done



Comment at: openmp/libomptarget/deviceRTLs/common/src/parallel.cu:294
+  // TODO: Add UNLIKELY to optimize?
+  if (!if_expr) {
+__kmpc_serialized_parallel(ident, global_tid);

jdoerfert wrote:
> This should allow us to remove the `SeqGen` in the Clang CodeGen *and* fix 
> PR49777 *and* fix PR49779, a win-win-win situation.
Please check


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-16 Thread Giorgis Georgakoudis via Phabricator via cfe-commits
ggeorgakoudis updated this revision to Diff 338246.
ggeorgakoudis added a comment.

Update for comments, fix for windows fix


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_codegen.cpp
  
clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_target_teams_distribute_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/nvptx_teams_reduction_codegen.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
  clang/test/OpenMP/target_parallel_debug_codegen.cpp
  clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/gpu_state_machine_function_ptr_replacement.ll
  openmp/libomptarget/deviceRTLs/common/generated_microtask_cases.gen
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/common/src/support.cu
  openmp/libomptarget/deviceRTLs/common/support.h
  openmp/libomptarget/deviceRTLs/interface.h
  openmp/libomptarget/utils/generate_microtask_cases.py

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


[PATCH] D100609: [Offload][OpenMP][CUDA] Allow fembed-bitcode for device offload

2021-04-16 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/test/Driver/embed-bitcode-nvptx.cu:1
+// RUN: %clang -Xclang -triple -Xclang nvptx64 -S -Xclang -target-feature 
-Xclang +ptx70 -fembed-bitcode=all --cuda-device-only -nocudalib -nocudainc %s 
-o - | FileCheck %s
+// REQUIRES: nvptx-registered-target

jdoerfert wrote:
> tra wrote:
> > jdoerfert wrote:
> > > tra wrote:
> > > > This command line looks extremely odd to me.
> > > > If you are compiling with `--cuda-device-only`, then clang should've 
> > > > already set the right triple and the features.
> > > > 
> > > > Could you tell me more about what is the intent of the compilation and 
> > > > why you use this particular set of options?
> > > > I.e. why not just do `clang -x cuda --offload-arch=sm_70 
> > > > --cuda-device-only -nocudalib -nocudainc`.
> > > > 
> > > > Could you tell me more about what is the intent of the compilation and 
> > > > why you use this particular set of options?
> > > 
> > > because I never compiled cuda really ;)
> > > 
> > > I'll go with your options.
> > Something still does not add up. 
> > 
> > AFAICT, the real problem is that that we're not adding `-target-cpu`, but 
> > rather that `-fembed-bitcode=all` splits `-S` compilation into two phases 
> > -- source-to-bitcode (this part gets all the right command line options and 
> > compiles fine) and `IR -> PTX` compilation which does end up only with the 
> > subset of the options and ends up failing because the intrinsics are not 
> > enabled.
> > 
> > I think what we want to do in this case is to prevent splitting GPU-side 
> > compilation. Adding a '-target-gpu' to the `IR->PTX` subcompilation may 
> > make things work in this case, but it does not really fix the root cause. 
> > E.g. we should also pass through the features set by the driver and, 
> > possibly, other options to keep both source->IR and IR->PTX compilations in 
> > sync.
> > 
> > I think what we want to do in this case is to prevent splitting GPU-side 
> > compilation.
> 
> I doubt that is as easy as it sounds. Where do we take the IR from then? (I 
> want the GPU IR embedded after all)
> 
> > E.g. we should also pass through the features set by the driver and ..
> 
> I agree, what if I move the embedding handling to the end, keep the 
> "blacklist" that removes arguments we don't want, and see where that leads us?
Ah, so you do grab the intermediate IR. I assume that the PTX does get used, 
too. 

Another way to deal with this may be to do two independent compilations -- 
source-to-IR and source-to-PTX. Each would use the standard compilation flags. 
The downside is that parsing and optimization time will double, so split 
compilation combined with filtering args is probably more practical.





Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100609

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


[PATCH] D100616: [clang][NFC] Fix a potential assert failure

2021-04-16 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.

LGTM. Thanks for removing the NEON and SVE.


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

https://reviews.llvm.org/D100616

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


[PATCH] D100688: [AST] Remove args from LocationCall

2021-04-16 Thread Stephen Kelly via Phabricator via cfe-commits
steveire created this revision.
steveire added a reviewer: njames93.
steveire requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This class initially had args to be generic to future needs. In
particular, I thought that source location introspection should show the
getBeginLoc of CallExpr args and the getArgLoc of
TemplateSpecializationLocInfo etc.  However, that is probably best left
out of source location introspection because it involves node traversal.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100688

Files:
  clang/include/clang/Tooling/NodeIntrospection.h
  clang/lib/Tooling/NodeIntrospection.cpp
  clang/unittests/Introspection/IntrospectionTest.cpp


Index: clang/unittests/Introspection/IntrospectionTest.cpp
===
--- clang/unittests/Introspection/IntrospectionTest.cpp
+++ clang/unittests/Introspection/IntrospectionTest.cpp
@@ -61,16 +61,7 @@
   print(*On, OS);
   OS << '.';
 }
-OS << Call.name();
-if (Call.args().empty()) {
-  OS << "()";
-  return;
-}
-OS << '(' << Call.args().front();
-for (const std::string  : Call.args().drop_front()) {
-  OS << ", " << Arg;
-}
-OS << ')';
+OS << Call.name() << "()";
   }
 
   static std::string format(const LocationCall ) {
Index: clang/lib/Tooling/NodeIntrospection.cpp
===
--- clang/lib/Tooling/NodeIntrospection.cpp
+++ clang/lib/Tooling/NodeIntrospection.cpp
@@ -29,16 +29,7 @@
   OS << '.';
   }
 
-  OS << Call.name();
-  if (Call.args().empty()) {
-OS << "()";
-return;
-  }
-  OS << '(' << Call.args().front();
-  for (const std::string  : Call.args().drop_front()) {
-OS << ", " << Arg;
-  }
-  OS << ')';
+  OS << Call.name() << "()";
 }
 
 std::string LocationCallFormatterCpp::format(const LocationCall ) {
Index: clang/include/clang/Tooling/NodeIntrospection.h
===
--- clang/include/clang/Tooling/NodeIntrospection.h
+++ clang/include/clang/Tooling/NodeIntrospection.h
@@ -38,14 +38,9 @@
   LocationCall(SharedLocationCall on, std::string name,
LocationCallFlags flags = NoFlags)
   : m_flags(flags), m_on(std::move(on)), m_name(std::move(name)) {}
-  LocationCall(SharedLocationCall on, std::string name,
-   std::vector args, LocationCallFlags flags = 
NoFlags)
-  : m_flags(flags), m_on(std::move(on)), m_name(std::move(name)),
-m_args(std::move(args)) {}
 
   LocationCall *on() const { return m_on.get(); }
   StringRef name() const { return m_name; }
-  ArrayRef args() const { return m_args; }
   bool returnsPointer() const { return m_flags & ReturnsPointer; }
   bool isCast() const { return m_flags & IsCast; }
 
@@ -53,7 +48,6 @@
   LocationCallFlags m_flags;
   SharedLocationCall m_on;
   std::string m_name;
-  std::vector m_args;
 };
 
 class LocationCallFormatterCpp {


Index: clang/unittests/Introspection/IntrospectionTest.cpp
===
--- clang/unittests/Introspection/IntrospectionTest.cpp
+++ clang/unittests/Introspection/IntrospectionTest.cpp
@@ -61,16 +61,7 @@
   print(*On, OS);
   OS << '.';
 }
-OS << Call.name();
-if (Call.args().empty()) {
-  OS << "()";
-  return;
-}
-OS << '(' << Call.args().front();
-for (const std::string  : Call.args().drop_front()) {
-  OS << ", " << Arg;
-}
-OS << ')';
+OS << Call.name() << "()";
   }
 
   static std::string format(const LocationCall ) {
Index: clang/lib/Tooling/NodeIntrospection.cpp
===
--- clang/lib/Tooling/NodeIntrospection.cpp
+++ clang/lib/Tooling/NodeIntrospection.cpp
@@ -29,16 +29,7 @@
   OS << '.';
   }
 
-  OS << Call.name();
-  if (Call.args().empty()) {
-OS << "()";
-return;
-  }
-  OS << '(' << Call.args().front();
-  for (const std::string  : Call.args().drop_front()) {
-OS << ", " << Arg;
-  }
-  OS << ')';
+  OS << Call.name() << "()";
 }
 
 std::string LocationCallFormatterCpp::format(const LocationCall ) {
Index: clang/include/clang/Tooling/NodeIntrospection.h
===
--- clang/include/clang/Tooling/NodeIntrospection.h
+++ clang/include/clang/Tooling/NodeIntrospection.h
@@ -38,14 +38,9 @@
   LocationCall(SharedLocationCall on, std::string name,
LocationCallFlags flags = NoFlags)
   : m_flags(flags), m_on(std::move(on)), m_name(std::move(name)) {}
-  LocationCall(SharedLocationCall on, std::string name,
-   std::vector args, LocationCallFlags flags = NoFlags)
-  : m_flags(flags), m_on(std::move(on)), m_name(std::move(name)),
-m_args(std::move(args)) {}
 
   LocationCall *on() const { return m_on.get(); }
   StringRef 

[PATCH] D100226: [funcattrs] Add the maximal set of implied attributes to definitions

2021-04-16 Thread Philip Reames via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf549176ad976: [funcattrs] Add the maximal set of implied 
attributes to definitions (authored by reames).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100226

Files:
  clang/test/CodeGenOpenCL/convergent.cl
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
  llvm/test/CodeGen/AMDGPU/inline-attr.ll
  llvm/test/Other/cgscc-devirt-iteration.ll
  llvm/test/Other/cgscc-iterate-function-mutation.ll
  llvm/test/Other/cgscc-observe-devirt.ll
  llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll
  llvm/test/Transforms/FunctionAttrs/atomic.ll
  llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
  llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
  llvm/test/Transforms/FunctionAttrs/nofree.ll
  llvm/test/Transforms/FunctionAttrs/nosync.ll
  llvm/test/Transforms/FunctionAttrs/nounwind.ll
  llvm/test/Transforms/FunctionAttrs/optnone.ll
  llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
  llvm/test/Transforms/FunctionAttrs/writeonly.ll
  llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
  llvm/test/Transforms/Inline/cgscc-update.ll

Index: llvm/test/Transforms/Inline/cgscc-update.ll
===
--- llvm/test/Transforms/Inline/cgscc-update.ll
+++ llvm/test/Transforms/Inline/cgscc-update.ll
@@ -27,7 +27,7 @@
 }
 
 ; This function should have had 'readnone' deduced for its SCC.
-; CHECK: Function Attrs: noinline nosync nounwind readnone
+; CHECK: Function Attrs: nofree noinline nosync nounwind readnone
 ; CHECK-NEXT: define void @test1_g()
 define void @test1_g() noinline {
 entry:
@@ -36,7 +36,7 @@
 }
 
 ; This function should have had 'readnone' deduced for its SCC.
-; CHECK: Function Attrs: noinline nosync nounwind readnone
+; CHECK: Function Attrs: nofree noinline nosync nounwind readnone
 ; CHECK-NEXT: define void @test1_h()
 define void @test1_h() noinline {
 entry:
@@ -59,7 +59,7 @@
 }
 
 ; This function should have had 'readnone' deduced for its SCC.
-; CHECK: Function Attrs: noinline nosync nounwind readnone
+; CHECK: Function Attrs: nofree noinline nosync nounwind readnone
 ; CHECK-NEXT: define void @test2_g()
 define void @test2_g() noinline {
 entry:
@@ -69,7 +69,7 @@
 }
 
 ; This function should have had 'readnone' deduced for its SCC.
-; CHECK: Function Attrs: noinline nosync nounwind readnone
+; CHECK: Function Attrs: nofree noinline nosync nounwind readnone
 ; CHECK-NEXT: define void @test2_h()
 define void @test2_h() noinline {
 entry:
@@ -152,7 +152,7 @@
 ; form a new SCC and should use that can deduce precise function attrs.
 
 ; This function should have had 'readnone' deduced for its SCC.
-; CHECK: Function Attrs: noinline nosync nounwind readnone
+; CHECK: Function Attrs: nofree noinline nosync nounwind readnone
 ; CHECK-NEXT: define void @test4_f1()
 define void @test4_f1() noinline {
 entry:
@@ -175,7 +175,7 @@
 }
 
 ; This function should have had 'readnone' deduced for its SCC.
-; CHECK: Function Attrs: noinline nosync nounwind readnone
+; CHECK: Function Attrs: nofree noinline nosync nounwind readnone
 ; CHECK-NEXT: define void @test4_h()
 define void @test4_h() noinline {
 entry:
Index: llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
===
--- llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
+++ llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
@@ -52,5 +52,5 @@
 !28 = !DILocation(line: 9, column: 18, scope: !2)
 !29 = !DILocation(line: 10, column: 1, scope: !2)
 
-; CHECK: attributes #0 = { nofree norecurse nosync nounwind willreturn }
+; CHECK: attributes #0 = { nofree norecurse nosync nounwind willreturn mustprogress }
 ; CHECK-NOT: foo.coefficient1
Index: llvm/test/Transforms/FunctionAttrs/writeonly.ll
===
--- llvm/test/Transforms/FunctionAttrs/writeonly.ll
+++ llvm/test/Transforms/FunctionAttrs/writeonly.ll
@@ -27,4 +27,4 @@
 
 ; CHECK: attributes #0 = { {{.*}} readnone {{.*}} }
 ; CHECK: attributes #1 = { {{.*}} readonly {{.*}} }
-; CHECK: attributes #2 = { {{.*}} writeonly }
+; CHECK: attributes #2 = { {{.*}} writeonly {{.*}} }
Index: llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
===
--- llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
+++ llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
@@ -38,7 +38,7 @@
 }
 
 define void @test_fn_mustprogress_readonly_calls(i32* %ptr) mustprogress {
-; CHECK: Function Attrs: readonly willreturn mustprogress
+; CHECK: Function Attrs: nofree readonly willreturn mustprogress
 ; CHECK-LABEL: 

[clang] f549176 - [funcattrs] Add the maximal set of implied attributes to definitions

2021-04-16 Thread Philip Reames via cfe-commits

Author: Philip Reames
Date: 2021-04-16T14:22:19-07:00
New Revision: f549176ad976caa3e19edd036df9a7e12770af7c

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

LOG: [funcattrs] Add the maximal set of implied attributes to definitions

Have funcattrs expand all implied attributes into the IR. This expands the 
infrastructure from D100400, but for definitions not declarations this time.

Somewhat subtly, this mostly isn't semantic. Because the accessors did the 
inference, any client which used the accessor was already getting the stronger 
result. Clients that directly checked presence of attributes (there are some), 
will see a stronger result now.

The old behavior can end up quite confusing for two reasons:
* Without this change, we have situations where function-attrs appears to fail 
when inferring an attribute (as seen by a human reading IR), but that consuming 
code will see that it should have been implied. As a human trying to sanity 
check test results and study IR for optimization possibilities, this is 
exceeding error prone and confusing. (I'll note that I wasted several hours 
recently because of this.)
* We can have transforms which trigger without the IR appearing (on inspection) 
to meet the preconditions. This change doesn't prevent this from happening (as 
the accessors still involve multiple checks), but it should make it less 
frequent.

I'd argue in favor of deleting the extra checks out of the accessors after this 
lands, but I want that in it's own review as a) it's purely stylistic, and b) I 
already know there's some disagreement.

Once this lands, I'm also going to do a cleanup change which will delete some 
now redundant duplicate predicates in the inference code, but again, that 
deserves to be a change of it's own.

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

Added: 


Modified: 
clang/test/CodeGenOpenCL/convergent.cl
llvm/lib/Transforms/IPO/FunctionAttrs.cpp
llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
llvm/test/CodeGen/AMDGPU/inline-attr.ll
llvm/test/Other/cgscc-devirt-iteration.ll
llvm/test/Other/cgscc-iterate-function-mutation.ll
llvm/test/Other/cgscc-observe-devirt.ll
llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll
llvm/test/Transforms/FunctionAttrs/atomic.ll
llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
llvm/test/Transforms/FunctionAttrs/nofree.ll
llvm/test/Transforms/FunctionAttrs/nosync.ll
llvm/test/Transforms/FunctionAttrs/nounwind.ll
llvm/test/Transforms/FunctionAttrs/optnone.ll
llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
llvm/test/Transforms/FunctionAttrs/writeonly.ll
llvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
llvm/test/Transforms/Inline/cgscc-update.ll

Removed: 




diff  --git a/clang/test/CodeGenOpenCL/convergent.cl 
b/clang/test/CodeGenOpenCL/convergent.cl
index 25951a64c1147..1905d7dd81aab 100644
--- a/clang/test/CodeGenOpenCL/convergent.cl
+++ b/clang/test/CodeGenOpenCL/convergent.cl
@@ -134,7 +134,7 @@ kernel void assume_convergent_asm()
   __asm__ volatile("s_barrier");
 }
 
-// CHECK: attributes #0 = { nofree noinline norecurse nounwind willreturn "
+// CHECK: attributes #0 = { nofree noinline norecurse nounwind willreturn 
mustprogress "
 // CHECK: attributes #1 = { {{[^}]*}}convergent{{[^}]*}} }
 // CHECK: attributes #2 = { {{[^}]*}}convergent{{[^}]*}} }
 // CHECK: attributes #3 = { {{[^}]*}}convergent noduplicate{{[^}]*}} }

diff  --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp 
b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index cfd302a536c6f..0202046158b14 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -57,6 +57,7 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/IPO.h"
+#include "llvm/Transforms/Utils/Local.h"
 #include 
 #include 
 #include 
@@ -1556,21 +1557,7 @@ static bool addNoSyncAttr(const SCCNodeSet ) {
 ++NumNoSync;
   },
   /* RequiresExactDefinition= */ true});
-  bool Changed = AI.run(SCCNodes);
-
-  // readnone + not convergent implies nosync
-  // (This is here so that we don't have to duplicate the function local
-  //  memory reasoning of the readnone analysis.)
-  for (Function *F : SCCNodes) {
-if (!F || F->hasNoSync())
-  continue;
-if (!F->doesNotAccessMemory() || F->isConvergent())
-  continue;
-F->setNoSync();
-NumNoSync++;
-Changed = true;
-  }
-  return Changed;
+  return AI.run(SCCNodes);
 }
 
 static SCCNodesResult createSCCNodeSet(ArrayRef Functions) {
@@ -1630,6 +1617,14 @@ static bool deriveAttrsInPostOrder(ArrayRef 
Functions,
 

[PATCH] D100609: [Offload][OpenMP][CUDA] Allow fembed-bitcode for device offload

2021-04-16 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: clang/test/Driver/embed-bitcode-nvptx.cu:1
+// RUN: %clang -Xclang -triple -Xclang nvptx64 -S -Xclang -target-feature 
-Xclang +ptx70 -fembed-bitcode=all --cuda-device-only -nocudalib -nocudainc %s 
-o - | FileCheck %s
+// REQUIRES: nvptx-registered-target

tra wrote:
> jdoerfert wrote:
> > tra wrote:
> > > This command line looks extremely odd to me.
> > > If you are compiling with `--cuda-device-only`, then clang should've 
> > > already set the right triple and the features.
> > > 
> > > Could you tell me more about what is the intent of the compilation and 
> > > why you use this particular set of options?
> > > I.e. why not just do `clang -x cuda --offload-arch=sm_70 
> > > --cuda-device-only -nocudalib -nocudainc`.
> > > 
> > > Could you tell me more about what is the intent of the compilation and 
> > > why you use this particular set of options?
> > 
> > because I never compiled cuda really ;)
> > 
> > I'll go with your options.
> Something still does not add up. 
> 
> AFAICT, the real problem is that that we're not adding `-target-cpu`, but 
> rather that `-fembed-bitcode=all` splits `-S` compilation into two phases -- 
> source-to-bitcode (this part gets all the right command line options and 
> compiles fine) and `IR -> PTX` compilation which does end up only with the 
> subset of the options and ends up failing because the intrinsics are not 
> enabled.
> 
> I think what we want to do in this case is to prevent splitting GPU-side 
> compilation. Adding a '-target-gpu' to the `IR->PTX` subcompilation may make 
> things work in this case, but it does not really fix the root cause. E.g. we 
> should also pass through the features set by the driver and, possibly, other 
> options to keep both source->IR and IR->PTX compilations in sync.
> 
> I think what we want to do in this case is to prevent splitting GPU-side 
> compilation.

I doubt that is as easy as it sounds. Where do we take the IR from then? (I 
want the GPU IR embedded after all)

> E.g. we should also pass through the features set by the driver and ..

I agree, what if I move the embedding handling to the end, keep the "blacklist" 
that removes arguments we don't want, and see where that leads us?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100609

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


[PATCH] D100673: [OPENMP]Fix PR49698: OpenMP declare mapper causes segmentation fault.

2021-04-16 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LG, thanks for the quick fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100673

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


[PATCH] D100671: [ADT] Factor out in_place_t and expose in Optional ctor

2021-04-16 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

This usage doesn't seem to quite match the standard - which provides an 
existing instance of in_place_t for callers to use:

  std::optional o4(std::in_place, {'a', 'b', 'c'});

(to quote https://en.cppreference.com/w/cpp/utility/optional/optional )

Probably good to match this sort of behavior.




Comment at: llvm/unittests/ADT/OptionalTest.cpp:227
+ const MultiArgConstructor ) {
+return LHS.x == RHS.x && LHS.y == RHS.y;
+  }

Could write this as: `return std::tie(LHS.x, LHS.y) == std::tie(RHS.x, RHS.y);` 
which I think is a bit tidier/easier to generalize to other comparisons, etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100671

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


[PATCH] D100567: BPF: emit debuginfo for Function of DeclRefExpr if requested

2021-04-16 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

Generally looks OK, but could you explain more about the problems 
with/motivation for the declaration/definition issue? (probably worth noting in 
the patch description maybe comment in code and test)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100567

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


[PATCH] D96033: [clang-repl] Land initial infrastructure for incremental parsing

2021-04-16 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment.

In D96033#2695748 , @rjmccall wrote:

> In D96033#2695622 , @v.g.vassilev 
> wrote:
>
>> Would it make sense to have each `Decl` point to its owning PTU, similarly 
>> to what we do for the owning module (`Decl::getOwningModule`)?
>
> I think that's the interface we want, but actually storing the PTU in every 
> `Decl` that way is probably prohibitive in memory overhead; we need some more 
> compact way to recover it.  But maybe it's okay to do something like that if 
> we can spare a bit in `Decl`.  Richard, thoughts here?

Ha, each `Decl` has a `getTranslationUnitDecl()` which may be rewired to point 
to the PTU...

>> In terms of future steps, do you prefer to try implementing what you 
>> suggested as part of this patch? I would prefer to land this patch and then 
>> add what we discussed here rather than keep piling to this already bulky 
>> patch.
>
> It depends on how much you think your patch is working towards that 
> architecture.  Since this is just infrastructure without much in the way of 
> Sema/IRGen changes, it's probably fine.  I haven't reviewed it yet, though, 
> sorry.

If you could skim through the patch it'd be great! I think the only bit that 
remotely touches on the new architecture is the `Transaction` class -- it is a 
pair of vector of decls and an llvm::Module. I think the vector of Decls would 
become a PTU in future.


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

https://reviews.llvm.org/D96033

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


[PATCH] D100567: BPF: emit debuginfo for Function of DeclRefExpr if requested

2021-04-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

@dblaikie I renamed the variable, added a few guards to ensure safety and avoid 
unnecessary attempt to generate duplicated debuginfo, and enhanced the test 
case to cover mix of declaration, accessing extern func address and definition 
of the function. Could you take a look?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100567

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


[PATCH] D100673: [OPENMP]Fix PR49698: OpenMP declare mapper causes segmentation fault.

2021-04-16 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 338210.
ABataev added a comment.

Added repro from PR49698


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100673

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/declare_mapper_codegen.cpp
  openmp/libomptarget/src/omptarget.cpp
  
openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_array.cpp
  
openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_array_subscript.cpp
  
openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_complex_structure.cpp
  
openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_ptr_subscript.cpp
  openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_var.cpp

Index: openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_var.cpp
===
--- /dev/null
+++ openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_var.cpp
@@ -0,0 +1,62 @@
+// RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-nvptx64-nvidia-cuda
+
+#include 
+#include 
+
+typedef struct {
+  int a;
+  double *b;
+} C1;
+#pragma omp declare mapper(C1 s) map(to : s.a) map(from : s.b [0:2])
+
+typedef struct {
+  int a;
+  double *b;
+  C1 c;
+} C;
+#pragma omp declare mapper(C s) map(to : s.a, s.c) map(from : s.b [0:2])
+
+typedef struct {
+  int e;
+  C f;
+  int h;
+} D;
+
+int main() {
+  constexpr int N = 10;
+  D s;
+  s.e = 111;
+  s.f.a = 222;
+  s.f.c.a = 777;
+  double x[2];
+  double x1[2];
+  x[1] = 20;
+  s.f.b = [0];
+  s.f.c.b = [0];
+  s.h = N;
+
+  printf("%d %d %d %4.5f %d\n", s.e, s.f.a, s.f.c.a, s.f.b[1],
+ s.f.b == [0] ? 1 : 0);
+  // CHECK: 111 222 777 20.0 1
+
+  __intptr_t p = reinterpret_cast<__intptr_t>([0]);
+
+#pragma omp target map(tofrom : s) firstprivate(p)
+  {
+printf("%d %d %d\n", s.f.a, s.f.c.a,
+   s.f.b == reinterpret_cast(p) ? 1 : 0);
+// CHECK: 222 777 0
+s.e = 333;
+s.f.a = 444;
+s.f.c.a = 555;
+s.f.b[1] = 40;
+  }
+
+  printf("%d %d %d %4.5f %d\n", s.e, s.f.a, s.f.c.a, s.f.b[1],
+ s.f.b == [0] ? 1 : 0);
+  // CHECK: 333 222 777 40.0 1
+}
Index: openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_ptr_subscript.cpp
===
--- /dev/null
+++ openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_ptr_subscript.cpp
@@ -0,0 +1,62 @@
+// RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-nvptx64-nvidia-cuda
+
+#include 
+#include 
+
+typedef struct {
+  int a;
+  double *b;
+} C1;
+#pragma omp declare mapper(C1 s) map(to : s.a) map(from : s.b [0:2])
+
+typedef struct {
+  int a;
+  double *b;
+  C1 c;
+} C;
+#pragma omp declare mapper(C s) map(to : s.a, s.c) map(from : s.b [0:2])
+
+typedef struct {
+  int e;
+  C f;
+  int h;
+} D;
+
+int main() {
+  constexpr int N = 10;
+  D s;
+  s.e = 111;
+  s.f.a = 222;
+  s.f.c.a = 777;
+  double x[2];
+  double x1[2];
+  x[1] = 20;
+  s.f.b = [0];
+  s.f.c.b = [0];
+  s.h = N;
+
+  D *sp = 
+
+  printf("%d %d %d %4.5f %d\n", sp[0].e, sp[0].f.a, sp[0].f.c.a, sp[0].f.b[1],
+ sp[0].f.b == [0] ? 1 : 0);
+  // CHECK: 111 222 777 20.0 1
+
+  __intptr_t p = reinterpret_cast<__intptr_t>([0]);
+#pragma omp target map(tofrom : sp[0]) firstprivate(p)
+  {
+printf("%d %d %d\n", sp[0].f.a, sp[0].f.c.a,
+   sp[0].f.b == reinterpret_cast(p) ? 1 : 0);
+// CHECK: 222 777 0
+sp[0].e = 333;
+sp[0].f.a = 444;
+sp[0].f.c.a = 555;
+sp[0].f.b[1] = 40;
+  }
+  printf("%d %d %d %4.5f %d\n", sp[0].e, sp[0].f.a, sp[0].f.c.a, sp[0].f.b[1],
+ sp[0].f.b == [0] ? 1 : 0);
+  // CHECK: 333 222 777 40.0 1
+}
Index: openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_complex_structure.cpp
===
--- /dev/null
+++ openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_complex_structure.cpp
@@ -0,0 +1,102 @@
+// RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
+// RUN: 

[PATCH] D96033: [clang-repl] Land initial infrastructure for incremental parsing

2021-04-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In D96033#2695622 , @v.g.vassilev 
wrote:

> Would it make sense to have each `Decl` point to its owning PTU, similarly to 
> what we do for the owning module (`Decl::getOwningModule`)?

I think that's the interface we want, but actually storing the PTU in every 
`Decl` that way is probably prohibitive in memory overhead; we need some more 
compact way to recover it.  But maybe it's okay to do something like that if we 
can spare a bit in `Decl`.  Richard, thoughts here?

> In terms of future steps, do you prefer to try implementing what you 
> suggested as part of this patch? I would prefer to land this patch and then 
> add what we discussed here rather than keep piling to this already bulky 
> patch.

It depends on how much you think your patch is working towards that 
architecture.  Since this is just infrastructure without much in the way of 
Sema/IRGen changes, it's probably fine.  I haven't reviewed it yet, though, 
sorry.


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

https://reviews.llvm.org/D96033

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


[PATCH] D99381: [compiler-rt][hwasan] Add Fuchsia-specific sanitizer platform limits

2021-04-16 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

I see, it's exposed here 
https://github.com/llvm/llvm-project/blob/6d2d3bd0a61f5fc7fd9f61f48bc30e9ca77cc619/compiler-rt/include/sanitizer/hwasan_interface.h#L88.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99381

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


[PATCH] D100673: [OPENMP]Fix PR49698: OpenMP declare mapper causes segmentation fault.

2021-04-16 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

In D100673#2695694 , @jdoerfert wrote:

> Can we use the reproducer from the bug report, I want an outermost array 
> section with objects that have a declare mapper.

Sure, will add.




Comment at: 
openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_array.cpp:7
+
+// XFAIL: clang
+

abhinavgaba wrote:
> Thanks for the fixes, Alexey. Are you planning on handling this case 
> separately?
Yes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100673

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


[PATCH] D100673: [OPENMP]Fix PR49698: OpenMP declare mapper causes segmentation fault.

2021-04-16 Thread Abhinav Gaba via Phabricator via cfe-commits
abhinavgaba added inline comments.



Comment at: 
openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_array.cpp:7
+
+// XFAIL: clang
+

Thanks for the fixes, Alexey. Are you planning on handling this case separately?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100673

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


[PATCH] D100673: [OPENMP]Fix PR49698: OpenMP declare mapper causes segmentation fault.

2021-04-16 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

Can we use the reproducer from the bug report, I want an outermost array 
section with objects that have a declare mapper.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100673

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


[PATCH] D100567: BPF: emit debuginfo for Function of DeclRefExpr if requested

2021-04-16 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 338202.
yonghong-song added a comment.

fix a clang-format warning


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100567

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/Basic/Targets/BPF.h
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/CodeGen/debug-info-extern-callback.c

Index: clang/test/CodeGen/debug-info-extern-callback.c
===
--- /dev/null
+++ clang/test/CodeGen/debug-info-extern-callback.c
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -x c -debug-info-kind=limited -triple bpf-linux-gnu -emit-llvm %s -o - | FileCheck %s
+
+extern int do_work1(int);
+long bpf_helper1(void *callback_fn);
+long prog1() {
+  return bpf_helper1(_work1);
+}
+
+extern int do_work2(int);
+long bpf_helper2(void *callback_fn);
+int do_work2(int arg) {
+  return arg;
+}
+long prog2() {
+  return bpf_helper2(_work2);
+}
+
+extern int do_work3(int);
+long bpf_helper3(void *callback_fn);
+long prog3() {
+  return bpf_helper3(_work3);
+}
+int do_work3(int arg) {
+  return arg;
+}
+
+// CHECK: declare !dbg ![[FUNC1:[0-9]+]] i32 @do_work1(i32)
+// CHECK: define dso_local i32 @do_work2(i32 %arg) #{{[0-9]+}} !dbg ![[FUNC2:[0-9]+]]
+// CHECK: define dso_local i32 @do_work3(i32 %arg) #{{[0-9]+}} !dbg ![[FUNC3:[0-9]+]]
+
+// CHECK: ![[FUNC1]] = !DISubprogram(name: "do_work1"
+// CHECK: ![[FUNC2]] = distinct !DISubprogram(name: "do_work2"
+// CHECK: ![[FUNC3]] = distinct !DISubprogram(name: "do_work3"
Index: clang/lib/Sema/SemaDecl.cpp
===
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -12667,7 +12667,7 @@
 Diag(Var->getLocation(), diag::note_private_extern);
   }
 
-  if (Context.getTargetInfo().allowDebugInfoForExternalVar() &&
+  if (Context.getTargetInfo().allowDebugInfoForExternalRef() &&
   !Var->isInvalidDecl() && !getLangOpts().CPlusPlus)
 ExternalDeclarations.push_back(Var);
 
Index: clang/lib/CodeGen/CGExpr.cpp
===
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -2834,8 +2834,20 @@
 return LV;
   }
 
-  if (const auto *FD = dyn_cast(ND))
-return EmitFunctionDeclLValue(*this, E, FD);
+  if (const auto *FD = dyn_cast(ND)) {
+LValue LV = EmitFunctionDeclLValue(*this, E, FD);
+
+// Emit debuginfo for the function declaration if the target wants to.
+if (getContext().getTargetInfo().allowDebugInfoForExternalRef()) {
+  auto *Fn = dyn_cast(LV.getPointer(*this));
+  if (!FD->isDefined() && !Fn->getSubprogram()) {
+CGM.getModuleDebugInfo()->EmitFunctionDecl(FD, FD->getLocation(), T,
+   Fn);
+  }
+}
+
+return LV;
+  }
 
   // FIXME: While we're emitting a binding from an enclosing scope, all other
   // DeclRefExprs we see should be implicitly treated as if they also refer to
Index: clang/lib/Basic/Targets/BPF.h
===
--- clang/lib/Basic/Targets/BPF.h
+++ clang/lib/Basic/Targets/BPF.h
@@ -76,7 +76,7 @@
 return None;
   }
 
-  bool allowDebugInfoForExternalVar() const override { return true; }
+  bool allowDebugInfoForExternalRef() const override { return true; }
 
   CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
 switch (CC) {
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -1538,8 +1538,8 @@
 
   virtual void setAuxTarget(const TargetInfo *Aux) {}
 
-  /// Whether target allows debuginfo types for decl only variables.
-  virtual bool allowDebugInfoForExternalVar() const { return false; }
+  /// Whether target allows debuginfo types for decl only variables/functions.
+  virtual bool allowDebugInfoForExternalRef() const { return false; }
 
 protected:
   /// Copy type and layout related info.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99675: RFC [llvm][clang] Create new intrinsic llvm.arith.fence to control FP optimization at expression level

2021-04-16 Thread Kevin P. Neal via Phabricator via cfe-commits
kpn added a comment.

In D99675#2695480 , @mibintc wrote:

> In D99675#2695424 , @kpn wrote:
>
>> What changes are needed for a backend, and what happens if they aren't done?
>
> In the clang patch, I'm planning to add into TargetInfo a function like "does 
> the target support __arithmetic_fence"?
> In the llvm patch, the fallback implementation could be to merely ignore the 
> call, and pass through the operand value. Is that adequate?

If clang is the only compiler to ever emit this new intrinsic then, yes, that's 
perfectly fine.

If a front-end other than clang uses the new fence then I'm nervous about 
having the fence just vanish. If the fence is used then it must be for 
correctness, right? Having something needed for correctness silently not work 
seems ... sub-optimal. It's the sort of thing that might not get caught in 
testing, and then you've got end-users running software that silently lacks 
something needed for correctness. That makes me nervous. I'd rather LLVM bomb 
instead of silently dropping this fence. Then developers know they have a 
problem before a product goes out the door.

But if I'm the only one that's nervous then that's OK and clang rejecting the 
compile would be sufficient.

Has this sort of issue come up in the past? How was it handled?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99675

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


[PATCH] D96033: [clang-repl] Land initial infrastructure for incremental parsing

2021-04-16 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment.

Thank you for the details -- will be really useful to me and that architecture 
will define away several hard problems we tried to solve over the years.

In D96033#2693910 , @rjmccall wrote:

> Sorry for the delay.  That seems like a reasonable summary of our discussion. 
>  Let me try to lay out the right architecture for this as I see it.
>
> Conceptually, we can split the translation unit into a sequence of partial 
> translation units (PTUs).  Every declaration will be associated with a unique 
> PTU that owns it.
>
> The first key insight here is that the owning PTU isn't always the "active" 
> (most recent) PTU, and it isn't always the PTU that the declaration "comes 
> from".  A new declaration (that isn't a redeclaration or specialization of 
> anything) does belong to the active PTU.  A template specialization, however, 
> belongs to the most recent PTU of all the declarations in its signature — 
> mostly that means that it can be pulled into a more recent PTU by its 
> template arguments.
>
> The second key insight is that processing a PTU might extend an earlier PTU.  
> Rolling back the later PTU shouldn't throw that extension away.  For example, 
> if the second PTU defines a template, and the third PTU requires that 
> template to be instantiated at `float`, that template specialization is still 
> part of the second PTU.  Similarly, if the fifth PTU uses an inline function 
> belonging to the fourth, that definition still belongs to the fourth.  When 
> we go to emit code in a new PTU, we map each declaration we have to emit back 
> to its owning PTU and emit it in a new module for just the extensions to that 
> PTU.  We keep track of all the modules we've emitted for a PTU so that we can 
> unload them all if we decide to roll it back.
>
> Most declarations/definitions will only refer to entities from the same or 
> earlier PTUs.  However, it is possible (primarily by defining a 
> previously-declared entity, but also through templates or ADL) for an entity 
> that belongs to one PTU to refer to something from a later PTU.  We will have 
> to keep track of this and prevent unwinding to later PTU when we recognize 
> it.  Fortunately, this should be very rare; and crucially, we don't have to 
> do the bookkeeping for this if we've only got one PTU, e.g. in normal 
> compilation.  Otherwise, PTUs after the first just need to record enough 
> metadata to be able to revert any changes they've made to declarations 
> belonging to earlier PTUs, e.g. to redeclaration chains or template 
> specialization lists.
>
> It should even eventually be possible for PTUs to provide their own slab 
> allocators which can be thrown away as part of rolling back the PTU.  We can 
> maintain a notion of the active allocator and allocate things like Stmt/Expr 
> nodes in it, temporarily changing it to the appropriate PTU whenever we go to 
> do something like instantiate a function template.  More care will be 
> required when allocating declarations and types, though.
>
> We would want the PTU to be efficiently recoverable from a `Decl`; I'm not 
> sure how best to do that.  An easy option that would cover most declarations 
> would be to make multiple `TranslationUnitDecl`s and parent the declarations 
> appropriately, but I don't think that's good enough for things like member 
> function templates, since an instantiation of that would still be parented by 
> its original class.  Maybe we can work this into the DC chain somehow, like 
> how lexical DCs are.

Would it make sense to have each `Decl` point to its owning PTU, similarly to 
what we do for the owning module (`Decl::getOwningModule`)?

In terms of future steps, do you prefer to try implementing what you suggested 
as part of this patch? I would prefer to land this patch and then add what we 
discussed here rather than keep piling to this already bulky patch.


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

https://reviews.llvm.org/D96033

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


[PATCH] D100596: [WebAssembly] Remove saturating fp-to-int target intrinsics

2021-04-16 Thread Thomas Lively via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c729750a6d7: [WebAssembly] Remove saturating fp-to-int 
target intrinsics (authored by tlively).

Changed prior to commit:
  https://reviews.llvm.org/D100596?vs=337888=338194#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100596

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins-wasm.c
  llvm/include/llvm/IR/IntrinsicsWebAssembly.td
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISD.def
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h
  llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td
  llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
  llvm/test/CodeGen/WebAssembly/conv.ll
  llvm/test/CodeGen/WebAssembly/simd-intrinsics.ll
  llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc_saturate.ll

Index: llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc_saturate.ll
===
--- llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc_saturate.ll
+++ /dev/null
@@ -1,610 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -instsimplify -S | FileCheck %s
-
-target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
-target triple = "wasm32-unknown-unknown"
-
-declare i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float)
-declare i32 @llvm.wasm.trunc.saturate.unsigned.i32.f32(float)
-declare i32 @llvm.wasm.trunc.saturate.signed.i32.f64(double)
-declare i32 @llvm.wasm.trunc.saturate.unsigned.i32.f64(double)
-declare i64 @llvm.wasm.trunc.saturate.signed.i64.f32(float)
-declare i64 @llvm.wasm.trunc.saturate.unsigned.i64.f32(float)
-declare i64 @llvm.wasm.trunc.saturate.signed.i64.f64(double)
-declare i64 @llvm.wasm.trunc.saturate.unsigned.i64.f64(double)
-
-define void @test_i32_trunc_sat_f32_s(i32* %p) {
-; CHECK-LABEL: @test_i32_trunc_sat_f32_s(
-; CHECK-NEXT:store volatile i32 0, i32* [[P:%.*]], align 4
-; CHECK-NEXT:store volatile i32 0, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 0, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 0, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 1, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 1, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 1, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 -1, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 -1, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 -1, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 -1, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 -2, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 2147483520, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 -2147483648, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 2147483647, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 -2147483648, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 2147483647, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 -2147483648, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 0, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 0, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 0, i32* [[P]], align 4
-; CHECK-NEXT:store volatile i32 0, i32* [[P]], align 4
-; CHECK-NEXT:ret void
-;
-  %t0 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float +0.0)
-  store volatile i32 %t0, i32* %p
-  %t1 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float -0.0)
-  store volatile i32 %t1, i32* %p
-  %t2 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float 0x36a0); 0x1p-149
-  store volatile i32 %t2, i32* %p
-  %t3 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float 0xb6a0); -0x1p-149
-  store volatile i32 %t3, i32* %p
-  %t4 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float 1.0)
-  store volatile i32 %t4, i32* %p
-  %t5 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float 0x3ff1a000); 0x1.1ap+0
-  store volatile i32 %t5, i32* %p
-  %t6 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float 1.5)
-  store volatile i32 %t6, i32* %p
-  %t7 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float -1.0)
-  store volatile i32 %t7, i32* %p
-  %t8 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float 0xbff1a000); -0x1.1ap+0
-  store volatile i32 %t8, i32* %p
-  %t9 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float -1.5)
-  store volatile i32 %t9, i32* %p
-  %t10 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float 0xbffe6000); -1.9
-  store volatile i32 %t10, i32* %p
-  %t11 = call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float -2.0)
-  store volatile i32 %t11, i32* %p
-  %t12 = call i32 

[clang] 5c72975 - [WebAssembly] Remove saturating fp-to-int target intrinsics

2021-04-16 Thread Thomas Lively via cfe-commits

Author: Thomas Lively
Date: 2021-04-16T12:11:20-07:00
New Revision: 5c729750a6d75df4eeb3eaad72e0b4e93ea27c0e

URL: 
https://github.com/llvm/llvm-project/commit/5c729750a6d75df4eeb3eaad72e0b4e93ea27c0e
DIFF: 
https://github.com/llvm/llvm-project/commit/5c729750a6d75df4eeb3eaad72e0b4e93ea27c0e.diff

LOG: [WebAssembly] Remove saturating fp-to-int target intrinsics

Use the target-independent @llvm.fptosi and @llvm.fptoui intrinsics instead.
This includes removing the instrinsics for i32x4.trunc_sat_zero_f64x2_{s,u},
which are now represented in IR as a saturating truncation to a v2i32 followed 
by
a concatenation with a zero vector.

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

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/builtins-wasm.c
llvm/include/llvm/IR/IntrinsicsWebAssembly.td
llvm/lib/Analysis/ConstantFolding.cpp
llvm/lib/Target/WebAssembly/WebAssemblyISD.def
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h
llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td
llvm/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td
llvm/test/CodeGen/WebAssembly/conv.ll
llvm/test/CodeGen/WebAssembly/simd-intrinsics.ll

Removed: 
llvm/test/Transforms/InstSimplify/ConstProp/WebAssembly/trunc_saturate.ll



diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 860492a281fe0..7e19532322536 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -17073,8 +17073,8 @@ Value 
*CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
   case WebAssembly::BI__builtin_wasm_trunc_saturate_s_i32x4_f32x4: {
 Value *Src = EmitScalarExpr(E->getArg(0));
 llvm::Type *ResT = ConvertType(E->getType());
-Function *Callee = CGM.getIntrinsic(Intrinsic::wasm_trunc_saturate_signed,
-{ResT, Src->getType()});
+Function *Callee =
+CGM.getIntrinsic(Intrinsic::fptosi_sat, {ResT, Src->getType()});
 return Builder.CreateCall(Callee, {Src});
   }
   case WebAssembly::BI__builtin_wasm_trunc_saturate_u_i32_f32:
@@ -17084,8 +17084,8 @@ Value 
*CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
   case WebAssembly::BI__builtin_wasm_trunc_saturate_u_i32x4_f32x4: {
 Value *Src = EmitScalarExpr(E->getArg(0));
 llvm::Type *ResT = ConvertType(E->getType());
-Function *Callee = 
CGM.getIntrinsic(Intrinsic::wasm_trunc_saturate_unsigned,
-{ResT, Src->getType()});
+Function *Callee =
+CGM.getIntrinsic(Intrinsic::fptoui_sat, {ResT, Src->getType()});
 return Builder.CreateCall(Callee, {Src});
   }
   case WebAssembly::BI__builtin_wasm_min_f32:
@@ -17481,16 +17481,24 @@ Value 
*CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
 unsigned IntNo;
 switch (BuiltinID) {
 case WebAssembly::BI__builtin_wasm_trunc_sat_zero_s_f64x2_i32x4:
-  IntNo = Intrinsic::wasm_trunc_sat_zero_signed;
+  IntNo = Intrinsic::fptosi_sat;
   break;
 case WebAssembly::BI__builtin_wasm_trunc_sat_zero_u_f64x2_i32x4:
-  IntNo = Intrinsic::wasm_trunc_sat_zero_unsigned;
+  IntNo = Intrinsic::fptoui_sat;
   break;
 default:
   llvm_unreachable("unexpected builtin ID");
 }
-Function *Callee = CGM.getIntrinsic(IntNo);
-return Builder.CreateCall(Callee, Vec);
+llvm::Type *SrcT = Vec->getType();
+llvm::Type *TruncT =
+SrcT->getWithNewType(llvm::IntegerType::get(getLLVMContext(), 32));
+Function *Callee = CGM.getIntrinsic(IntNo, {TruncT, SrcT});
+Value *Trunc = Builder.CreateCall(Callee, Vec);
+Value *Splat = Builder.CreateVectorSplat(2, Builder.getInt32(0));
+Value *ConcatMask =
+llvm::ConstantVector::get({Builder.getInt32(0), Builder.getInt32(1),
+   Builder.getInt32(2), Builder.getInt32(3)});
+return Builder.CreateShuffleVector(Trunc, Splat, ConcatMask);
   }
   case WebAssembly::BI__builtin_wasm_demote_zero_f64x2_f32x4: {
 Value *Vec = EmitScalarExpr(E->getArg(0));

diff  --git a/clang/test/CodeGen/builtins-wasm.c 
b/clang/test/CodeGen/builtins-wasm.c
index 1a986f03dc498..d20b6a739f94a 100644
--- a/clang/test/CodeGen/builtins-wasm.c
+++ b/clang/test/CodeGen/builtins-wasm.c
@@ -123,49 +123,49 @@ long long trunc_u_i64_f64(double f) {
 
 int trunc_saturate_s_i32_f32(float f) {
   return __builtin_wasm_trunc_saturate_s_i32_f32(f);
-  // WEBASSEMBLY: call i32 @llvm.wasm.trunc.saturate.signed.i32.f32(float %f)
+  // WEBASSEMBLY: call i32 @llvm.fptosi.sat.i32.f32(float %f)
   // WEBASSEMBLY-NEXT: ret
 }
 
 int trunc_saturate_u_i32_f32(float f) {
   return __builtin_wasm_trunc_saturate_u_i32_f32(f);
-  // WEBASSEMBLY: call i32 @llvm.wasm.trunc.saturate.unsigned.i32.f32(float %f)
+  // WEBASSEMBLY: call i32 

[PATCH] D100056: [SystemZ][z/OS] Set files in FileRemapper.cpp are text

2021-04-16 Thread Jonathan Crowther via Phabricator via cfe-commits
Jonathan.Crowther accepted this revision.
Jonathan.Crowther added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100056

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


[PATCH] D100509: Support GCC's -fstack-usage flag

2021-04-16 Thread Pengxuan Zheng via Phabricator via cfe-commits
pzheng added a comment.

Thanks for all the great feedbacks, @jansvoboda11, @xbolva00 and @lebedev.ri! 
Is there any other concern that needs to be addressed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100509

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


[PATCH] D100596: [WebAssembly] Remove saturating fp-to-int target intrinsics

2021-04-16 Thread Thomas Lively via Phabricator via cfe-commits
tlively added inline comments.



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:124-127
+  if (Subtarget->hasNontrappingFPToInt())
+for (auto Op : {ISD::FP_TO_SINT_SAT, ISD::FP_TO_UINT_SAT})
+  for (auto T : {MVT::i32, MVT::i64})
+setOperationAction(Op, T, Custom);

aheejin wrote:
> So far these have been expanded then?
That's right  



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:2100
+TargetLowering::DAGCombinerInfo ) {
+  auto  = DCI.DAG;
+  assert(N->getOpcode() == ISD::CONCAT_VECTORS);

aheejin wrote:
> So even though you used `Builder.CreateShuffleVector` in Clang, do they 
> appear as not `VECTOR_SHUFFLE` but `CONCAT_VECTORS` by the time they reach 
> isel?
Right. LLVM IR has no concat_vectors instruction, but the pattern is recognized 
by SelectionDAGBuilder and turned into a concat_vectors SDNode.



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:2130
+return SDValue();
+  if (!!SplatValue)
+return SDValue();

aheejin wrote:
> Nit: I think it is a little easier to read 
Will fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100596

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


[clang] 4696857 - DeclContext: Fix iterator category

2021-04-16 Thread Björn Schäpers via cfe-commits

Author: Björn Schäpers
Date: 2021-04-16T20:59:36+02:00
New Revision: 46968577336f29ddc5fd30e87cb94b03fa3c9cd9

URL: 
https://github.com/llvm/llvm-project/commit/46968577336f29ddc5fd30e87cb94b03fa3c9cd9
DIFF: 
https://github.com/llvm/llvm-project/commit/46968577336f29ddc5fd30e87cb94b03fa3c9cd9.diff

LOG: DeclContext: Fix iterator category

This amends 0cb7e7ca0c864e052bf49978f3bcd667c9e16930.
The iterator category of lookup_iterator was changed, but here it stayed
hardcoded as random access. Found while trying to build Clazy.

Differential-Revision: https://reviews.llvm.org/D100590

Added: 


Modified: 
clang/include/clang/AST/DeclBase.h

Removed: 




diff  --git a/clang/include/clang/AST/DeclBase.h 
b/clang/include/clang/AST/DeclBase.h
index 084ecb5389cee..482d2889a25a1 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -2378,7 +2378,7 @@ class DeclContext {
 
   using udir_iterator_base =
   llvm::iterator_adaptor_base;
 
   struct udir_iterator : udir_iterator_base {



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


[PATCH] D100056: [SystemZ][z/OS] Set files in FileRemapper.cpp are text

2021-04-16 Thread Abhina Sree via Phabricator via cfe-commits
abhina.sreeskantharajan updated this revision to Diff 338192.
abhina.sreeskantharajan added a comment.

fix formatting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100056

Files:
  clang/lib/ARCMigrate/FileRemapper.cpp


Index: clang/lib/ARCMigrate/FileRemapper.cpp
===
--- clang/lib/ARCMigrate/FileRemapper.cpp
+++ clang/lib/ARCMigrate/FileRemapper.cpp
@@ -63,7 +63,7 @@
   std::vector > pairs;
 
   llvm::ErrorOr> fileBuf =
-  llvm::MemoryBuffer::getFile(infoFile);
+  llvm::MemoryBuffer::getFile(infoFile, /*IsText=*/true);
   if (!fileBuf)
 return report("Error opening file: " + infoFile, Diag);
 
@@ -121,7 +121,7 @@
 
   std::error_code EC;
   std::string infoFile = std::string(outputPath);
-  llvm::raw_fd_ostream infoOut(infoFile, EC, llvm::sys::fs::OF_None);
+  llvm::raw_fd_ostream infoOut(infoFile, EC, llvm::sys::fs::OF_Text);
   if (EC)
 return report(EC.message(), Diag);
 
@@ -142,9 +142,10 @@
 
   SmallString<64> tempPath;
   int fd;
-  if (fs::createTemporaryFile(path::filename(origFE->getName()),
-  
path::extension(origFE->getName()).drop_front(), fd,
-  tempPath))
+  if (fs::createTemporaryFile(
+  path::filename(origFE->getName()),
+  path::extension(origFE->getName()).drop_front(), fd, tempPath,
+  llvm::sys::fs::OF_Text))
 return report("Could not create file: " + tempPath.str(), Diag);
 
   llvm::raw_fd_ostream newOut(fd, /*shouldClose=*/true);


Index: clang/lib/ARCMigrate/FileRemapper.cpp
===
--- clang/lib/ARCMigrate/FileRemapper.cpp
+++ clang/lib/ARCMigrate/FileRemapper.cpp
@@ -63,7 +63,7 @@
   std::vector > pairs;
 
   llvm::ErrorOr> fileBuf =
-  llvm::MemoryBuffer::getFile(infoFile);
+  llvm::MemoryBuffer::getFile(infoFile, /*IsText=*/true);
   if (!fileBuf)
 return report("Error opening file: " + infoFile, Diag);
 
@@ -121,7 +121,7 @@
 
   std::error_code EC;
   std::string infoFile = std::string(outputPath);
-  llvm::raw_fd_ostream infoOut(infoFile, EC, llvm::sys::fs::OF_None);
+  llvm::raw_fd_ostream infoOut(infoFile, EC, llvm::sys::fs::OF_Text);
   if (EC)
 return report(EC.message(), Diag);
 
@@ -142,9 +142,10 @@
 
   SmallString<64> tempPath;
   int fd;
-  if (fs::createTemporaryFile(path::filename(origFE->getName()),
-  path::extension(origFE->getName()).drop_front(), fd,
-  tempPath))
+  if (fs::createTemporaryFile(
+  path::filename(origFE->getName()),
+  path::extension(origFE->getName()).drop_front(), fd, tempPath,
+  llvm::sys::fs::OF_Text))
 return report("Could not create file: " + tempPath.str(), Diag);
 
   llvm::raw_fd_ostream newOut(fd, /*shouldClose=*/true);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D100675: [clang] Do not crash on template specialization following a fatal error

2021-04-16 Thread Adam Czachorowski via Phabricator via cfe-commits
adamcz created this revision.
adamcz added a reviewer: sammccall.
adamcz requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

There was a missing isInvalid() check leading to an attempt to
instantiate template with an empty instantiation stack.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100675

Files:
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/SemaCXX/template-specialization-fatal.cpp


Index: clang/test/SemaCXX/template-specialization-fatal.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/template-specialization-fatal.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+// Verify clang doesn't assert()-fail on template specialization happening 
after
+// fatal error.
+
+#include "not_found.h"  // expected-error {{'not_found.h' file not found}}
+
+template 
+struct __is_core_convertible : public false_type {};
+
+template 
+struct __is_core_convertible<_Tp, _Up, decltype(static_cast(0)(
+static_cast<_Tp (*)()>(0)()))> : public true_type {};
Index: clang/lib/Sema/SemaTemplateDeduction.cpp
===
--- clang/lib/Sema/SemaTemplateDeduction.cpp
+++ clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -5466,6 +5466,9 @@
Deduced.end());
   Sema::InstantiatingTemplate Inst(S, Info.getLocation(), P2, DeducedArgs,
Info);
+  if (Inst.isInvalid())
+return false;
+
   auto *TST1 = T1->castAs();
   bool AtLeastAsSpecialized;
   S.runWithSufficientStackSpace(Info.getLocation(), [&] {


Index: clang/test/SemaCXX/template-specialization-fatal.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/template-specialization-fatal.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+// Verify clang doesn't assert()-fail on template specialization happening after
+// fatal error.
+
+#include "not_found.h"  // expected-error {{'not_found.h' file not found}}
+
+template 
+struct __is_core_convertible : public false_type {};
+
+template 
+struct __is_core_convertible<_Tp, _Up, decltype(static_cast(0)(
+static_cast<_Tp (*)()>(0)()))> : public true_type {};
Index: clang/lib/Sema/SemaTemplateDeduction.cpp
===
--- clang/lib/Sema/SemaTemplateDeduction.cpp
+++ clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -5466,6 +5466,9 @@
Deduced.end());
   Sema::InstantiatingTemplate Inst(S, Info.getLocation(), P2, DeducedArgs,
Info);
+  if (Inst.isInvalid())
+return false;
+
   auto *TST1 = T1->castAs();
   bool AtLeastAsSpecialized;
   S.runWithSufficientStackSpace(Info.getLocation(), [&] {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 0daf273 - [Builtins] Add memory allocation builtins (PR12543)

2021-04-16 Thread Dávid Bolvanský via cfe-commits

Author: Dávid Bolvanský
Date: 2021-04-16T20:36:46+02:00
New Revision: 0daf27302518dcc521fae5cb5c7f72b783c13c35

URL: 
https://github.com/llvm/llvm-project/commit/0daf27302518dcc521fae5cb5c7f72b783c13c35
DIFF: 
https://github.com/llvm/llvm-project/commit/0daf27302518dcc521fae5cb5c7f72b783c13c35.diff

LOG: [Builtins] Add memory allocation builtins (PR12543)

Added: 


Modified: 
clang/include/clang/Basic/Builtins.def
clang/test/CodeGen/builtins.c

Removed: 




diff  --git a/clang/include/clang/Basic/Builtins.def 
b/clang/include/clang/Basic/Builtins.def
index 8518f3789f51a..92da70ea05db3 100644
--- a/clang/include/clang/Basic/Builtins.def
+++ b/clang/include/clang/Basic/Builtins.def
@@ -529,6 +529,7 @@ BUILTIN(__builtin_rotateright32, "UZiUZiUZi", "nc")
 BUILTIN(__builtin_rotateright64, "UWiUWiUWi", "nc")
 
 // Random GCC builtins
+BUILTIN(__builtin_calloc, "v*zz", "nF")
 BUILTIN(__builtin_constant_p, "i.", "nctu")
 BUILTIN(__builtin_classify_type, "i.", "nctu")
 BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "nc")
@@ -542,6 +543,8 @@ BUILTIN(__builtin_bcmp, "ivC*vC*z", "Fn")
 BUILTIN(__builtin_bcopy, "vv*v*z", "n")
 BUILTIN(__builtin_bzero, "vv*z", "nF")
 BUILTIN(__builtin_fprintf, "iP*cC*.", "Fp:1:")
+BUILTIN(__builtin_free, "vv*", "nF")
+BUILTIN(__builtin_malloc, "v*z", "nF")
 BUILTIN(__builtin_memchr, "v*vC*iz", "nF")
 BUILTIN(__builtin_memcmp, "ivC*vC*z", "nF")
 BUILTIN(__builtin_memcpy, "v*v*vC*z", "nF")
@@ -577,6 +580,7 @@ BUILTIN(__builtin_wmemchr, "w*wC*wz", "nF")
 BUILTIN(__builtin_wmemcmp, "iwC*wC*z", "nF")
 BUILTIN(__builtin_wmemcpy, "w*w*wC*z", "nF")
 BUILTIN(__builtin_wmemmove, "w*w*wC*z", "nF")
+BUILTIN(__builtin_realloc, "v*v*z", "nF")
 BUILTIN(__builtin_return_address, "v*IUi", "n")
 BUILTIN(__builtin_extract_return_addr, "v*v*", "n")
 BUILTIN(__builtin_frame_address, "v*IUi", "n")
@@ -586,8 +590,9 @@ BUILTIN(__builtin_longjmp, "vv**i", "r")
 BUILTIN(__builtin_unwind_init, "v", "")
 BUILTIN(__builtin_eh_return_data_regno, "iIi", "nc")
 BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:")
-BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:")
+BUILTIN(__builtin_sprintf, "ic*cC*.", "nFP:1:")
 BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:")
+BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:")
 BUILTIN(__builtin_thread_pointer, "v*", "nc")
 BUILTIN(__builtin_launder, "v*v*", "nt")
 LANGBUILTIN(__builtin_is_constant_evaluated, "b", "n", CXX_LANG)

diff  --git a/clang/test/CodeGen/builtins.c b/clang/test/CodeGen/builtins.c
index 2bb4a500dde5b..9ecb4a2a3c0a8 100644
--- a/clang/test/CodeGen/builtins.c
+++ b/clang/test/CodeGen/builtins.c
@@ -91,11 +91,15 @@ int main() {
   char s0[10], s1[] = "Hello";
   V(strcat, (s0, s1));
   V(strcmp, (s0, s1));
+  V(strdup, (s0));
   V(strncat, (s0, s1, n));
+  V(strndup, (s0, n));
   V(strchr, (s0, s1[0]));
   V(strrchr, (s0, s1[0]));
   V(strcpy, (s0, s1));
   V(strncpy, (s0, s1, n));
+  V(sprintf, (s0, "%s", s1));
+  V(snprintf, (s0, n, "%s", s1));
   
   // Object size checking
   V(__memset_chk, (s0, 0, sizeof s0, n));
@@ -438,6 +442,20 @@ void test_builtin_longjmp(void **buffer) {
 
 #endif
 
+// CHECK-LABEL: define{{.*}} void @test_memory_builtins
+void test_memory_builtins(int n) {
+  // CHECK: call i8* @malloc
+  void * p = __builtin_malloc(n);
+  // CHECK: call void @free
+  __builtin_free(p);
+  // CHECK: call i8* @calloc
+  p = __builtin_calloc(1, n);
+  // CHECK: call i8* @realloc
+  p = __builtin_realloc(p, n);
+  // CHECK: call void @free
+  __builtin_free(p);
+}
+
 // CHECK-LABEL: define{{.*}} i64 @test_builtin_readcyclecounter
 long long test_builtin_readcyclecounter() {
   // CHECK: call i64 @llvm.readcyclecounter()



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


[clang] eaa9ef0 - [CUDA, FDO] Filter out profiling options from GPU-side compilations.

2021-04-16 Thread Artem Belevich via cfe-commits

Author: Artem Belevich
Date: 2021-04-16T11:35:28-07:00
New Revision: eaa9ef075d9b4d49ce9dae723516e7e6e8b0c4b6

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

LOG: [CUDA, FDO] Filter out profiling options from GPU-side compilations.

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/clang_f_opts.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 22f4ad15ac370..074556089a243 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4159,7 +4159,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // include as part of the module. All other jobs are expected to have exactly
   // one input.
   bool IsCuda = JA.isOffloading(Action::OFK_Cuda);
+  bool IsCudaDevice = JA.isDeviceOffloading(Action::OFK_Cuda);
   bool IsHIP = JA.isOffloading(Action::OFK_HIP);
+  bool IsHIPDevice = JA.isDeviceOffloading(Action::OFK_HIP);
   bool IsOpenMPDevice = JA.isDeviceOffloading(Action::OFK_OpenMP);
   bool IsHeaderModulePrecompile = isa(JA);
 
@@ -5003,8 +5005,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // Prepare `-aux-target-cpu` and `-aux-target-feature` unless
   // `--gpu-use-aux-triple-only` is specified.
   if (!Args.getLastArg(options::OPT_gpu_use_aux_triple_only) &&
-  ((IsCuda && JA.isDeviceOffloading(Action::OFK_Cuda)) ||
-   (IsHIP && JA.isDeviceOffloading(Action::OFK_HIP {
+  (IsCudaDevice || IsHIPDevice)) {
 const ArgList  =
 C.getArgsForToolChain(nullptr, StringRef(), Action::OFK_None);
 std::string HostCPU =
@@ -5824,29 +5825,32 @@ void Clang::ConstructJob(Compilation , const 
JobAction ,
 Args.MakeArgString(Twine("-fcf-protection=") + A->getValue()));
   }
 
-  // Forward -f options with positive and negative forms; we translate
-  // these by hand.
-  if (Arg *A = getLastProfileSampleUseArg(Args)) {
-auto *PGOArg = Args.getLastArg(
-options::OPT_fprofile_generate, options::OPT_fprofile_generate_EQ,
-options::OPT_fcs_profile_generate, 
options::OPT_fcs_profile_generate_EQ,
-options::OPT_fprofile_use, options::OPT_fprofile_use_EQ);
-if (PGOArg)
-  D.Diag(diag::err_drv_argument_not_allowed_with)
-  << "SampleUse with PGO options";
+  // Forward -f options with positive and negative forms; we translate these by
+  // hand.  Do not propagate PGO options to the GPU-side compilations as the
+  // profile info is for the host-side compilation only.
+  if (!(IsCudaDevice || IsHIPDevice)) {
+if (Arg *A = getLastProfileSampleUseArg(Args)) {
+  auto *PGOArg = Args.getLastArg(
+  options::OPT_fprofile_generate, options::OPT_fprofile_generate_EQ,
+  options::OPT_fcs_profile_generate,
+  options::OPT_fcs_profile_generate_EQ, options::OPT_fprofile_use,
+  options::OPT_fprofile_use_EQ);
+  if (PGOArg)
+D.Diag(diag::err_drv_argument_not_allowed_with)
+<< "SampleUse with PGO options";
+
+  StringRef fname = A->getValue();
+  if (!llvm::sys::fs::exists(fname))
+D.Diag(diag::err_drv_no_such_file) << fname;
+  else
+A->render(Args, CmdArgs);
+}
+Args.AddLastArg(CmdArgs, options::OPT_fprofile_remapping_file_EQ);
 
-StringRef fname = A->getValue();
-if (!llvm::sys::fs::exists(fname))
-  D.Diag(diag::err_drv_no_such_file) << fname;
-else
-  A->render(Args, CmdArgs);
+if (Args.hasFlag(options::OPT_fpseudo_probe_for_profiling,
+ options::OPT_fno_pseudo_probe_for_profiling, false))
+  CmdArgs.push_back("-fpseudo-probe-for-profiling");
   }
-  Args.AddLastArg(CmdArgs, options::OPT_fprofile_remapping_file_EQ);
-
-  if (Args.hasFlag(options::OPT_fpseudo_probe_for_profiling,
-   options::OPT_fno_pseudo_probe_for_profiling, false))
-CmdArgs.push_back("-fpseudo-probe-for-profiling");
-
   RenderBuiltinOptions(TC, RawTriple, Args, CmdArgs);
 
   if (!Args.hasFlag(options::OPT_fassume_sane_operator_new,

diff  --git a/clang/test/Driver/clang_f_opts.c 
b/clang/test/Driver/clang_f_opts.c
index 9da9f5eac6324..6077058ad5b20 100644
--- a/clang/test/Driver/clang_f_opts.c
+++ b/clang/test/Driver/clang_f_opts.c
@@ -58,6 +58,19 @@
 // RUN: %clang -### -S -fprofile-sample-use=%S/Inputs/file.prof %s 2>&1 | 
FileCheck -check-prefix=CHECK-SAMPLE-PROFILE %s
 // CHECK-SAMPLE-PROFILE: "-fprofile-sample-use={{.*}}/file.prof"
 
+//
+// RUN: %clang -### -x cuda -nocudainc -nocudalib \
+// RUN:-c -fprofile-sample-use=%S/Inputs/file.prof %s 2>&1 \
+// RUN:  | FileCheck -check-prefix=CHECK-CUDA-SAMPLE-PROFILE %s
+// -fprofile-sample-use should not be passed 

[PATCH] D100598: [CUDA, FDO] Filter out profiling options from GPU-side compilations.

2021-04-16 Thread Artem Belevich via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeaa9ef075d9b: [CUDA, FDO] Filter out profiling options from 
GPU-side compilations. (authored by tra).

Changed prior to commit:
  https://reviews.llvm.org/D100598?vs=337896=338184#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100598

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/clang_f_opts.c

Index: clang/test/Driver/clang_f_opts.c
===
--- clang/test/Driver/clang_f_opts.c
+++ clang/test/Driver/clang_f_opts.c
@@ -58,6 +58,19 @@
 // RUN: %clang -### -S -fprofile-sample-use=%S/Inputs/file.prof %s 2>&1 | FileCheck -check-prefix=CHECK-SAMPLE-PROFILE %s
 // CHECK-SAMPLE-PROFILE: "-fprofile-sample-use={{.*}}/file.prof"
 
+//
+// RUN: %clang -### -x cuda -nocudainc -nocudalib \
+// RUN:-c -fprofile-sample-use=%S/Inputs/file.prof %s 2>&1 \
+// RUN:  | FileCheck -check-prefix=CHECK-CUDA-SAMPLE-PROFILE %s
+// -fprofile-sample-use should not be passed to the GPU compilation
+// CHECK-CUDA-SAMPLE-PROFILE: "-cc1"
+// CHECK-CUDA-SAMPLE-PROFILE-SAME: "-triple" "nvptx
+// CHECK-CUDA-SAMPLE-PROFILE-NOT: "-fprofile-sample-use={{.*}}/file.prof"
+// Host compilation should still have the option.
+// CHECK-CUDA-SAMPLE-PROFILE: "-cc1"
+// CHECK-CUDA-SAMPLE-PROFILE-SAME: "-fprofile-sample-use={{.*}}/file.prof"
+
+
 // RUN: %clang -### -S -fauto-profile=%S/Inputs/file.prof %s 2>&1 | FileCheck -check-prefix=CHECK-AUTO-PROFILE %s
 // CHECK-AUTO-PROFILE: "-fprofile-sample-use={{.*}}/file.prof"
 
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4159,7 +4159,9 @@
   // include as part of the module. All other jobs are expected to have exactly
   // one input.
   bool IsCuda = JA.isOffloading(Action::OFK_Cuda);
+  bool IsCudaDevice = JA.isDeviceOffloading(Action::OFK_Cuda);
   bool IsHIP = JA.isOffloading(Action::OFK_HIP);
+  bool IsHIPDevice = JA.isDeviceOffloading(Action::OFK_HIP);
   bool IsOpenMPDevice = JA.isDeviceOffloading(Action::OFK_OpenMP);
   bool IsHeaderModulePrecompile = isa(JA);
 
@@ -5003,8 +5005,7 @@
   // Prepare `-aux-target-cpu` and `-aux-target-feature` unless
   // `--gpu-use-aux-triple-only` is specified.
   if (!Args.getLastArg(options::OPT_gpu_use_aux_triple_only) &&
-  ((IsCuda && JA.isDeviceOffloading(Action::OFK_Cuda)) ||
-   (IsHIP && JA.isDeviceOffloading(Action::OFK_HIP {
+  (IsCudaDevice || IsHIPDevice)) {
 const ArgList  =
 C.getArgsForToolChain(nullptr, StringRef(), Action::OFK_None);
 std::string HostCPU =
@@ -5824,29 +5825,32 @@
 Args.MakeArgString(Twine("-fcf-protection=") + A->getValue()));
   }
 
-  // Forward -f options with positive and negative forms; we translate
-  // these by hand.
-  if (Arg *A = getLastProfileSampleUseArg(Args)) {
-auto *PGOArg = Args.getLastArg(
-options::OPT_fprofile_generate, options::OPT_fprofile_generate_EQ,
-options::OPT_fcs_profile_generate, options::OPT_fcs_profile_generate_EQ,
-options::OPT_fprofile_use, options::OPT_fprofile_use_EQ);
-if (PGOArg)
-  D.Diag(diag::err_drv_argument_not_allowed_with)
-  << "SampleUse with PGO options";
+  // Forward -f options with positive and negative forms; we translate these by
+  // hand.  Do not propagate PGO options to the GPU-side compilations as the
+  // profile info is for the host-side compilation only.
+  if (!(IsCudaDevice || IsHIPDevice)) {
+if (Arg *A = getLastProfileSampleUseArg(Args)) {
+  auto *PGOArg = Args.getLastArg(
+  options::OPT_fprofile_generate, options::OPT_fprofile_generate_EQ,
+  options::OPT_fcs_profile_generate,
+  options::OPT_fcs_profile_generate_EQ, options::OPT_fprofile_use,
+  options::OPT_fprofile_use_EQ);
+  if (PGOArg)
+D.Diag(diag::err_drv_argument_not_allowed_with)
+<< "SampleUse with PGO options";
+
+  StringRef fname = A->getValue();
+  if (!llvm::sys::fs::exists(fname))
+D.Diag(diag::err_drv_no_such_file) << fname;
+  else
+A->render(Args, CmdArgs);
+}
+Args.AddLastArg(CmdArgs, options::OPT_fprofile_remapping_file_EQ);
 
-StringRef fname = A->getValue();
-if (!llvm::sys::fs::exists(fname))
-  D.Diag(diag::err_drv_no_such_file) << fname;
-else
-  A->render(Args, CmdArgs);
+if (Args.hasFlag(options::OPT_fpseudo_probe_for_profiling,
+ options::OPT_fno_pseudo_probe_for_profiling, false))
+  CmdArgs.push_back("-fpseudo-probe-for-profiling");
   }
-  Args.AddLastArg(CmdArgs, options::OPT_fprofile_remapping_file_EQ);
-
-  if (Args.hasFlag(options::OPT_fpseudo_probe_for_profiling,
-   options::OPT_fno_pseudo_probe_for_profiling, 

[PATCH] D95976: [OpenMP] Simplify offloading parallel call codegen

2021-04-16 Thread Michael Kruse via Phabricator via cfe-commits
Meinersbur requested changes to this revision.
Meinersbur added inline comments.
This revision now requires changes to proceed.



Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:569-570
+  else
+ThreadLimit = Bld.CreateNUWSub(RT.getGPUNumThreads(CGF),
+   RT.getGPUWarpSize(CGF), "thread_limit");
+  assert(ThreadLimit != nullptr && "Expected non-null ThreadLimit");

getGPUNumThreads and getGPUWarpSize still have undefined call order.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95976

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


[PATCH] D99675: RFC [llvm][clang] Create new intrinsic llvm.arith.fence to control FP optimization at expression level

2021-04-16 Thread Melanie Blower via Phabricator via cfe-commits
mibintc added a comment.

In D99675#2695424 , @kpn wrote:

> What changes are needed for a backend, and what happens if they aren't done?

In the clang patch, I'm planning to add into TargetInfo a function like "does 
the target support __arithmetic_fence"?
In the llvm patch, the fallback implementation could be to merely ignore the 
call, and pass through the operand value. Is that adequate?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99675

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


[PATCH] D100673: [OPENMP]Fix PR49698: OpenMP declare mapper causes segmentation fault.

2021-04-16 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev created this revision.
ABataev added reviewers: jdoerfert, abhinavgaba, jyu2, mikerice.
Herald added subscribers: guansong, yaxunl.
ABataev requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added projects: clang, OpenMP.

The implicitly generated mappings for allocation/deallocation in mappers
runtime should be mapped as implicit, also no need to clear member_of
flag to avoid ref counter increment. Also, the ref counter should not be
incremented for the very first element that comes from the mapper
function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100673

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/declare_mapper_codegen.cpp
  openmp/libomptarget/src/omptarget.cpp
  
openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_array.cpp
  
openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_array_subscript.cpp
  
openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_ptr_subscript.cpp
  openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_var.cpp

Index: openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_var.cpp
===
--- /dev/null
+++ openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_var.cpp
@@ -0,0 +1,62 @@
+// RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-nvptx64-nvidia-cuda
+
+#include 
+#include 
+
+typedef struct {
+  int a;
+  double *b;
+} C1;
+#pragma omp declare mapper(C1 s) map(to : s.a) map(from : s.b [0:2])
+
+typedef struct {
+  int a;
+  double *b;
+  C1 c;
+} C;
+#pragma omp declare mapper(C s) map(to : s.a, s.c) map(from : s.b [0:2])
+
+typedef struct {
+  int e;
+  C f;
+  int h;
+} D;
+
+int main() {
+  constexpr int N = 10;
+  D s;
+  s.e = 111;
+  s.f.a = 222;
+  s.f.c.a = 777;
+  double x[2];
+  double x1[2];
+  x[1] = 20;
+  s.f.b = [0];
+  s.f.c.b = [0];
+  s.h = N;
+
+  printf("%d %d %d %4.5f %d\n", s.e, s.f.a, s.f.c.a, s.f.b[1],
+ s.f.b == [0] ? 1 : 0);
+  // CHECK: 111 222 777 20.0 1
+
+  __intptr_t p = reinterpret_cast<__intptr_t>([0]);
+
+#pragma omp target map(tofrom : s) firstprivate(p)
+  {
+printf("%d %d %d\n", s.f.a, s.f.c.a,
+   s.f.b == reinterpret_cast(p) ? 1 : 0);
+// CHECK: 222 777 0
+s.e = 333;
+s.f.a = 444;
+s.f.c.a = 555;
+s.f.b[1] = 40;
+  }
+
+  printf("%d %d %d %4.5f %d\n", s.e, s.f.a, s.f.c.a, s.f.b[1],
+ s.f.b == [0] ? 1 : 0);
+  // CHECK: 333 222 777 40.0 1
+}
Index: openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_ptr_subscript.cpp
===
--- /dev/null
+++ openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_ptr_subscript.cpp
@@ -0,0 +1,62 @@
+// RUN: %libomptarget-compilexx-run-and-check-aarch64-unknown-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-powerpc64le-ibm-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-x86_64-pc-linux-gnu
+// RUN: %libomptarget-compilexx-run-and-check-nvptx64-nvidia-cuda
+
+#include 
+#include 
+
+typedef struct {
+  int a;
+  double *b;
+} C1;
+#pragma omp declare mapper(C1 s) map(to : s.a) map(from : s.b [0:2])
+
+typedef struct {
+  int a;
+  double *b;
+  C1 c;
+} C;
+#pragma omp declare mapper(C s) map(to : s.a, s.c) map(from : s.b [0:2])
+
+typedef struct {
+  int e;
+  C f;
+  int h;
+} D;
+
+int main() {
+  constexpr int N = 10;
+  D s;
+  s.e = 111;
+  s.f.a = 222;
+  s.f.c.a = 777;
+  double x[2];
+  double x1[2];
+  x[1] = 20;
+  s.f.b = [0];
+  s.f.c.b = [0];
+  s.h = N;
+
+  D *sp = 
+
+  printf("%d %d %d %4.5f %d\n", sp[0].e, sp[0].f.a, sp[0].f.c.a, sp[0].f.b[1],
+ sp[0].f.b == [0] ? 1 : 0);
+  // CHECK: 111 222 777 20.0 1
+
+  __intptr_t p = reinterpret_cast<__intptr_t>([0]);
+#pragma omp target map(tofrom : sp[0]) firstprivate(p)
+  {
+printf("%d %d %d\n", sp[0].f.a, sp[0].f.c.a,
+   sp[0].f.b == reinterpret_cast(p) ? 1 : 0);
+// CHECK: 222 777 0
+sp[0].e = 333;
+sp[0].f.a = 444;
+sp[0].f.c.a = 555;
+sp[0].f.b[1] = 40;
+  }
+  printf("%d %d %d %4.5f %d\n", sp[0].e, sp[0].f.a, sp[0].f.c.a, sp[0].f.b[1],
+ sp[0].f.b == [0] ? 1 : 0);
+  // CHECK: 333 222 777 40.0 1
+}
Index: openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_array_subscript.cpp
===
--- /dev/null
+++ openmp/libomptarget/test/mapping/declare_mapper_nested_default_mappers_array_subscript.cpp
@@ -0,0 +1,60 @@
+// RUN: 

[PATCH] D100671: [ADT] Factor out in_place_t and expose in Optional ctor

2021-04-16 Thread Scott Linder via Phabricator via cfe-commits
scott.linder created this revision.
Herald added a subscriber: dexonsmith.
scott.linder requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100671

Files:
  clang/include/clang/Basic/DirectoryEntry.h
  llvm/include/llvm/ADT/Optional.h
  llvm/include/llvm/ADT/STLShims.h
  llvm/unittests/ADT/OptionalTest.cpp

Index: llvm/unittests/ADT/OptionalTest.cpp
===
--- llvm/unittests/ADT/OptionalTest.cpp
+++ llvm/unittests/ADT/OptionalTest.cpp
@@ -195,6 +195,14 @@
   EXPECT_EQ(0u, NonDefaultConstructible::Destructions);
 }
 
+TEST(OptionalTest, InPlaceConstructionNonDefaultConstructibleTest) {
+  NonDefaultConstructible::ResetCounts();
+  { Optional A{in_place_t{}, 1}; }
+  EXPECT_EQ(0u, NonDefaultConstructible::CopyConstructions);
+  EXPECT_EQ(0u, NonDefaultConstructible::CopyAssignments);
+  EXPECT_EQ(1u, NonDefaultConstructible::Destructions);
+}
+
 TEST(OptionalTest, GetValueOr) {
   Optional A;
   EXPECT_EQ(42, A.getValueOr(42));
@@ -214,6 +222,11 @@
   MultiArgConstructor =(const MultiArgConstructor &) = delete;
   MultiArgConstructor =(MultiArgConstructor &&) = delete;
 
+  friend bool operator==(const MultiArgConstructor ,
+ const MultiArgConstructor ) {
+return LHS.x == RHS.x && LHS.y == RHS.y;
+  }
+
   static unsigned Destructions;
   ~MultiArgConstructor() {
 ++Destructions;
@@ -244,6 +257,34 @@
   EXPECT_EQ(1u, MultiArgConstructor::Destructions);
 }
 
+TEST(OptionalTest, InPlaceConstructionMultiArgConstructorTest) {
+  MultiArgConstructor::ResetCounts();
+  {
+Optional A{in_place_t{}, 1, 2};
+EXPECT_TRUE(A.hasValue());
+EXPECT_EQ(1, A->x);
+EXPECT_EQ(2, A->y);
+Optional B{in_place_t{}, 5, false};
+EXPECT_TRUE(B.hasValue());
+EXPECT_EQ(5, B->x);
+EXPECT_EQ(-5, B->y);
+EXPECT_EQ(0u, MultiArgConstructor::Destructions);
+  }
+  EXPECT_EQ(2u, MultiArgConstructor::Destructions);
+}
+
+TEST(OptionalTest, InPlaceConstructionAndEmplaceEquivalentTest) {
+  MultiArgConstructor::ResetCounts();
+  {
+Optional A{in_place_t{}, 1, 2};
+Optional B;
+B.emplace(1, 2);
+EXPECT_EQ(0u, MultiArgConstructor::Destructions);
+ASSERT_EQ(A, B);
+  }
+  EXPECT_EQ(2u, MultiArgConstructor::Destructions);
+}
+
 struct MoveOnly {
   static unsigned MoveConstructions;
   static unsigned Destructions;
@@ -391,6 +432,15 @@
   EXPECT_EQ(0u, Immovable::Destructions);
 }
 
+TEST(OptionalTest, ImmovableInPlaceConstruction) {
+  Immovable::ResetCounts();
+  Optional A{in_place_t{}, 4};
+  EXPECT_TRUE((bool)A);
+  EXPECT_EQ(4, A->val);
+  EXPECT_EQ(1u, Immovable::Constructions);
+  EXPECT_EQ(0u, Immovable::Destructions);
+}
+
 // Craft a class which is_trivially_copyable, but not
 // is_trivially_copy_constructible.
 struct NonTCopy {
Index: llvm/include/llvm/ADT/STLShims.h
===
--- llvm/include/llvm/ADT/STLShims.h
+++ llvm/include/llvm/ADT/STLShims.h
@@ -27,6 +27,18 @@
 // Shims for C++17
 //===--===//
 
+struct SHIM(in_place_t) {
+  explicit in_place_t() = default;
+};
+
+template  struct SHIM(in_place_type_t) {
+  explicit in_place_type_t() = default;
+};
+
+template  struct SHIM(in_place_index_t) {
+  explicit in_place_index_t() = default;
+};
+
 template 
 struct SHIM(negation) : std::integral_constant {};
 
Index: llvm/include/llvm/ADT/Optional.h
===
--- llvm/include/llvm/ADT/Optional.h
+++ llvm/include/llvm/ADT/Optional.h
@@ -17,6 +17,7 @@
 
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/None.h"
+#include "llvm/ADT/STLShims.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/type_traits.h"
 #include 
@@ -30,8 +31,6 @@
 
 namespace optional_detail {
 
-struct in_place_t {};
-
 /// Storage for any type.
 //
 // The specialization condition intentionally uses
@@ -245,13 +244,16 @@
   constexpr Optional() {}
   constexpr Optional(NoneType) {}
 
-  constexpr Optional(const T ) : Storage(optional_detail::in_place_t{}, y) {}
+  constexpr Optional(const T ) : Storage(in_place_t{}, y) {}
   constexpr Optional(const Optional ) = default;
 
-  constexpr Optional(T &)
-  : Storage(optional_detail::in_place_t{}, std::move(y)) {}
+  constexpr Optional(T &) : Storage(in_place_t{}, std::move(y)) {}
   constexpr Optional(Optional &) = default;
 
+  template 
+  constexpr Optional(in_place_t, ArgTypes &&...Args)
+  : Storage(in_place_t{}, std::forward(Args)...) {}
+
   Optional =(T &) {
 Storage = std::move(y);
 return *this;
Index: clang/include/clang/Basic/DirectoryEntry.h
===
--- clang/include/clang/Basic/DirectoryEntry.h
+++ clang/include/clang/Basic/DirectoryEntry.h
@@ -120,8 

[PATCH] D99675: RFC [llvm][clang] Create new intrinsic llvm.arith.fence to control FP optimization at expression level

2021-04-16 Thread Kevin P. Neal via Phabricator via cfe-commits
kpn added a comment.

What changes are needed for a backend, and what happens if they aren't done?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99675

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


[PATCH] D100667: [clang] Fix assert() crash when checking undeduced arg alignment

2021-04-16 Thread Adam Czachorowski via Phabricator via cfe-commits
adamcz created this revision.
Herald added a subscriber: kristof.beyls.
adamcz requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

There already was a check for undeduced and incomplete types, but it
failed to trigger when outer type (SubstTemplateTypeParm in test) looked
fine, but inner type was not.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100667

Files:
  clang/lib/Sema/SemaChecking.cpp
  clang/test/SemaCXX/cxx17-undeduced-alignment.cpp


Index: clang/test/SemaCXX/cxx17-undeduced-alignment.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/cxx17-undeduced-alignment.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -std=c++17 -verify %s
+//
+// Verifies that clang no longer crashes on undeduced, sugared types.
+
+template  void foo(T );
+template 
+void bar(T t) {
+  foo(t);
+}
+
+template 
+struct S { // expected-note {{candidate}}
+  S(T t);  // expected-note {{candidate}}
+  ~S();
+};
+template  S(T t) -> S;
+
+void baz() {
+  // S(123) is undeduced, but when passed to foo() via bar() it is wrapped in
+  // SubstTemplateTypeParm, for which isUndeduced() is false.
+  bar(S(123)); // expected-error {{no matching conversion}}
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -4540,8 +4540,15 @@
 
   // Find expected alignment, and the actual alignment of the passed object.
   // getTypeAlignInChars requires complete types
-  if (ParamTy->isIncompleteType() || ArgTy->isIncompleteType() ||
-  ParamTy->isUndeducedType() || ArgTy->isUndeducedType())
+  auto CheckTypeOK = [](QualType Ty) {
+if (Ty->isIncompleteType() || Ty->isUndeducedType())
+  return false;
+if (auto *DesugaredTy = Ty->getUnqualifiedDesugaredType())
+  if (DesugaredTy->isIncompleteType() || DesugaredTy->isUndeducedType())
+return false;
+return true;
+  };
+  if (!CheckTypeOK(ParamTy) || !CheckTypeOK(ArgTy))
 return;
 
   CharUnits ParamAlign = Context.getTypeAlignInChars(ParamTy);


Index: clang/test/SemaCXX/cxx17-undeduced-alignment.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/cxx17-undeduced-alignment.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -std=c++17 -verify %s
+//
+// Verifies that clang no longer crashes on undeduced, sugared types.
+
+template  void foo(T );
+template 
+void bar(T t) {
+  foo(t);
+}
+
+template 
+struct S { // expected-note {{candidate}}
+  S(T t);  // expected-note {{candidate}}
+  ~S();
+};
+template  S(T t) -> S;
+
+void baz() {
+  // S(123) is undeduced, but when passed to foo() via bar() it is wrapped in
+  // SubstTemplateTypeParm, for which isUndeduced() is false.
+  bar(S(123)); // expected-error {{no matching conversion}}
+}
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -4540,8 +4540,15 @@
 
   // Find expected alignment, and the actual alignment of the passed object.
   // getTypeAlignInChars requires complete types
-  if (ParamTy->isIncompleteType() || ArgTy->isIncompleteType() ||
-  ParamTy->isUndeducedType() || ArgTy->isUndeducedType())
+  auto CheckTypeOK = [](QualType Ty) {
+if (Ty->isIncompleteType() || Ty->isUndeducedType())
+  return false;
+if (auto *DesugaredTy = Ty->getUnqualifiedDesugaredType())
+  if (DesugaredTy->isIncompleteType() || DesugaredTy->isUndeducedType())
+return false;
+return true;
+  };
+  if (!CheckTypeOK(ParamTy) || !CheckTypeOK(ArgTy))
 return;
 
   CharUnits ParamAlign = Context.getTypeAlignInChars(ParamTy);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D100609: [Offload][OpenMP][CUDA] Allow fembed-bitcode for device offload

2021-04-16 Thread Artem Belevich via Phabricator via cfe-commits
tra requested changes to this revision.
tra added inline comments.
This revision now requires changes to proceed.



Comment at: clang/test/Driver/embed-bitcode-nvptx.cu:1
+// RUN: %clang -Xclang -triple -Xclang nvptx64 -S -Xclang -target-feature 
-Xclang +ptx70 -fembed-bitcode=all --cuda-device-only -nocudalib -nocudainc %s 
-o - | FileCheck %s
+// REQUIRES: nvptx-registered-target

jdoerfert wrote:
> tra wrote:
> > This command line looks extremely odd to me.
> > If you are compiling with `--cuda-device-only`, then clang should've 
> > already set the right triple and the features.
> > 
> > Could you tell me more about what is the intent of the compilation and why 
> > you use this particular set of options?
> > I.e. why not just do `clang -x cuda --offload-arch=sm_70 --cuda-device-only 
> > -nocudalib -nocudainc`.
> > 
> > Could you tell me more about what is the intent of the compilation and why 
> > you use this particular set of options?
> 
> because I never compiled cuda really ;)
> 
> I'll go with your options.
Something still does not add up. 

AFAICT, the real problem is that that we're not adding `-target-cpu`, but 
rather that `-fembed-bitcode=all` splits `-S` compilation into two phases -- 
source-to-bitcode (this part gets all the right command line options and 
compiles fine) and `IR -> PTX` compilation which does end up only with the 
subset of the options and ends up failing because the intrinsics are not 
enabled.

I think what we want to do in this case is to prevent splitting GPU-side 
compilation. Adding a '-target-gpu' to the `IR->PTX` subcompilation may make 
things work in this case, but it does not really fix the root cause. E.g. we 
should also pass through the features set by the driver and, possibly, other 
options to keep both source->IR and IR->PTX compilations in sync.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100609

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


[PATCH] D100118: [clang] RFC Support new builtin __arithmetic_fence to control floating point optimization, and new clang option fprotect-parens

2021-04-16 Thread Kevin P. Neal via Phabricator via cfe-commits
kpn added a comment.

In D100118#2695365 , @kpn wrote:

> I thought that adding a new fence required changing every optimization pass 
> in LLVM. That's why the constrained intrinsics were implemented they way they 
> are where no fence is needed.
>
> Aren't you going to have miscompiles using this new fence until all that 
> optimization work is done? Or am I wrong? @andrew.w.kaylor?

Perhaps there is no problem. I'm looking at D99675 
 now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100118

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


[PATCH] D100118: [clang] RFC Support new builtin __arithmetic_fence to control floating point optimization, and new clang option fprotect-parens

2021-04-16 Thread Kevin P. Neal via Phabricator via cfe-commits
kpn added a comment.

I thought that adding a new fence required changing every optimization pass in 
LLVM. That's why the constrained intrinsics were implemented they way they are 
where no fence is needed.

Aren't you going to have miscompiles using this new fence until all that 
optimization work is done? Or am I wrong? @andrew.w.kaylor?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100118

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


[clang] 59437cb - [M68k] Fix empty builtin va_list kind

2021-04-16 Thread Min-Yih Hsu via cfe-commits

Author: Min-Yih Hsu
Date: 2021-04-16T11:09:22-07:00
New Revision: 59437cb7d7c30054f0e77b2369c0aeffed3ccb14

URL: 
https://github.com/llvm/llvm-project/commit/59437cb7d7c30054f0e77b2369c0aeffed3ccb14
DIFF: 
https://github.com/llvm/llvm-project/commit/59437cb7d7c30054f0e77b2369c0aeffed3ccb14.diff

LOG: [M68k] Fix empty builtin va_list kind

Clang _requires_ every target to provide a va_list kind so we shouldn't
put a llvm_unreachable there. Using `VoidPtrBuiltinVaList` because m68k
doesn't have any special ABI for variadic args.

Added: 


Modified: 
clang/lib/Basic/Targets/M68k.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets/M68k.cpp 
b/clang/lib/Basic/Targets/M68k.cpp
index e10fd77d2590a..8e8a69f75c8b0 100644
--- a/clang/lib/Basic/Targets/M68k.cpp
+++ b/clang/lib/Basic/Targets/M68k.cpp
@@ -159,9 +159,8 @@ const char *M68kTargetInfo::getClobbers() const {
   return "";
 }
 
-M68kTargetInfo::BuiltinVaListKind M68kTargetInfo::getBuiltinVaListKind() const 
{
-  // FIXME: implement
-  llvm_unreachable("Not implemented yet");
+TargetInfo::BuiltinVaListKind M68kTargetInfo::getBuiltinVaListKind() const {
+  return TargetInfo::VoidPtrBuiltinVaList;
 }
 
 } // namespace targets



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


[PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

2021-04-16 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

-Wunused-but-set-variable is firing on `x` at [1]

[1] 
https://source.chromium.org/chromium/chromium/src/+/master:third_party/abseil-cpp/absl/synchronization/mutex.h;drc=07cb7b184515ad207d30f00d0b00b8ce96d0a750;l=947

  ../../third_party/abseil-cpp/absl/synchronization/mutex.h:947:6: error: 
variable 'x' set but not used [-Werror,-Wunused-but-set-variable]
T *x = static_cast(c->arg_);


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100581

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


[PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

2021-04-16 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added a comment.

Running this over Chromium, I'm getting

  $ cat /tmp/a.cc
  struct A {
int i;
A(int i): i(i) {}
  };
  
  $ ./build/rel/bin/clang++ -fsyntax-only /tmp/a.cc -Wunused-but-set-parameter
  /tmp/a.cc:3:9: warning: parameter 'i' set but not used 
[-Wunused-but-set-parameter]
A(int i): i(i) {}
  ^
  1 warning generated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100581

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


[PATCH] D100609: [Offload][OpenMP][CUDA] Allow fembed-bitcode for device offload

2021-04-16 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4442-4446
+  std::string CPU = getCPUName(Args, Triple, /*FromAs*/ false);
+  if (!CPU.empty()) {
+CmdArgs.push_back("-target-cpu");
+CmdArgs.push_back(Args.MakeArgString(CPU));
+  }

tra wrote:
> This duplicates the same code a bit further down in the function. I think you 
> should just set `-target-cpu` for everyone before diving into 
> `if(embedBitcodeInObject)`.
Fair. I'll update it.



Comment at: clang/test/Driver/embed-bitcode-nvptx.cu:1
+// RUN: %clang -Xclang -triple -Xclang nvptx64 -S -Xclang -target-feature 
-Xclang +ptx70 -fembed-bitcode=all --cuda-device-only -nocudalib -nocudainc %s 
-o - | FileCheck %s
+// REQUIRES: nvptx-registered-target

tra wrote:
> This command line looks extremely odd to me.
> If you are compiling with `--cuda-device-only`, then clang should've already 
> set the right triple and the features.
> 
> Could you tell me more about what is the intent of the compilation and why 
> you use this particular set of options?
> I.e. why not just do `clang -x cuda --offload-arch=sm_70 --cuda-device-only 
> -nocudalib -nocudainc`.
> 
> Could you tell me more about what is the intent of the compilation and why 
> you use this particular set of options?

because I never compiled cuda really ;)

I'll go with your options.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100609

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


[PATCH] D100514: [OpenMP] Added codegen for masked directive

2021-04-16 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert added a comment.

In D100514#2695271 , @cchen wrote:

> In D100514#2693600 , @jdoerfert 
> wrote:
>
>> Any reason we should not unconditionally use the OMPIRBuilder impl? (btw, 
>> many thanks for providing one!)
>> We have an OMPIRBuilder always around in clang's codegen, so there is little 
>> reason not to use it if it is feature complete.
>
> I'm fine using OMPIRBuilder as default. I was not set it as default since 
> most of the clause/directive are still using Clang codegen as default (ex: 
> `master`, `critical`, and `for` are now use Clang codegen as default).

Initially we did not have an OMPIRBuilder object unconditionally, now we have. 
Let's move over everything that is ready. So master and critical should be good 
to go as well I suppose.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100514

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


[PATCH] D100514: [OpenMP] Added codegen for masked directive

2021-04-16 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen added a comment.

In D100514#2693601 , @jdoerfert wrote:

> Also, don't forget to mark it as done in 
> https://clang.llvm.org/docs/OpenMPSupport.html :)

I'll mark it as done after combined constructs are also done. Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100514

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


[PATCH] D100514: [OpenMP] Added codegen for masked directive

2021-04-16 Thread Chi Chun Chen via Phabricator via cfe-commits
cchen added a comment.

In D100514#2693600 , @jdoerfert wrote:

> Any reason we should not unconditionally use the OMPIRBuilder impl? (btw, 
> many thanks for providing one!)
> We have an OMPIRBuilder always around in clang's codegen, so there is little 
> reason not to use it if it is feature complete.

I'm fine using OMPIRBuilder as default. I was not set it as default since most 
of the clause/directive are still using Clang codegen as default (ex: `master`, 
`critical`, and `for` are now use Clang codegen as default).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100514

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


[PATCH] D100630: [Debug-Info][DBX] DW_TAG_rvalue_reference_type should not be generated when dwarf version is smaller than 4

2021-04-16 Thread Jinsong Ji via Phabricator via cfe-commits
jsji added a comment.

In D100630#2694681 , @probinson wrote:

> If DBX is going to be really pedantic about not recognizing tags or 
> attributes that don't align with the DWARF version, maybe we're better off 
> with really supporting `-gstrict-dwarf` and just have DBX tuning imply that.

Thanks! Yes, that is a good idea. By adding `-gstrict-dwarf`, all these dwarf 
version check work might be beneficial to others, not just for *dbx* .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100630

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


[PATCH] D100619: [ASTReader] Only mark module out of date if not already compiled

2021-04-16 Thread Argyrios Kyrtzidis via Phabricator via cfe-commits
akyrtzi added inline comments.



Comment at: clang/test/Modules/Inputs/error/error.h:1
+#pragma mark mark
+

Is this pragma relevant for the test?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100619

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


[PATCH] D100609: [Offload][OpenMP][CUDA] Allow fembed-bitcode for device offload

2021-04-16 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4442-4446
+  std::string CPU = getCPUName(Args, Triple, /*FromAs*/ false);
+  if (!CPU.empty()) {
+CmdArgs.push_back("-target-cpu");
+CmdArgs.push_back(Args.MakeArgString(CPU));
+  }

This duplicates the same code a bit further down in the function. I think you 
should just set `-target-cpu` for everyone before diving into 
`if(embedBitcodeInObject)`.



Comment at: clang/test/Driver/embed-bitcode-nvptx.cu:1
+// RUN: %clang -Xclang -triple -Xclang nvptx64 -S -Xclang -target-feature 
-Xclang +ptx70 -fembed-bitcode=all --cuda-device-only -nocudalib -nocudainc %s 
-o - | FileCheck %s
+// REQUIRES: nvptx-registered-target

This command line looks extremely odd to me.
If you are compiling with `--cuda-device-only`, then clang should've already 
set the right triple and the features.

Could you tell me more about what is the intent of the compilation and why you 
use this particular set of options?
I.e. why not just do `clang -x cuda --offload-arch=sm_70 --cuda-device-only 
-nocudalib -nocudainc`.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100609

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


[PATCH] D70094: [clang-tidy] new altera ID dependent backward branch check

2021-04-16 Thread Frank Derry Wanye via Phabricator via cfe-commits
ffrankies updated this revision to Diff 338160.
ffrankies marked 3 inline comments as done.
ffrankies added a comment.

Removed `*- C++ -*` from IdDependentBackwardBranchCheck.cpp file-level comment.


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

https://reviews.llvm.org/D70094

Files:
  clang-tools-extra/clang-tidy/altera/AlteraTidyModule.cpp
  clang-tools-extra/clang-tidy/altera/CMakeLists.txt
  clang-tools-extra/clang-tidy/altera/IdDependentBackwardBranchCheck.cpp
  clang-tools-extra/clang-tidy/altera/IdDependentBackwardBranchCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  
clang-tools-extra/docs/clang-tidy/checks/altera-id-dependent-backward-branch.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  
clang-tools-extra/test/clang-tidy/checkers/altera-id-dependent-backward-branch.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/altera-id-dependent-backward-branch.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/altera-id-dependent-backward-branch.cpp
@@ -0,0 +1,86 @@
+// RUN: %check_clang_tidy %s altera-id-dependent-backward-branch %t -- -header-filter=.* "--" -cl-std=CL1.2 -c --include opencl-c.h
+
+typedef struct ExampleStruct {
+  int IDDepField;
+} ExampleStruct;
+
+void error() {
+  //  Conditional Expressions 
+  int accumulator = 0;
+  for (int i = 0; i < get_local_id(0); i++) {
+// CHECK-NOTES: :[[@LINE-1]]:19: warning: backward branch (for loop) is ID-dependent due to ID function call and may cause performance degradation [altera-id-dependent-backward-branch]
+accumulator++;
+  }
+
+  int j = 0;
+  while (j < get_local_id(0)) {
+// CHECK-NOTES: :[[@LINE-1]]:10: warning: backward branch (while loop) is ID-dependent due to ID function call and may cause performance degradation [altera-id-dependent-backward-branch]
+accumulator++;
+  }
+
+  do {
+accumulator++;
+  } while (j < get_local_id(0));
+  // CHECK-NOTES: :[[@LINE-1]]:12: warning: backward branch (do loop) is ID-dependent due to ID function call and may cause performance degradation [altera-id-dependent-backward-branch]
+
+  //  Assignments 
+  int ThreadID = get_local_id(0);
+
+  while (j < ThreadID) {
+// CHECK-NOTES: :[[@LINE-3]]:3: note: assignment of ID-dependent variable ThreadID
+// CHECK-NOTES: :[[@LINE-2]]:10: warning: backward branch (while loop) is ID-dependent due to variable reference to 'ThreadID' and may cause performance degradation [altera-id-dependent-backward-branch]
+accumulator++;
+  }
+
+  ExampleStruct Example;
+  Example.IDDepField = get_local_id(0);
+
+  //  Inferred Assignments 
+  int ThreadID2 = ThreadID * get_local_size(0);
+
+  int ThreadID3 = Example.IDDepField; // OK: not used in any loops
+
+  ExampleStruct UnusedStruct = {
+  ThreadID * 2 // OK: not used in any loops
+  };
+
+  for (int i = 0; i < ThreadID2; i++) {
+// CHECK-NOTES: :[[@LINE-9]]:3: note: inferred assignment of ID-dependent value from ID-dependent variable ThreadID
+// CHECK-NOTES: :[[@LINE-2]]:19: warning: backward branch (for loop) is ID-dependent due to variable reference to 'ThreadID2' and may cause performance degradation [altera-id-dependent-backward-branch]
+accumulator++;
+  }
+
+  do {
+accumulator++;
+  } while (j < ThreadID);
+  // CHECK-NOTES: :[[@LINE-29]]:3: note: assignment of ID-dependent variable ThreadID
+  // CHECK-NOTES: :[[@LINE-2]]:12: warning: backward branch (do loop) is ID-dependent due to variable reference to 'ThreadID' and may cause performance degradation [altera-id-dependent-backward-branch]
+
+  for (int i = 0; i < Example.IDDepField; i++) {
+// CHECK-NOTES: :[[@LINE-24]]:3: note: assignment of ID-dependent field IDDepField
+// CHECK-NOTES: :[[@LINE-2]]:19: warning: backward branch (for loop) is ID-dependent due to member reference to 'IDDepField' and may cause performance degradation [altera-id-dependent-backward-branch]
+accumulator++;
+  }
+
+  while (j < Example.IDDepField) {
+// CHECK-NOTES: :[[@LINE-30]]:3: note: assignment of ID-dependent field IDDepField
+// CHECK-NOTES: :[[@LINE-2]]:10: warning: backward branch (while loop) is ID-dependent due to member reference to 'IDDepField' and may cause performance degradation [altera-id-dependent-backward-branch]
+accumulator++;
+  }
+
+  do {
+accumulator++;
+  } while (j < Example.IDDepField);
+  // CHECK-NOTES: :[[@LINE-38]]:3: note: assignment of ID-dependent field IDDepField
+  // CHECK-NOTES: :[[@LINE-2]]:12: warning: backward branch (do loop) is ID-dependent due to member reference to 'IDDepField' and may cause performance degradation [altera-id-dependent-backward-branch]
+}
+
+void success() {
+  int accumulator = 0;
+
+  for (int i = 0; i < 1000; i++) {
+if (i < get_local_id(0)) {
+  accumulator++;
+}
+  }
+}
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst

[PATCH] D99158: [RISCV][WIP] Implement intrinsics for P extension

2021-04-16 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/include/clang/Basic/Builtins.def:41
 //  E -> ext_vector, followed by the number of elements and the base type.
+//  e -> Register sized Vector, followd by the base type and
+//   its width is the same as the register size.

followd -> followed


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99158

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


[PATCH] D99158: [RISCV][WIP] Implement intrinsics for P extension

2021-04-16 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

Also can you please explain the vector codegen plan at a high level? Do you 
intend to support auto vectorization or just using vector_size in C?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99158

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


[PATCH] D99158: [RISCV][WIP] Implement intrinsics for P extension

2021-04-16 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/test/CodeGen/RISCV/rvp/intrinsics-rv32p.ll:25
+  %1 = bitcast i32 %b.coerce to <4 x i8>
+  %2 = tail call <4 x i8> @llvm.riscv.add8.v4i8(<4 x i8> %0, <4 x i8> %1)
+  %3 = bitcast <4 x i8> %2 to i32

I'm still not clear why we need to have two different ways to do the same 
operation. Why isn't the C interface all scalar types or all vector types? How 
do users choose which interface to use?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99158

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


[PATCH] D100617: [RISCV][Clang] Drop the assembly tests for RVV intrinsics.

2021-04-16 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100617

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


[PATCH] D99936: [clang][parser] Unify rejecting (non) decl stmt with gnu attributes

2021-04-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

In D99936#2694178 , @tbaeder wrote:

> Hey Aaron, it's been a while. Do you have a suggestion on how to proceed if 
> @rsmith has no opinion on it?

I think the behavior in the patch is okay as-is, so LGTM, thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99936

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


[PATCH] D100391: [RISCV][Clang] Add RVV miscellaneous intrinsic functions.

2021-04-16 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100391

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


[PATCH] D99861: [Clang] Record tokens in attribute arguments for user-defined C++/C2x attributes

2021-04-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D99861#2694605 , @urnathan wrote:

> See also https://bugs.llvm.org/show_bug.cgi?id=46446.  when I first fell into 
> this issue, I did think it was trying to save the token stream as this patch 
> is doing.  Neat I thought :)  although I'm a clang weenie, saving the tokens 
> is putting this into deferred-parse territory, which makes me nervous.

FWIW, I've been stewing on the deferred parse issues with the approach from 
this patch because they make me nervous as well. Because `[[]]` attributes can 
have arbitrary token soup for their arguments and that includes arbitrary 
expressions, I worry that just giving the plugin author a bunch of tokens and 
saying "you deal with it" will only work for very trivial arguments.

> Wouldn't it be better for the ParsedAttrInfo objects to determine whether and 
> how to parse their arguments.  They could do so immediately, or save tokens, 
> or whatever on a per-attribute per-argument basis.  Isn't that more flexible? 
>  Add some ParsedAttrInfo defaults for the default cxx11, gnu & clang flavours 
> of attributes?

I think this would be an improved approach over just replaying the tokens for 
the plugin to handle. I would hope that we'd be able to design something that 
handles the easy cases of passing a string literal, an integer value, an 
enumerated list of named values, etc so that plugin authors don't have to 
reinvent the wheel for basic needs.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99861

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


[PATCH] D100473: [clang] Implement CompilerInvocation copy assignment

2021-04-16 Thread Michael Spencer via Phabricator via cfe-commits
Bigcheese accepted this revision.
Bigcheese added a comment.
This revision is now accepted and ready to land.

I think this is fine given that we already have a copy constructor with deep 
copy semantics.

lgtm


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100473

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


[PATCH] D100455: [clang] Rename CompilerInvocationBase to RefBase, split out ValueBase

2021-04-16 Thread Michael Spencer via Phabricator via cfe-commits
Bigcheese accepted this revision.
Bigcheese added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100455

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


[PATCH] D100653: [clang][cli] NFC: Move conditional LangOptions parsing/generation

2021-04-16 Thread Michael Spencer via Phabricator via cfe-commits
Bigcheese accepted this revision.
Bigcheese added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100653

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


[PATCH] D100533: [clang][deps] Remove the -full-command-line flag

2021-04-16 Thread Michael Spencer via Phabricator via cfe-commits
Bigcheese accepted this revision.
Bigcheese added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100533

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


[PATCH] D100654: [SystemZ][z/OS] Set more text files as text

2021-04-16 Thread Abhina Sree via Phabricator via cfe-commits
abhina.sreeskantharajan created this revision.
Herald added subscribers: dexonsmith, arphaman.
abhina.sreeskantharajan requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This patch corrects more instances of text files being opened as text.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100654

Files:
  clang/tools/driver/cc1gen_reproducer_main.cpp
  clang/tools/libclang/CIndexer.cpp
  llvm/include/llvm/Support/GraphWriter.h


Index: llvm/include/llvm/Support/GraphWriter.h
===
--- llvm/include/llvm/Support/GraphWriter.h
+++ llvm/include/llvm/Support/GraphWriter.h
@@ -331,7 +331,8 @@
   if (Filename.empty()) {
 Filename = createGraphFilename(Name.str(), FD);
   } else {
-std::error_code EC = sys::fs::openFileForWrite(Filename, FD);
+std::error_code EC = sys::fs::openFileForWrite(
+Filename, FD, sys::fs::CD_CreateAlways, sys::fs::OF_Text);
 
 // Writing over an existing file is not considered an error.
 if (EC == std::errc::file_exists) {
Index: clang/tools/libclang/CIndexer.cpp
===
--- clang/tools/libclang/CIndexer.cpp
+++ clang/tools/libclang/CIndexer.cpp
@@ -163,7 +163,8 @@
   TempPath = Path;
   llvm::sys::path::append(TempPath, "libclang-");
   int FD;
-  if (llvm::sys::fs::createUniqueFile(TempPath, FD, TempPath))
+  if (llvm::sys::fs::createUniqueFile(TempPath, FD, TempPath,
+  llvm::sys::fs::OF_Text))
 return;
   File = std::string(TempPath.begin(), TempPath.end());
   llvm::raw_fd_ostream OS(FD, /*ShouldClose=*/true);
Index: clang/tools/driver/cc1gen_reproducer_main.cpp
===
--- clang/tools/driver/cc1gen_reproducer_main.cpp
+++ clang/tools/driver/cc1gen_reproducer_main.cpp
@@ -162,7 +162,7 @@
   // Parse the invocation descriptor.
   StringRef Input = Argv[0];
   llvm::ErrorOr> Buffer =
-  llvm::MemoryBuffer::getFile(Input);
+  llvm::MemoryBuffer::getFile(Input, /*IsText=*/true);
   if (!Buffer) {
 llvm::errs() << "error: failed to read " << Input << ": "
  << Buffer.getError().message() << "\n";


Index: llvm/include/llvm/Support/GraphWriter.h
===
--- llvm/include/llvm/Support/GraphWriter.h
+++ llvm/include/llvm/Support/GraphWriter.h
@@ -331,7 +331,8 @@
   if (Filename.empty()) {
 Filename = createGraphFilename(Name.str(), FD);
   } else {
-std::error_code EC = sys::fs::openFileForWrite(Filename, FD);
+std::error_code EC = sys::fs::openFileForWrite(
+Filename, FD, sys::fs::CD_CreateAlways, sys::fs::OF_Text);
 
 // Writing over an existing file is not considered an error.
 if (EC == std::errc::file_exists) {
Index: clang/tools/libclang/CIndexer.cpp
===
--- clang/tools/libclang/CIndexer.cpp
+++ clang/tools/libclang/CIndexer.cpp
@@ -163,7 +163,8 @@
   TempPath = Path;
   llvm::sys::path::append(TempPath, "libclang-");
   int FD;
-  if (llvm::sys::fs::createUniqueFile(TempPath, FD, TempPath))
+  if (llvm::sys::fs::createUniqueFile(TempPath, FD, TempPath,
+  llvm::sys::fs::OF_Text))
 return;
   File = std::string(TempPath.begin(), TempPath.end());
   llvm::raw_fd_ostream OS(FD, /*ShouldClose=*/true);
Index: clang/tools/driver/cc1gen_reproducer_main.cpp
===
--- clang/tools/driver/cc1gen_reproducer_main.cpp
+++ clang/tools/driver/cc1gen_reproducer_main.cpp
@@ -162,7 +162,7 @@
   // Parse the invocation descriptor.
   StringRef Input = Argv[0];
   llvm::ErrorOr> Buffer =
-  llvm::MemoryBuffer::getFile(Input);
+  llvm::MemoryBuffer::getFile(Input, /*IsText=*/true);
   if (!Buffer) {
 llvm::errs() << "error: failed to read " << Input << ": "
  << Buffer.getError().message() << "\n";
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99079: [ARM][AArch64] Require appropriate features for crypto algorithms

2021-04-16 Thread David Candler via Phabricator via cfe-commits
dcandler updated this revision to Diff 338126.
dcandler marked 2 inline comments as done.
dcandler added a comment.

Removed one duplicated line.


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

https://reviews.llvm.org/D99079

Files:
  clang/include/clang/Basic/arm_neon.td
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/Basic/Targets/ARM.h
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/test/CodeGen/aarch64-neon-range-checks.c
  clang/test/CodeGen/aarch64-neon-sha3.c
  clang/test/CodeGen/aarch64-neon-sm4-sm3.c
  clang/test/CodeGen/arm-target-features.c
  clang/test/CodeGen/arm64_crypto.c
  clang/test/CodeGen/neon-crypto.c
  clang/test/Driver/aarch64-cpus.c
  clang/test/Driver/arm-cortex-cpus.c
  clang/test/Driver/arm-features.c
  clang/test/Driver/arm-mfpu.c
  clang/test/Driver/armv8.1m.main.c
  clang/test/Preprocessor/aarch64-target-features.c
  clang/test/Preprocessor/arm-target-features.c
  llvm/include/llvm/Support/ARMTargetParser.def
  llvm/lib/Support/ARMTargetParser.cpp
  llvm/lib/Target/ARM/ARMInstrNEON.td
  llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  llvm/test/Bindings/llvm-c/ARM/disassemble.test
  llvm/test/MC/ARM/directive-arch_extension-aes-sha2.s
  llvm/test/MC/ARM/directive-arch_extension-crypto.s
  llvm/test/MC/ARM/neon-crypto.s

Index: llvm/test/MC/ARM/neon-crypto.s
===
--- llvm/test/MC/ARM/neon-crypto.s
+++ llvm/test/MC/ARM/neon-crypto.s
@@ -9,10 +9,10 @@
 @ CHECK: aese.8 q0, q1  @ encoding: [0x02,0x03,0xb0,0xf3]
 @ CHECK: aesimc.8 q0, q1@ encoding: [0xc2,0x03,0xb0,0xf3]
 @ CHECK: aesmc.8 q0, q1 @ encoding: [0x82,0x03,0xb0,0xf3]
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
+@ CHECK-V7: instruction requires: aes armv8
+@ CHECK-V7: instruction requires: aes armv8
+@ CHECK-V7: instruction requires: aes armv8
+@ CHECK-V7: instruction requires: aes armv8
 
 sha1h.32  q0, q1
 sha1su1.32  q0, q1
@@ -20,9 +20,9 @@
 @ CHECK: sha1h.32  q0, q1   @ encoding: [0xc2,0x02,0xb9,0xf3]
 @ CHECK: sha1su1.32 q0, q1  @ encoding: [0x82,0x03,0xba,0xf3]
 @ CHECK: sha256su0.32 q0, q1@ encoding: [0xc2,0x03,0xba,0xf3]
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
+@ CHECK-V7: instruction requires: sha2 armv8
+@ CHECK-V7: instruction requires: sha2 armv8
+@ CHECK-V7: instruction requires: sha2 armv8
 
 sha1c.32  q0, q1, q2
 sha1m.32  q0, q1, q2
@@ -38,14 +38,14 @@
 @ CHECK: sha256h.32  q0, q1, q2  @ encoding: [0x44,0x0c,0x02,0xf3]
 @ CHECK: sha256h2.32 q0, q1, q2  @ encoding: [0x44,0x0c,0x12,0xf3]
 @ CHECK: sha256su1.32 q0, q1, q2 @ encoding: [0x44,0x0c,0x22,0xf3]
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
-@ CHECK-V7: instruction requires: crypto armv8
+@ CHECK-V7: instruction requires: sha2 armv8
+@ CHECK-V7: instruction requires: sha2 armv8
+@ CHECK-V7: instruction requires: sha2 armv8
+@ CHECK-V7: instruction requires: sha2 armv8
+@ CHECK-V7: instruction requires: sha2 armv8
+@ CHECK-V7: instruction requires: sha2 armv8
+@ CHECK-V7: instruction requires: sha2 armv8
 
 vmull.p64 q8, d16, d17
 @ CHECK: vmull.p64  q8, d16, d17@ encoding: [0xa1,0x0e,0xe0,0xf2]
-@ CHECK-V7: instruction requires: crypto armv8
+@ CHECK-V7: instruction requires: aes armv8
Index: llvm/test/MC/ARM/directive-arch_extension-crypto.s
===
--- llvm/test/MC/ARM/directive-arch_extension-crypto.s
+++ llvm/test/MC/ARM/directive-arch_extension-crypto.s
@@ -17,38 +17,38 @@
 	.type crypto,%function
 crypto:
 	vmull.p64 q0, d0, d1
-@ CHECK-V7: error: instruction requires: crypto armv8
+@ CHECK-V7: error: instruction requires: aes armv8
 
 	aesd.8 q0, q1
-@ CHECK-V7: error: instruction requires: crypto armv8
+@ CHECK-V7: error: instruction requires: aes armv8
 	aese.8 q0, q1
-@ CHECK-V7: error: instruction requires: crypto armv8
+@ CHECK-V7: error: instruction requires: aes armv8
 	aesimc.8 q0, q1
-@ CHECK-V7: error: instruction requires: crypto armv8
+@ CHECK-V7: error: instruction requires: aes armv8
 	aesmc.8 q0, q1
-@ CHECK-V7: error: instruction requires: crypto armv8
+@ CHECK-V7: error: instruction requires: aes armv8
 
 	sha1h.32 q0, q1
-@ CHECK-V7: error: instruction requires: crypto armv8
+@ CHECK-V7: error: instruction requires: sha2 armv8
 	sha1su1.32 q0, q1
-@ CHECK-V7: error: instruction requires: crypto armv8
+@ CHECK-V7: error: instruction requires: sha2 armv8
 	sha256su0.32 q0, q1

[PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

2021-04-16 Thread Michael Benfield via Phabricator via cfe-commits
mbenfield added inline comments.



Comment at: clang/lib/Sema/SemaStmt.cpp:437
+  CompoundStmt *CS = CompoundStmt::Create(Context, Elts, L, R);
+  DiagnoseUnusedButSetVariables(CS);
+  return CS;

mbenfield wrote:
> mbenfield wrote:
> > george.burgess.iv wrote:
> > > It seems like these two warnings are doing analyses with identical 
> > > requirements (e.g., the function's body must be present), but are taking 
> > > two different sets of variables into account while doing so.
> > > 
> > > Is there a way we can rephrase this so we only need to walk the AST 
> > > checking once for all of this?
> > I'll think about this. It might be tricky. 
> I'll implement this. It will be a fairly different approach though. 
I have this implemented. I am going to run a performance comparison on the two 
approaches before making a new revision here. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100581

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


[PATCH] D100653: [clang][cli] NFC: Move conditional LangOptions parsing/generation

2021-04-16 Thread Jan Svoboda via Phabricator via cfe-commits
jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

NFC, this simplifies the main parsing/generating functions by moving logic 
around conditional `LangOptions` where it belongs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100653

Files:
  clang/include/clang/Frontend/CompilerInvocation.h
  clang/lib/Frontend/CompilerInvocation.cpp

Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3260,7 +3260,21 @@
 void CompilerInvocation::GenerateLangArgs(const LangOptions ,
   SmallVectorImpl ,
   StringAllocator SA,
-  const llvm::Triple ) {
+  const llvm::Triple , InputKind IK) {
+  if (IK.getFormat() == InputKind::Precompiled ||
+  IK.getLanguage() == Language::LLVM_IR) {
+if (Opts.ObjCAutoRefCount)
+  GenerateArg(Args, OPT_fobjc_arc, SA);
+if (Opts.PICLevel != 0)
+  GenerateArg(Args, OPT_pic_level, Twine(Opts.PICLevel), SA);
+if (Opts.PIE)
+  GenerateArg(Args, OPT_pic_is_pie, SA);
+for (StringRef Sanitizer : serializeSanitizerKinds(Opts.Sanitize))
+  GenerateArg(Args, OPT_fsanitize_EQ, Sanitizer, SA);
+
+return;
+  }
+
   OptSpecifier StdOpt;
   switch (Opts.LangStd) {
   case LangStandard::lang_opencl10:
@@ -3482,6 +3496,26 @@
DiagnosticsEngine ) {
   unsigned NumErrorsBefore = Diags.getNumErrors();
 
+  if (IK.getFormat() == InputKind::Precompiled ||
+  IK.getLanguage() == Language::LLVM_IR) {
+// ObjCAAutoRefCount and Sanitize LangOpts are used to setup the
+// PassManager in BackendUtil.cpp. They need to be initialized no matter
+// what the input type is.
+if (Args.hasArg(OPT_fobjc_arc))
+  Opts.ObjCAutoRefCount = 1;
+// PICLevel and PIELevel are needed during code generation and this should
+// be set regardless of the input type.
+Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
+Opts.PIE = Args.hasArg(OPT_pic_is_pie);
+parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ),
+Diags, Opts.Sanitize);
+
+return Diags.getNumErrors() == NumErrorsBefore;
+  }
+
+  // Other LangOpts are only initialized when the input is not AST or LLVM IR.
+  // FIXME: Should we really be parsing this for an Language::Asm input?
+
   // FIXME: Cleanup per-file based stuff.
   LangStandard::Kind LangStd = LangStandard::lang_unspecified;
   if (const Arg *A = Args.getLastArg(OPT_std_EQ)) {
@@ -4285,27 +4319,11 @@
   llvm::Triple T(Res.getTargetOpts().Triple);
   ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args, Diags,
 Res.getFileSystemOpts().WorkingDir);
-  if (DashX.getFormat() == InputKind::Precompiled ||
-  DashX.getLanguage() == Language::LLVM_IR) {
-// ObjCAAutoRefCount and Sanitize LangOpts are used to setup the
-// PassManager in BackendUtil.cpp. They need to be initializd no matter
-// what the input type is.
-if (Args.hasArg(OPT_fobjc_arc))
-  LangOpts.ObjCAutoRefCount = 1;
-// PIClevel and PIELevel are needed during code generation and this should be
-// set regardless of the input type.
-LangOpts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
-LangOpts.PIE = Args.hasArg(OPT_pic_is_pie);
-parseSanitizerKinds("-fsanitize=", Args.getAllArgValues(OPT_fsanitize_EQ),
-Diags, LangOpts.Sanitize);
-  } else {
-// Other LangOpts are only initialized when the input is not AST or LLVM IR.
-// FIXME: Should we really be calling this for an Language::Asm input?
-ParseLangArgs(LangOpts, Args, DashX, T, Res.getPreprocessorOpts().Includes,
-  Diags);
-if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)
-  LangOpts.ObjCExceptions = 1;
-  }
+
+  ParseLangArgs(LangOpts, Args, DashX, T, Res.getPreprocessorOpts().Includes,
+Diags);
+  if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)
+LangOpts.ObjCExceptions = 1;
 
   if (LangOpts.CUDA) {
 // During CUDA device-side compilation, the aux triple is the
@@ -4499,24 +4517,7 @@
   GenerateFrontendArgs(FrontendOpts, Args, SA, LangOpts->IsHeaderFile);
   GenerateTargetArgs(*TargetOpts, Args, SA);
   GenerateHeaderSearchArgs(*HeaderSearchOpts, Args, SA);
-
-  InputKind DashX = FrontendOpts.DashX;
-  if (DashX.getFormat() == InputKind::Precompiled ||
-  DashX.getLanguage() == Language::LLVM_IR) {
-if (LangOpts->ObjCAutoRefCount)
-  GenerateArg(Args, OPT_fobjc_arc, SA);
-if (LangOpts->PICLevel != 0)
-  

[PATCH] D99762: [OPENMP]Fix PR49777: Clang should not try to specialize orphaned directives in device codegen.

2021-04-16 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 338122.
ABataev added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99762

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
  clang/test/OpenMP/remarks_parallel_in_target_state_machine.c

Index: clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
===
--- clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
+++ clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
@@ -44,4 +44,4 @@
 }
 
 // expected-remark@* {{OpenMP runtime call __kmpc_global_thread_num moved to}}
-// expected-remark@* {{OpenMP runtime call __kmpc_global_thread_num deduplicated}}
+// expected-remark@* 2 {{OpenMP runtime call __kmpc_global_thread_num deduplicated}}
Index: clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
===
--- clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
+++ clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
@@ -98,5 +98,5 @@
   }
 }
 
-// all-remark@* 3 {{OpenMP runtime call __kmpc_global_thread_num moved to}}
-// all-remark@* 3 {{OpenMP runtime call __kmpc_global_thread_num deduplicated}}
+// all-remark@* 5 {{OpenMP runtime call __kmpc_global_thread_num moved to}}
+// all-remark@* 12 {{OpenMP runtime call __kmpc_global_thread_num deduplicated}}
Index: clang/test/OpenMP/declare_target_codegen_globalization.cpp
===
--- clang/test/OpenMP/declare_target_codegen_globalization.cpp
+++ clang/test/OpenMP/declare_target_codegen_globalization.cpp
@@ -37,11 +37,14 @@
 // CHECK: define {{.*}}[[BAR]]()
 // CHECK: alloca i32,
 // CHECK: [[A_LOCAL_ADDR:%.+]] = alloca i32,
+// CHECK: [[PL:%.+]] = call i16 @__kmpc_parallel_level(
+// CHECK: [[IS_IN_PARALLEL:%.+]] = icmp eq i16 [[PL]], 0
 // CHECK: [[RES:%.+]] = call i8 @__kmpc_is_spmd_exec_mode()
 // CHECK: [[IS_SPMD:%.+]] = icmp ne i8 [[RES]], 0
 // CHECK: br i1 [[IS_SPMD]], label
 // CHECK: br label
-// CHECK: [[RES:%.+]] = call i8* @__kmpc_data_sharing_coalesced_push_stack(i64 128, i16 0)
+// CHECK: [[SZ:%.+]] = select i1 [[IS_IN_PARALLEL]], i64 4, i64 128
+// CHECK: [[RES:%.+]] = call i8* @__kmpc_data_sharing_coalesced_push_stack(i64 [[SZ]], i16 0)
 // CHECK: [[GLOBALS:%.+]] = bitcast i8* [[RES]] to [[GLOBAL_ST:%.+]]*
 // CHECK: br label
 // CHECK: [[ITEMS:%.+]] = phi [[GLOBAL_ST]]* [ null, {{.+}} ], [ [[GLOBALS]], {{.+}} ]
@@ -49,7 +52,9 @@
 // CHECK: [[TID:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
 // CHECK: [[LID:%.+]] = and i32 [[TID]], 31
 // CHECK: [[A_GLOBAL_ADDR:%.+]] = getelementptr inbounds [32 x i32], [32 x i32]* [[A_ADDR]], i32 0, i32 [[LID]]
-// CHECK: [[A_ADDR:%.+]] = select i1 [[IS_SPMD]], i32* [[A_LOCAL_ADDR]], i32* [[A_GLOBAL_ADDR]]
+// CHECK: [[A_GLOBAL_PARALLEL_ADDR:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 0
+// CHECK: [[A_PARALLEL_ADDR:%.+]] = select i1 [[IS_IN_PARALLEL]], i32* [[A_GLOBAL_PARALLEL_ADDR]], i32* [[A_GLOBAL_ADDR]]
+// CHECK: [[A_ADDR:%.+]] = select i1 [[IS_SPMD]], i32* [[A_LOCAL_ADDR]], i32* [[A_PARALLEL_ADDR]]
 // CHECK: call {{.*}}[[FOO]](i32* nonnull align {{[0-9]+}} dereferenceable{{.*}} [[A_ADDR]])
 // CHECK: br i1 [[IS_SPMD]], label
 // CHECK: [[BC:%.+]] = bitcast [[GLOBAL_ST]]* [[ITEMS]] to i8*
Index: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
===
--- clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
+++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
@@ -427,6 +427,20 @@
   /// true if we're definitely in the parallel region.
   bool IsInParallelRegion = false;
 
+  struct StateMode {
+ExecutionMode SavedExecutionMode = EM_Unknown;
+bool SavedIsInTargetMasterThreadRegion = false;
+bool SavedIsInTTDRegion = false;
+bool SavedIsInParallelRegion = false;
+StateMode(ExecutionMode SavedExecutionMode,
+  bool SavedIsInTargetMasterThreadRegion, bool SavedIsInTTDRegion,
+  bool SavedIsInParallelRegion)
+: SavedExecutionMode(SavedExecutionMode),
+  SavedIsInTargetMasterThreadRegion(SavedIsInTargetMasterThreadRegion),
+  SavedIsInTTDRegion(SavedIsInTTDRegion),
+  SavedIsInParallelRegion(SavedIsInParallelRegion) {}
+  };
+  llvm::DenseMap, StateMode> SavedExecutionModes;
   /// Map between an outlined function and its wrapper.
   llvm::DenseMap WrapperFunctionsMap;
 
Index: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -4311,9 +4311,6 @@
 
 void 

[PATCH] D100652: [HIP] Support hipRTC in header

2021-04-16 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: tra.
yaxunl requested review of this revision.

hipRTC compiles HIP device code at run time. Since the system may not
have development tools installed, when a HIP program is compiled through
hipRTC, there is no standard C or C++ header available. As such, the HIP
headers should not depend on standard C or C++ headers when used
with hipRTC. Basically when hipRTC is used, HIP headers only provides
definitions of HIP device API functions. This is in line with what nvRTC does.

This patch adds support of hipRTC to HIP headers in clang. Basically hipRTC
defines a macro __HIPCC_RTC__ when compile HIP code at run time. When
this macro is defined, HIP headers do not include standard C/C++ headers.


https://reviews.llvm.org/D100652

Files:
  clang/lib/Headers/__clang_hip_cmath.h
  clang/lib/Headers/__clang_hip_math.h
  clang/lib/Headers/__clang_hip_runtime_wrapper.h
  clang/test/Headers/hip-header.hip
  clang/test/lit.cfg.py

Index: clang/test/lit.cfg.py
===
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -25,7 +25,7 @@
 config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
 
 # suffixes: A list of file extensions to treat as test files.
-config.suffixes = ['.c', '.cpp', '.i', '.cppm', '.m', '.mm', '.cu',
+config.suffixes = ['.c', '.cpp', '.i', '.cppm', '.m', '.mm', '.cu', '.hip',
'.ll', '.cl', '.clcpp', '.s', '.S', '.modulemap', '.test', '.rs', '.ifs']
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
Index: clang/test/Headers/hip-header.hip
===
--- /dev/null
+++ clang/test/Headers/hip-header.hip
@@ -0,0 +1,20 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -include __clang_hip_runtime_wrapper.h \
+// RUN:   -internal-isystem %S/../../lib/Headers/cuda_wrappers \
+// RUN:   -internal-isystem %S/Inputs/include \
+// RUN:   -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown \
+// RUN:   -target-cpu gfx906 -emit-llvm %s -fcuda-is-device -o - \
+// RUN:   -D__HIPCC_RTC__ | FileCheck %s
+
+// expected-no-diagnostics
+
+// CHECK-LABEL: amdgpu_kernel void @_Z4kernPff
+__global__ void kern(float *x, float y) {
+  *x = sin(y);
+}
+
+// CHECK-LABEL: define{{.*}} i64 @_Z11test_size_tv
+// CHEC: ret i64 8
+__device__ size_t test_size_t() {
+  return sizeof(size_t);
+}
Index: clang/lib/Headers/__clang_hip_runtime_wrapper.h
===
--- clang/lib/Headers/__clang_hip_runtime_wrapper.h
+++ clang/lib/Headers/__clang_hip_runtime_wrapper.h
@@ -18,9 +18,27 @@
 
 #if __HIP__
 
+#if !defined(__HIPCC_RTC__)
 #include 
 #include 
 #include 
+#else
+typedef __SIZE_TYPE__ size_t;
+// Define macros which are needed to declare HIP device API's without standard
+// C/C++ headers. This is for readability so that these API's can be written
+// the same way as non-hipRTC use case. These macros need to be popped so that
+// they do not pollute users' name space.
+#pragma push_macro("NULL")
+#pragma push_macro("uint32_t")
+#pragma push_macro("uint64_t")
+#pragma push_macro("CHAR_BIT")
+#pragma push_macro("INT_MAX")
+#define NULL (void *)0
+#define uint32_t __UINT32_TYPE__
+#define uint64_t __UINT64_TYPE__
+#define CHAR_BIT __CHAR_BIT__
+#define INT_MAX __INTMAX_MAX__
+#endif // __HIPCC_RTC__
 
 #define __host__ __attribute__((host))
 #define __device__ __attribute__((device))
@@ -54,6 +72,7 @@
 #include <__clang_hip_libdevice_declares.h>
 #include <__clang_hip_math.h>
 
+#if !defined(__HIPCC_RTC__)
 #if !_OPENMP || __HIP_ENABLE_CUDA_WRAPPER_FOR_OPENMP__
 #include <__clang_cuda_math_forward_declares.h>
 #include <__clang_hip_cmath.h>
@@ -62,9 +81,16 @@
 #include 
 #include 
 #include 
+#endif // __HIPCC_RTC__
 #endif // !_OPENMP || __HIP_ENABLE_CUDA_WRAPPER_FOR_OPENMP__
 
 #define __CLANG_HIP_RUNTIME_WRAPPER_INCLUDED__ 1
-
+#if defined(__HIPCC_RTC__)
+#pragma pop_macro("NULL")
+#pragma pop_macro("uint32_t")
+#pragma pop_macro("uint64_t")
+#pragma pop_macro("CHAR_BIT")
+#pragma pop_macro("INT_MAX")
+#endif // __HIPCC_RTC__
 #endif // __HIP__
 #endif // __CLANG_HIP_RUNTIME_WRAPPER_H__
Index: clang/lib/Headers/__clang_hip_math.h
===
--- clang/lib/Headers/__clang_hip_math.h
+++ clang/lib/Headers/__clang_hip_math.h
@@ -13,11 +13,13 @@
 #error "This file is for HIP and OpenMP AMDGCN device compilation only."
 #endif
 
+#if !defined(__HIPCC_RTC__)
 #if defined(__cplusplus)
 #include 
 #endif
 #include 
 #include 
+#endif // __HIPCC_RTC__
 
 #pragma push_macro("__DEVICE__")
 #define __DEVICE__ static __device__ inline __attribute__((always_inline))
@@ -1260,6 +1262,7 @@
 __DEVICE__
 double min(double __x, double __y) { return fmin(__x, __y); }
 
+#if !defined(__HIPCC_RTC__)
 __host__ inline static int min(int __arg1, int __arg2) {
   return std::min(__arg1, 

[PATCH] D100502: Allow lib64 in driver test

2021-04-16 Thread Troy Johnson via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8628ed0310e2: [Driver] Allow both lib64 and lib in 
rocm-detect test. (authored by troyj).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100502

Files:
  clang/test/Driver/rocm-detect.hip


Index: clang/test/Driver/rocm-detect.hip
===
--- clang/test/Driver/rocm-detect.hip
+++ clang/test/Driver/rocm-detect.hip
@@ -81,7 +81,7 @@
 
 // SPACK: ROCm installation search path (Spack 4.0.0): [[DIR:.*]]
 // SPACK: ROCm installation search path: [[CLANG:.*]]
-// SPACK: ROCm installation search path: 
[[CLANG]]/{{(llvm/)?}}lib/clang/{{[0-9.]+}}
+// SPACK: ROCm installation search path: 
[[CLANG]]/{{(llvm/)?}}lib{{[0-9]*}}/clang/{{[0-9.]+}}
 // SPACK: ROCm installation search path: /opt/rocm
 // SPACK: InstalledDir: 
[[DIR]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin
 // SPACK: Found HIP installation: 
[[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5, version 4.0.20214-a2917cd


Index: clang/test/Driver/rocm-detect.hip
===
--- clang/test/Driver/rocm-detect.hip
+++ clang/test/Driver/rocm-detect.hip
@@ -81,7 +81,7 @@
 
 // SPACK: ROCm installation search path (Spack 4.0.0): [[DIR:.*]]
 // SPACK: ROCm installation search path: [[CLANG:.*]]
-// SPACK: ROCm installation search path: [[CLANG]]/{{(llvm/)?}}lib/clang/{{[0-9.]+}}
+// SPACK: ROCm installation search path: [[CLANG]]/{{(llvm/)?}}lib{{[0-9]*}}/clang/{{[0-9.]+}}
 // SPACK: ROCm installation search path: /opt/rocm
 // SPACK: InstalledDir: [[DIR]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin
 // SPACK: Found HIP installation: [[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5, version 4.0.20214-a2917cd
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8628ed0 - [Driver] Allow both lib64 and lib in rocm-detect test.

2021-04-16 Thread Troy Johnson via cfe-commits

Author: Troy Johnson
Date: 2021-04-16T09:55:57-05:00
New Revision: 8628ed0310e2fc97e1536a8032327d746973069a

URL: 
https://github.com/llvm/llvm-project/commit/8628ed0310e2fc97e1536a8032327d746973069a
DIFF: 
https://github.com/llvm/llvm-project/commit/8628ed0310e2fc97e1536a8032327d746973069a.diff

LOG: [Driver] Allow both lib64 and lib in rocm-detect test.

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

Added: 


Modified: 
clang/test/Driver/rocm-detect.hip

Removed: 




diff  --git a/clang/test/Driver/rocm-detect.hip 
b/clang/test/Driver/rocm-detect.hip
index 5df5d2a9be067..68ae1edb4eb26 100644
--- a/clang/test/Driver/rocm-detect.hip
+++ b/clang/test/Driver/rocm-detect.hip
@@ -81,7 +81,7 @@
 
 // SPACK: ROCm installation search path (Spack 4.0.0): [[DIR:.*]]
 // SPACK: ROCm installation search path: [[CLANG:.*]]
-// SPACK: ROCm installation search path: 
[[CLANG]]/{{(llvm/)?}}lib/clang/{{[0-9.]+}}
+// SPACK: ROCm installation search path: 
[[CLANG]]/{{(llvm/)?}}lib{{[0-9]*}}/clang/{{[0-9.]+}}
 // SPACK: ROCm installation search path: /opt/rocm
 // SPACK: InstalledDir: 
[[DIR]]/llvm-amdgpu-4.0.0-ieagcs7inf7runpyfvepqkurasoglq4z/bin
 // SPACK: Found HIP installation: 
[[DIR]]/hip-4.0.0-5f63slrursbrvfe2txrrjkynbsywsob5, version 4.0.20214-a2917cd



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


[PATCH] D99350: [OPENMP]Fix PR49649: The introduction of $ref globals is not always valid.

2021-04-16 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 338116.
ABataev added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99350

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/declare_target_codegen.cpp


Index: clang/test/OpenMP/declare_target_codegen.cpp
===
--- clang/test/OpenMP/declare_target_codegen.cpp
+++ clang/test/OpenMP/declare_target_codegen.cpp
@@ -42,10 +42,10 @@
 // CHECK-DAG: @c = external global i32,
 // CHECK-DAG: @globals ={{ hidden | }}global %struct.S zeroinitializer,
 // CHECK-DAG: [[STAT:@.+stat]] = internal global %struct.S zeroinitializer,
-// CHECK-DAG: [[STAT_REF:@.+]] = internal constant %struct.S* [[STAT]]
+// CHECK-DAG: [[STAT_REF:@.+]] = internal constant i8* bitcast (%struct.S* 
[[STAT]] to i8*)
 // CHECK-DAG: @out_decl_target ={{ hidden | }}global i32 0,
 // CHECK-DAG: @llvm.used = appending global [2 x i8*] [i8* bitcast (void ()* 
@__omp_offloading__{{.+}}_globals_l[[@LINE+84]]_ctor to i8*), i8* bitcast (void 
()* @__omp_offloading__{{.+}}_stat_l[[@LINE+85]]_ctor to i8*)],
-// CHECK-DAG: @llvm.compiler.used = appending global [1 x i8*] [i8* bitcast 
(%struct.S** [[STAT_REF]] to i8*)],
+// CHECK-DAG: @llvm.compiler.used = appending global [1 x i8*] [i8* bitcast 
(i8** [[STAT_REF]] to i8*)],
 
 // CHECK-DAG: define {{.*}}i32 @{{.*}}{{foo|bar|baz2|baz3|FA|f_method}}{{.*}}()
 // CHECK-DAG: define {{.*}}void 
@{{.*}}TemplateClass{{.*}}(%class.TemplateClass* {{[^,]*}} %{{.*}})
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -10651,11 +10651,13 @@
   std::string RefName = getName({VarName, "ref"});
   if (!CGM.GetGlobalValue(RefName)) {
 llvm::Constant *AddrRef =
-getOrCreateInternalVariable(Addr->getType(), RefName);
+getOrCreateInternalVariable(CGM.VoidPtrTy, RefName);
 auto *GVAddrRef = cast(AddrRef);
 GVAddrRef->setConstant(/*Val=*/true);
 GVAddrRef->setLinkage(llvm::GlobalValue::InternalLinkage);
-GVAddrRef->setInitializer(Addr);
+GVAddrRef->setInitializer(
+llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
+Addr, CGM.VoidPtrTy));
 CGM.addCompilerUsedGlobal(GVAddrRef);
   }
 }


Index: clang/test/OpenMP/declare_target_codegen.cpp
===
--- clang/test/OpenMP/declare_target_codegen.cpp
+++ clang/test/OpenMP/declare_target_codegen.cpp
@@ -42,10 +42,10 @@
 // CHECK-DAG: @c = external global i32,
 // CHECK-DAG: @globals ={{ hidden | }}global %struct.S zeroinitializer,
 // CHECK-DAG: [[STAT:@.+stat]] = internal global %struct.S zeroinitializer,
-// CHECK-DAG: [[STAT_REF:@.+]] = internal constant %struct.S* [[STAT]]
+// CHECK-DAG: [[STAT_REF:@.+]] = internal constant i8* bitcast (%struct.S* [[STAT]] to i8*)
 // CHECK-DAG: @out_decl_target ={{ hidden | }}global i32 0,
 // CHECK-DAG: @llvm.used = appending global [2 x i8*] [i8* bitcast (void ()* @__omp_offloading__{{.+}}_globals_l[[@LINE+84]]_ctor to i8*), i8* bitcast (void ()* @__omp_offloading__{{.+}}_stat_l[[@LINE+85]]_ctor to i8*)],
-// CHECK-DAG: @llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (%struct.S** [[STAT_REF]] to i8*)],
+// CHECK-DAG: @llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i8** [[STAT_REF]] to i8*)],
 
 // CHECK-DAG: define {{.*}}i32 @{{.*}}{{foo|bar|baz2|baz3|FA|f_method}}{{.*}}()
 // CHECK-DAG: define {{.*}}void @{{.*}}TemplateClass{{.*}}(%class.TemplateClass* {{[^,]*}} %{{.*}})
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -10651,11 +10651,13 @@
   std::string RefName = getName({VarName, "ref"});
   if (!CGM.GetGlobalValue(RefName)) {
 llvm::Constant *AddrRef =
-getOrCreateInternalVariable(Addr->getType(), RefName);
+getOrCreateInternalVariable(CGM.VoidPtrTy, RefName);
 auto *GVAddrRef = cast(AddrRef);
 GVAddrRef->setConstant(/*Val=*/true);
 GVAddrRef->setLinkage(llvm::GlobalValue::InternalLinkage);
-GVAddrRef->setInitializer(Addr);
+GVAddrRef->setInitializer(
+llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
+Addr, CGM.VoidPtrTy));
 CGM.addCompilerUsedGlobal(GVAddrRef);
   }
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99436: [OPENMP]Fix PR49366: crash on VLAs in task untied regions.

2021-04-16 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 338114.
ABataev added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99436

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/OpenMP/task_messages.cpp
  clang/test/OpenMP/taskloop_loop_messages.cpp

Index: clang/test/OpenMP/taskloop_loop_messages.cpp
===
--- clang/test/OpenMP/taskloop_loop_messages.cpp
+++ clang/test/OpenMP/taskloop_loop_messages.cpp
@@ -691,7 +691,7 @@
 
 void test_loop_eh() {
   const int N = 100;
-  float a[N], b[N], c[N];
+  float a[N], b[N], c[N]; // expected-note {{declared here}}
 #pragma omp parallel
 #pragma omp taskloop
   for (int i = 0; i < 10; i++) {
@@ -729,6 +729,13 @@
   void g() { throw 0; }
 };
   }
+// expected-error@+5 {{variable length arrays are not supported in OpenMP tasking regions with 'untied' clause}}
+// expected-note@+4 {{read of non-constexpr variable 'c' is not allowed in a constant expression}}
+#pragma omp taskloop untied
+  {
+  for (int i = 0; i < 10; ++i)
+int array[(int)c[0]];
+  }
 }
 
 void test_loop_firstprivate_lastprivate() {
Index: clang/test/OpenMP/task_messages.cpp
===
--- clang/test/OpenMP/task_messages.cpp
+++ clang/test/OpenMP/task_messages.cpp
@@ -173,7 +173,7 @@
   int  = a;
   S sa;
   S  = sa;
-  int r;
+  int r; // expected-note {{declared here}}
 #pragma omp task { // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}}
   foo();
 #pragma omp task( // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}}
@@ -330,6 +330,12 @@
 // expected-error@+1 {{directive '#pragma omp task' cannot contain more than one 'mergeable' clause}}
 #pragma omp task mergeable mergeable
   ++r;
+// expected-error@+4 {{variable length arrays are not supported in OpenMP tasking regions with 'untied' clause}}
+// expected-note@+3 {{read of non-const variable 'r' is not allowed in a constant expression}}
+#pragma omp task untied
+  {
+int array[r];
+  }
   volatile omp_event_handle_t evt;
   omp_event_handle_t sevt;
   const omp_event_handle_t cevt = evt;
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -2417,6 +2417,9 @@
   } else if (isSFINAEContext()) {
 VLADiag = diag::err_vla_in_sfinae;
 VLAIsError = true;
+  } else if (getLangOpts().OpenMP && isInOpenMPTaskUntiedContext()) {
+VLADiag = diag::err_openmp_vla_in_task_untied;
+VLAIsError = true;
   } else {
 VLADiag = diag::ext_vla;
 VLAIsError = false;
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -174,6 +174,7 @@
 bool HasMutipleLoops = false;
 const Decl *PossiblyLoopCounter = nullptr;
 bool NowaitRegion = false;
+bool UntiedRegion = false;
 bool CancelRegion = false;
 bool LoopStart = false;
 bool BodyComplete = false;
@@ -841,6 +842,15 @@
   return Parent->NowaitRegion;
 return false;
   }
+  /// Marks current region as untied (it has a 'untied' clause).
+  void setUntiedRegion(bool IsUntied = true) {
+getTopOfStack().UntiedRegion = IsUntied;
+  }
+  /// Return true if current region is untied.
+  bool isUntiedRegion() const {
+const SharingMapTy *Top = getTopOfStackOrNull();
+return Top ? Top->UntiedRegion : false;
+  }
   /// Marks parent region as cancel region.
   void setParentCancelRegion(bool Cancel = true) {
 if (SharingMapTy *Parent = getSecondOnStackOrNull())
@@ -2154,6 +2164,11 @@
   return DSAStack->getNestingLevel();
 }
 
+bool Sema::isInOpenMPTaskUntiedContext() const {
+  return isOpenMPTaskingDirective(DSAStack->getCurrentDirective()) &&
+ DSAStack->isUntiedRegion();
+}
+
 bool Sema::isInOpenMPTargetExecutionDirective() const {
   return (isOpenMPTargetExecutionDirective(DSAStack->getCurrentDirective()) &&
   !DSAStack->isClauseParsingMode()) ||
@@ -14657,6 +14672,7 @@
 
 OMPClause *Sema::ActOnOpenMPUntiedClause(SourceLocation StartLoc,
  SourceLocation EndLoc) {
+  DSAStack->setUntiedRegion();
   return new (Context) OMPUntiedClause(StartLoc, EndLoc);
 }
 
Index: clang/include/clang/Sema/Sema.h
===
--- clang/include/clang/Sema/Sema.h
+++ clang/include/clang/Sema/Sema.h
@@ -10491,6 +10491,10 @@
   void finalizeOpenMPDelayedAnalysis(const FunctionDecl *Caller,
  const FunctionDecl *Callee,
  SourceLocation Loc);
+
+  /// Return true if 

[PATCH] D100534: [clang][deps] Generate the full command-line for modules

2021-04-16 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

LGTM, just a couple of other comments inline.




Comment at: clang/include/clang/Frontend/CompilerInstance.h:230
+
+  std::shared_ptr getInvocationPtr() {
 assert(Invocation && "Compiler instance has no invocation!");

Is `get*Ptr()` already used in CompilerInstance? If so, matching that style 
sounds great. Otherwise I have a slight preference for `getShared*()`.



Comment at: 
clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h:78-80
+  /// The compiler invocation associated with the translation unit that imports
+  /// this module.
+  CompilerInvocation Invocation;

jansvoboda11 wrote:
> dexonsmith wrote:
> > Looks like this will be a deep copy, but it doesn't look like it's being 
> > modified. Can this just be a `const &`, taken in the `ModuleDeps` 
> > constructor? Or is there a lifetime reason this needs to be as it is?
> It can't be `const &` for two reasons:
> 
> 1. The current code value-initializes `ModuleDeps` in two places and truly 
> initializes it later in `ModuleDepCollectorPP::handleTopLevelModule`. We'd 
> have to go with something like 
> `optional>` to be able to delay the 
> initialization.
> 2. The lifetime of the `CompilerInvocation` is a bit wild, but the reference 
> most likely wouldn't outlive `ModuleDeps` (depends on the client).
> 
> I think the best solution would be to extract the `shared_ptr` from 
> `CompilerInstance`, share it across `ModuleDeps` instances and only do a deep 
> copy when actually generating the command line.
Using shared_ptr seems right given the lifetime issues.

FWIW, I think `const CompilerInvocation*` is probably simpler to work with than 
`Optional>`.



Comment at: clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp:62
 std::function LookupModuleDeps) const {
-  // TODO: Build full command line. That also means capturing the original
-  //   command line into NonPathCommandLine.
-
-  std::vector Ret{
-  "-fno-implicit-modules",
-  "-fno-implicit-module-maps",
-  };
+  CompilerInvocation CI = getFullCommandLineCompilerInvocation(*this);
 

jansvoboda11 wrote:
> jansvoboda11 wrote:
> > dexonsmith wrote:
> > > I think guaranteed copy elision means this won't be a deep copy of the 
> > > return, but it might be nice to add a move constructor for 
> > > `CompilerInvocation` so it's more obvious.
> > That's intentional. The deep copy is performed inside the function.
> > 
> > Shouldn't the move constructor of `CompilerInvocation` be defaulted?
> s/defaulted/implicitly-defined/
Explicitly declaring a copy constructor suppresses the implicit move 
constructor. But adding a move with `= default` is probably all that's needed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100534

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


[PATCH] D99530: [OPENMP]Fix PR49098: respect firstprivate of declare target variable.

2021-04-16 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 338111.
ABataev added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99530

Files:
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/target_firstprivate_codegen.cpp

Index: clang/test/OpenMP/target_firstprivate_codegen.cpp
===
--- clang/test/OpenMP/target_firstprivate_codegen.cpp
+++ clang/test/OpenMP/target_firstprivate_codegen.cpp
@@ -43,6 +43,9 @@
   tx X;
   ty Y;
 };
+#pragma omp declare target
+int ga = 5;
+#pragma omp end declare target
 
 // CHECK-DAG:  [[TT:%.+]] = type { i64, i8 }
 // CHECK-DAG:  [[TTII:%.+]] = type { i32, i32 }
@@ -52,9 +55,9 @@
 // TCHECK-DAG:  [[TTII:%.+]] = type { i32, i32 }
 // TCHECK-DAG:  [[S1:%.+]] = type { double }
 
-// CHECK-DAG:  [[FP_E:@__omp_offloading_firstprivate_.+_e_l76]] = internal global [[TTII]] zeroinitializer
-// CHECK-DAG:  [[SIZET:@.+]] = private unnamed_addr constant [2 x i{{32|64}}] [i[[SZ:32|64]] 4, i{{64|32}} {{8|4}}]
-// CHECK-DAG:  [[MAPT:@.+]] = private unnamed_addr constant [2 x i64] [i64 288, i64 49]
+// CHECK-DAG:  [[FP_E:@__omp_offloading_firstprivate_.+_e_l79]] = internal global [[TTII]] zeroinitializer
+// CHECK-DAG:  [[SIZET:@.+]] = private unnamed_addr constant [3 x i{{32|64}}] [i[[SZ:32|64]] 4, i{{64|32}} {{8|4}}, i[[SZ:32|64]] 4]
+// CHECK-DAG:  [[MAPT:@.+]] = private unnamed_addr constant [3 x i64] [i64 288, i64 49, i64 288]
 // CHECK-DAG:  [[MAPT2:@.+]] = private unnamed_addr constant [9 x i64] [i64 288, i64 161, i64 800, i64 161, i64 161, i64 800, i64 800, i64 161, i64 161]
 // CHECK-DAG:  [[SIZET3:@.+]] = private unnamed_addr constant [2 x i{{32|64}}] [i{{32|64}} 0, i{{32|64}} 8]
 // CHECK-DAG:  [[MAPT3:@.+]] = private unnamed_addr constant [2 x i64] [i64 32, i64 37]
@@ -76,7 +79,7 @@
   const TT e = {n, n};
   int *p __attribute__ ((aligned (64))) = 
 
-#pragma omp target firstprivate(a, p)
+#pragma omp target firstprivate(a, p, ga)
   {
   }
 
@@ -91,8 +94,8 @@
   // CHECK:  [[D:%.+]] = alloca [[TT]],
   // CHECK:  [[P:%.+]] = alloca i32*, align 64
   // CHECK:  [[ACAST:%.+]] = alloca i{{[0-9]+}},
-  // CHECK:  [[BASE_PTR_ARR:%.+]] = alloca [2 x i8*],
-  // CHECK:  [[PTR_ARR:%.+]] = alloca [2 x i8*],
+  // CHECK:  [[BASE_PTR_ARR:%.+]] = alloca [3 x i8*],
+  // CHECK:  [[PTR_ARR:%.+]] = alloca [3 x i8*],
   // CHECK:  [[A2CAST:%.+]] = alloca i{{[0-9]+}},
   // CHECK:  [[BASE_PTR_ARR2:%.+]] = alloca [9 x i8*],
   // CHECK:  [[PTR_ARR2:%.+]] = alloca [9 x i8*],
@@ -116,29 +119,37 @@
   // CHECK-32:  store i{{[0-9]+}} [[AVAL]], i{{[0-9]+}}* [[ACAST]],
   // CHECK:  [[ACAST_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[ACAST]],
   // CHECK:  [[P_PTR:%.+]] = load i32*, i32** [[P]], align 64
-  // CHECK:  [[BASE_PTR_GEP:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BASE_PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
+  // CHECK:  [[BASE_PTR_GEP:%.+]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[BASE_PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
   // CHECK:  [[ACAST_TOPTR:%.+]] = bitcast i8** [[BASE_PTR_GEP]] to i{{[0-9]+}}*
   // CHECK:  store i{{[0-9]+}} [[ACAST_VAL]], i{{[0-9]+}}* [[ACAST_TOPTR]],
-  // CHECK:  [[PTR_GEP:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
+  // CHECK:  [[PTR_GEP:%.+]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
   // CHECK:  [[ACAST_TOPTR2:%.+]] = bitcast i8** [[PTR_GEP]] to i{{[0-9]+}}*
   // CHECK:  store i{{[0-9]+}} [[ACAST_VAL]], i{{[0-9]+}}* [[ACAST_TOPTR2]],
-  // CHECK:  [[BASE_PTR_GEP:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BASE_PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
+  // CHECK:  [[BASE_PTR_GEP:%.+]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[BASE_PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
   // CHECK:  [[PCAST_TOPTR:%.+]] = bitcast i8** [[BASE_PTR_GEP]] to i32***
   // CHECK:  store i32** [[P]], i32*** [[PCAST_TOPTR]],
-  // CHECK:  [[PTR_GEP:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
+  // CHECK:  [[PTR_GEP:%.+]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
   // CHECK:  [[PCAST_TOPTR2:%.+]] = bitcast i8** [[PTR_GEP]] to i32**
   // CHECK:  store i32* [[P_PTR]], i32** [[PCAST_TOPTR2]],
-  // CHECK:  [[BASE_PTR_GEP_ARG:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BASE_PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
-  // CHECK:  [[PTR_GEP_ARG:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
-  // CHECK:  {{.+}} = call i32 @__tgt_target_mapper(%struct.ident_t* @{{.+}}, i64 -1, {{.+}}, i32 2, i8** [[BASE_PTR_GEP_ARG]], i8** [[PTR_GEP_ARG]], i[[SZ]]* getelementptr inbounds ([2 x i[[SZ]]], [2 x i[[SZ]]]* [[SIZET]], i32 0, i32 0), i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0), i8** null, i8** null)
-
-  // TCHECK:  

[PATCH] D100391: [RISCV][Clang] Add RVV miscellaneous intrinsic functions.

2021-04-16 Thread Zakk Chen via Phabricator via cfe-commits
khchen added inline comments.



Comment at: clang/include/clang/Basic/riscv_vector.td:1304
+// Reinterpret between different SEW under the same LMUL
+foreach dst_sew = ["(FixedLog2SEW:3)", "(FixedLog2SEW:4)", 
"(FixedLog2SEW:5)",
+   "(FixedLog2SEW:6)"] in {

craig.topper wrote:
> Would this make more sense as just FixedSEW:8, FixedSEW:16, etc. I don't 
> think the Log2 is helping here. We need it for LMUL because of the fractional 
> lmul, but not SEW.
Agreed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100391

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


[PATCH] D100644: [clang][cli] NFC: Use Diags to report parsing success/failure

2021-04-16 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith accepted this revision.
dexonsmith added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100644

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


  1   2   >