[PATCH] D69764: [clang-format] Add East/West Const fixer capability

2021-07-10 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

> Should any known failure modes be documented?

At present, I don't know of any, I think I could probably trick it with macros 
but then that is #clang-format  all 
over,

if you are using it feel free to log bugs in the bug tracker and add a 
reference to D69764  if you see any and I'll 
take a look.


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

https://reviews.llvm.org/D69764

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


[PATCH] D105759: [WIP] Implement P2361 Unevaluated string literals

2021-07-10 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin created this revision.
cor3ntin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch proposes to handle in an uniform fashion
the parsing of strings that are never evaluated,
in asm statement, static assert, attrributes, extern,
etc.

Unevaluated strings are UTF-8 internally and so currently
behave as narrow strings, but these things will diverge with
D93031 .

The big question both for this patch and the P2361 
 paper
is whether we risk breaking code by disallowing
encoding prefixes in this context.
I hope this patch may allow to gather some data on that.

Future work:
Improve the rendering of unicode characters, line break
and so forth in static-assert messages


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105759

Files:
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/PPDirectives.cpp
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/Parser.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/test/CXX/dcl.dcl/dcl.link/p2.cpp
  clang/test/CXX/dcl.dcl/p4-0x.cpp
  clang/test/FixIt/fixit-static-assert.cpp
  clang/test/Parser/asm.c
  clang/test/Parser/asm.cpp
  clang/test/Parser/attr-availability.c
  clang/test/Sema/asm.c
  clang/test/SemaCXX/static-assert.cpp

Index: clang/test/SemaCXX/static-assert.cpp
===
--- clang/test/SemaCXX/static-assert.cpp
+++ clang/test/SemaCXX/static-assert.cpp
@@ -28,12 +28,12 @@
 S s1; // expected-note {{in instantiation of template class 'S' requested here}}
 S s2;
 
-static_assert(false, L"\x"); // expected-error {{static_assert failed L"\x"}}
-static_assert(false, u"\U000317FF"); // expected-error {{static_assert failed u"\U000317FF"}}
+static_assert(false, L"\x"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error {{hex escape sequence out of range}}
+static_assert(false, u"\U000317FF"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 // FIXME: render this as u8"\u03A9"
-static_assert(false, u8"Ω"); // expected-error {{static_assert failed u8"\316\251"}}
-static_assert(false, L"\u1234"); // expected-error {{static_assert failed L"\x1234"}}
-static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{static_assert failed L"\x1FF""0\x123""fx\xFgoop"}}
+static_assert(false, u8"Ω"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\u1234"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error 3{{hex escape sequence out of range}}
 
 template struct AlwaysFails {
   // Only give one error here.
Index: clang/test/Sema/asm.c
===
--- clang/test/Sema/asm.c
+++ clang/test/Sema/asm.c
@@ -37,14 +37,14 @@
   asm ("nop" : "=c" (a) : "r" (no_clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (no_clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
-  asm ("nop" : "=a" (a) : "b" (b) : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}} 
+  asm ("nop" : "=a" (a) : "b" (b) : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
 }
 
 // rdar://6094010
 void test3() {
   int x;
-  asm(L"foo" : "=r"(x)); // expected-error {{wide string}}
-  asm("foo" : L"=r"(x)); // expected-error {{wide string}}
+  asm(L"foo" : "=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+  asm("foo" : L"=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 }
 
 // 
Index: clang/test/Parser/attr-availability.c
===
--- clang/test/Parser/attr-availability.c
+++ clang/test

[PATCH] D105759: [WIP] Implement P2361 Unevaluated string literals

2021-07-10 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 357714.
cor3ntin added a comment.

clang-format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

Files:
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/PPDirectives.cpp
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/Parser.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/test/CXX/dcl.dcl/dcl.link/p2.cpp
  clang/test/CXX/dcl.dcl/p4-0x.cpp
  clang/test/FixIt/fixit-static-assert.cpp
  clang/test/Parser/asm.c
  clang/test/Parser/asm.cpp
  clang/test/Parser/attr-availability.c
  clang/test/Sema/asm.c
  clang/test/SemaCXX/static-assert.cpp

Index: clang/test/SemaCXX/static-assert.cpp
===
--- clang/test/SemaCXX/static-assert.cpp
+++ clang/test/SemaCXX/static-assert.cpp
@@ -28,12 +28,15 @@
 S s1; // expected-note {{in instantiation of template class 'S' requested here}}
 S s2;
 
-static_assert(false, L"\x"); // expected-error {{static_assert failed L"\x"}}
-static_assert(false, u"\U000317FF"); // expected-error {{static_assert failed u"\U000317FF"}}
+static_assert(false, L"\x"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error {{hex escape sequence out of range}}
+static_assert(false, u"\U000317FF"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 // FIXME: render this as u8"\u03A9"
-static_assert(false, u8"Ω"); // expected-error {{static_assert failed u8"\316\251"}}
-static_assert(false, L"\u1234"); // expected-error {{static_assert failed L"\x1234"}}
-static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{static_assert failed L"\x1FF""0\x123""fx\xFgoop"}}
+static_assert(false, u8"Ω"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\u1234"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\x1ff"
+ "0\x123"
+ "fx\xf"
+ "goop"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error 3{{hex escape sequence out of range}}
 
 template struct AlwaysFails {
   // Only give one error here.
Index: clang/test/Sema/asm.c
===
--- clang/test/Sema/asm.c
+++ clang/test/Sema/asm.c
@@ -37,14 +37,19 @@
   asm ("nop" : "=c" (a) : "r" (no_clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (no_clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
-  asm ("nop" : "=a" (a) : "b" (b) : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}} 
+  asm("nop"
+  : "=a"(a)
+  : "b"(b)
+  : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
 }
 
 // rdar://6094010
 void test3() {
   int x;
-  asm(L"foo" : "=r"(x)); // expected-error {{wide string}}
-  asm("foo" : L"=r"(x)); // expected-error {{wide string}}
+  asm(L"foo"
+  : "=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+  asm("foo"
+  : L"=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 }
 
 // 
Index: clang/test/Parser/attr-availability.c
===
--- clang/test/Parser/attr-availability.c
+++ clang/test/Parser/attr-availability.c
@@ -20,15 +20,18 @@
 
 void f7() __attribute__((availability(macosx,message=L"wide"))); // expected-error {{expected string literal for optional message in 'availability' attribute}}
 
-void f8() __attribute__((availability(macosx,message="a" L"b"))); // expected-error {{expected string literal for optional message in 'availability' attribute}}
+void f8() __attribute__((availability(macosx, message = "a"
+L"b"))); // expected-error {{an unevaluated string literal can

[PATCH] D103796: [Clang][RISCV] Implement vlsseg.

2021-07-10 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai updated this revision to Diff 357716.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103796

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vlsseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vlsseg.c

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


[PATCH] D103809: [Clang][RISCV] Implement vloxseg and vluxseg.

2021-07-10 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai updated this revision to Diff 357717.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103809

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/test/CodeGen/RISCV/rvv-intrinsics/vloxseg.c

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


[PATCH] D103871: [Clang][RISCV] Implement vsseg.

2021-07-10 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai updated this revision to Diff 357718.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103871

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vsseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsseg.c

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


[PATCH] D103872: [Clang][RISCV] Implement vssseg.

2021-07-10 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai updated this revision to Diff 357719.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103872

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vssseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vssseg.c

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


[PATCH] D103873: [Clang][RISCV] Implement vsoxseg and vsuxseg.

2021-07-10 Thread Hsiangkai Wang via Phabricator via cfe-commits
HsiangKai updated this revision to Diff 357720.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103873

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vsoxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vsuxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsoxseg.c
  clang/test/CodeGen/RISCV/rvv-intrinsics/vsuxseg.c

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


[PATCH] D105264: [X86] AVX512FP16 instructions enabling 2/6

2021-07-10 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei updated this revision to Diff 357721.
pengfei added a comment.

Rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105264

Files:
  clang/include/clang/Basic/BuiltinsX86.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/avx512fp16intrin.h
  clang/lib/Headers/avx512vlfp16intrin.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/X86/avx512fp16-builtins.c
  clang/test/CodeGen/X86/avx512vlfp16-builtins.c
  llvm/include/llvm/IR/IntrinsicsX86.td
  llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86ATTInstPrinter.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86InstrAVX512.td
  llvm/lib/Target/X86/X86InstrFoldTables.cpp
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/lib/Target/X86/X86IntrinsicsInfo.h
  llvm/test/CodeGen/X86/avx512fp16-arith-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16-arith-vl-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16-arith.ll
  llvm/test/CodeGen/X86/avx512fp16-fmaxnum.ll
  llvm/test/CodeGen/X86/avx512fp16-fminnum.ll
  llvm/test/CodeGen/X86/avx512fp16-fold-load-binops.ll
  llvm/test/CodeGen/X86/avx512fp16-fold-xmm-zero.ll
  llvm/test/CodeGen/X86/avx512fp16-fp-logic.ll
  llvm/test/CodeGen/X86/avx512fp16-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16-machine-combiner.ll
  llvm/test/CodeGen/X86/avx512fp16-mov.ll
  llvm/test/CodeGen/X86/avx512fp16-unsafe-fp-math.ll
  llvm/test/CodeGen/X86/fp-strict-scalar-cmp-fp16.ll
  llvm/test/CodeGen/X86/fp-strict-scalar-fp16.ll
  llvm/test/CodeGen/X86/pseudo_cmov_lower-fp16.ll
  llvm/test/CodeGen/X86/stack-folding-fp-avx512fp16.ll
  llvm/test/CodeGen/X86/stack-folding-fp-avx512fp16vl.ll
  llvm/test/CodeGen/X86/vec-strict-128-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-256-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-512-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-cmp-128-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-cmp-256-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-cmp-512-fp16.ll
  llvm/test/CodeGen/X86/vector-reduce-fmax-nnan.ll
  llvm/test/CodeGen/X86/vector-reduce-fmin-nnan.ll
  llvm/test/MC/Disassembler/X86/avx512fp16.txt
  llvm/test/MC/Disassembler/X86/avx512fp16vl.txt
  llvm/test/MC/X86/avx512fp16.s
  llvm/test/MC/X86/avx512fp16vl.s
  llvm/test/MC/X86/intel-syntax-avx512fp16.s
  llvm/test/MC/X86/intel-syntax-avx512fp16vl.s

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


[PATCH] D105421: [analyzer] Handle << operator for std::unique_ptr

2021-07-10 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD marked 4 inline comments as done.
RedDocMD added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp:195
 
+const SmallVector BasicOstreamName = {"basic_ostream"};
+

vsavchenko wrote:
> Same here + don't call it "Name" (singular).  It is a) an array and b) in the 
> future, we might add more things to it, so we shouldn't need to rename it 
> everywhere.
Well, we won't have to rename but we will still have to change the array length 
everywhere if more names are added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105421

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


[PATCH] D105265: [X86] AVX512FP16 instructions enabling 3/6

2021-07-10 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei updated this revision to Diff 357722.
pengfei added a comment.

Add tests for __extendhfxf2 and __truncxfhf2.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105265

Files:
  clang/include/clang/Basic/BuiltinsX86.def
  clang/include/clang/Basic/BuiltinsX86_64.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Headers/avx512fp16intrin.h
  clang/lib/Headers/avx512vlfp16intrin.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/CodeGen/X86/avx512fp16-builtins.c
  clang/test/CodeGen/X86/avx512vlfp16-builtins.c
  llvm/include/llvm/IR/IntrinsicsX86.td
  llvm/include/llvm/IR/RuntimeLibcalls.def
  llvm/lib/CodeGen/TargetLoweringBase.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86InstrAVX512.td
  llvm/lib/Target/X86/X86InstrFoldTables.cpp
  llvm/lib/Target/X86/X86InstrFragmentsSIMD.td
  llvm/lib/Target/X86/X86InstrInfo.cpp
  llvm/lib/Target/X86/X86InstrSSE.td
  llvm/lib/Target/X86/X86IntrinsicsInfo.h
  llvm/test/CodeGen/X86/avx512fp16-arith-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16-arith-vl-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16-arith.ll
  llvm/test/CodeGen/X86/avx512fp16-cvt-ph-w-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16-cvt-ph-w-vl-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16-cvt.ll
  llvm/test/CodeGen/X86/avx512fp16-intrinsics.ll
  llvm/test/CodeGen/X86/avx512fp16vl-intrinsics.ll
  llvm/test/CodeGen/X86/cvt16-2.ll
  llvm/test/CodeGen/X86/fp-strict-scalar-fp16.ll
  llvm/test/CodeGen/X86/fp-strict-scalar-fptoint-fp16.ll
  llvm/test/CodeGen/X86/fp-strict-scalar-inttofp-fp16.ll
  llvm/test/CodeGen/X86/stack-folding-fp-avx512fp16vl.ll
  llvm/test/CodeGen/X86/vec-strict-128-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-256-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-512-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-fptoint-128-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-fptoint-256-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-fptoint-512-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-inttofp-128-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-inttofp-256-fp16.ll
  llvm/test/CodeGen/X86/vec-strict-inttofp-512-fp16.ll
  llvm/test/MC/Disassembler/X86/avx512fp16.txt
  llvm/test/MC/Disassembler/X86/avx512fp16vl.txt
  llvm/test/MC/X86/avx512fp16.s
  llvm/test/MC/X86/avx512fp16vl.s
  llvm/test/MC/X86/intel-syntax-avx512fp16.s
  llvm/test/MC/X86/intel-syntax-avx512fp16vl.s

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


[PATCH] D105759: [WIP] Implement P2361 Unevaluated string literals

2021-07-10 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 357723.
cor3ntin added a comment.

- Support unevaluated str8ing literal in deprecated/nodiscard attributes
- Fix test formatting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

Files:
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/PPDirectives.cpp
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/Parser.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/test/CXX/dcl.dcl/dcl.link/p2.cpp
  clang/test/CXX/dcl.dcl/p4-0x.cpp
  clang/test/FixIt/fixit-static-assert.cpp
  clang/test/Parser/asm.c
  clang/test/Parser/asm.cpp
  clang/test/Parser/attr-availability.c
  clang/test/Sema/asm.c
  clang/test/SemaCXX/static-assert.cpp

Index: clang/test/SemaCXX/static-assert.cpp
===
--- clang/test/SemaCXX/static-assert.cpp
+++ clang/test/SemaCXX/static-assert.cpp
@@ -28,12 +28,12 @@
 S s1; // expected-note {{in instantiation of template class 'S' requested here}}
 S s2;
 
-static_assert(false, L"\x"); // expected-error {{static_assert failed L"\x"}}
-static_assert(false, u"\U000317FF"); // expected-error {{static_assert failed u"\U000317FF"}}
+static_assert(false, L"\x"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error {{hex escape sequence out of range}}
+static_assert(false, u"\U000317FF"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 // FIXME: render this as u8"\u03A9"
-static_assert(false, u8"Ω"); // expected-error {{static_assert failed u8"\316\251"}}
-static_assert(false, L"\u1234"); // expected-error {{static_assert failed L"\x1234"}}
-static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{static_assert failed L"\x1FF""0\x123""fx\xFgoop"}}
+static_assert(false, u8"Ω"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\u1234"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error 3{{hex escape sequence out of range}}
 
 template struct AlwaysFails {
   // Only give one error here.
Index: clang/test/Sema/asm.c
===
--- clang/test/Sema/asm.c
+++ clang/test/Sema/asm.c
@@ -37,14 +37,17 @@
   asm ("nop" : "=c" (a) : "r" (no_clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (no_clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
-  asm ("nop" : "=a" (a) : "b" (b) : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}} 
+  asm("nop"
+  : "=a"(a)
+  : "b"(b)
+  : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
 }
 
 // rdar://6094010
 void test3() {
   int x;
-  asm(L"foo" : "=r"(x)); // expected-error {{wide string}}
-  asm("foo" : L"=r"(x)); // expected-error {{wide string}}
+  asm(L"foo" : "=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+  asm("foo" : L"=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 }
 
 // 
Index: clang/test/Parser/attr-availability.c
===
--- clang/test/Parser/attr-availability.c
+++ clang/test/Parser/attr-availability.c
@@ -20,15 +20,18 @@
 
 void f7() __attribute__((availability(macosx,message=L"wide"))); // expected-error {{expected string literal for optional message in 'availability' attribute}}
 
-void f8() __attribute__((availability(macosx,message="a" L"b"))); // expected-error {{expected string literal for optional message in 'availability' attribute}}
+void f8() __attribute__((availability(macosx, message = "a"
+L"b"))); // expected-error

[PATCH] D105421: [analyzer] Handle << operator for std::unique_ptr

2021-07-10 Thread Deep Majumder via Phabricator via cfe-commits
RedDocMD updated this revision to Diff 357724.
RedDocMD added a comment.

Little refactors, one more test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105421

Files:
  clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
  clang/test/Analysis/Inputs/system-header-simulator-cxx.h
  clang/test/Analysis/smart-ptr.cpp

Index: clang/test/Analysis/smart-ptr.cpp
===
--- clang/test/Analysis/smart-ptr.cpp
+++ clang/test/Analysis/smart-ptr.cpp
@@ -3,6 +3,11 @@
 // RUN:   -analyzer-config cplusplus.SmartPtrModeling:ModelSmartPtrDereference=true\
 // RUN:   -std=c++11 -verify %s
 
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection\
+// RUN:   -analyzer-checker cplusplus.Move,alpha.cplusplus.SmartPtr\
+// RUN:   -analyzer-config cplusplus.SmartPtrModeling:ModelSmartPtrDereference=true\
+// RUN:   -std=c++20 -verify %s
+
 #include "Inputs/system-header-simulator-cxx.h"
 
 void clang_analyzer_warnIfReached();
@@ -457,3 +462,28 @@
 P->foo(); // expected-warning {{Dereference of null smart pointer 'P' [alpha.cplusplus.SmartPtr]}}
   }
 }
+
+#if __cplusplus >= 202002L
+
+void testOstreamOverload(std::unique_ptr P) {
+  auto &Cout = std::cout;
+  auto &PtrCout = std::cout << P;
+  auto &StringCout = std::cout << "hello";
+  // We are testing the fact that in our modelling of
+  // operator<<(basic_ostream &, const unique_ptr &)
+  // we set the return SVal to the SVal of the ostream arg.
+  clang_analyzer_eval(&Cout == &PtrCout);// expected-warning {{TRUE}}
+  // FIXME: Technically, they should be equal,
+  // that hasn't been modelled yet.
+  clang_analyzer_eval(&Cout == &StringCout); // expected-warning {{UNKNOWN}}
+}
+
+int glob;
+void testOstreamDoesntInvalidateGlobals(std::unique_ptr P) {
+  int x = glob;
+  std::cout << P;
+  int y = glob;
+  clang_analyzer_eval(x == y); // expected-warning {{TRUE}}
+}
+
+#endif
Index: clang/test/Analysis/Inputs/system-header-simulator-cxx.h
===
--- clang/test/Analysis/Inputs/system-header-simulator-cxx.h
+++ clang/test/Analysis/Inputs/system-header-simulator-cxx.h
@@ -981,6 +981,22 @@
 } // namespace std
 #endif
 
+namespace std {
+template 
+class basic_ostream;
+
+using ostream = basic_ostream;
+
+extern std::ostream cout;
+
+ostream &operator<<(ostream &, const string &);
+
+#if __cplusplus >= 202002L
+template 
+ostream &operator<<(ostream &, const std::unique_ptr &);
+#endif
+} // namespace std
+
 #ifdef TEST_INLINABLE_ALLOCATORS
 namespace std {
   void *malloc(size_t);
Index: clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
+++ clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
@@ -68,6 +68,7 @@
   bool updateMovedSmartPointers(CheckerContext &C, const MemRegion *ThisRegion,
 const MemRegion *OtherSmartPtrRegion) const;
   void handleBoolConversion(const CallEvent &Call, CheckerContext &C) const;
+  bool handleOstreamOperator(const CallEvent &Call, CheckerContext &C) const;
 
   using SmartPtrMethodHandlerFn =
   void (SmartPtrModeling::*)(const CallEvent &Call, CheckerContext &) const;
@@ -81,6 +82,31 @@
 
 REGISTER_MAP_WITH_PROGRAMSTATE(TrackedRegionMap, const MemRegion *, SVal)
 
+// Checks if RD has name in Names and is in std namespace
+static bool hasStdClassWithName(const CXXRecordDecl *RD,
+const ArrayRef &Names) {
+  if (!RD || !RD->getDeclContext()->isStdNamespace())
+return false;
+  if (RD->getDeclName().isIdentifier()) {
+StringRef Name = RD->getName();
+return llvm::any_of(Names, [&Name](StringRef GivenName) -> bool {
+  return Name == GivenName;
+});
+  }
+  return false;
+}
+
+constexpr llvm::StringLiteral STD_PTR_NAMES[] = {"shared_ptr", "unique_ptr",
+ "weak_ptr"};
+
+static bool isStdSmartPtr(const CXXRecordDecl *RD) {
+  return hasStdClassWithName(RD, {STD_PTR_NAMES, 3});
+}
+
+static bool isStdSmartPtr(const Expr *E) {
+  return isStdSmartPtr(E->getType()->getAsCXXRecordDecl());
+}
+
 // Define the inter-checker API.
 namespace clang {
 namespace ento {
@@ -89,16 +115,7 @@
   const auto *MethodDecl = dyn_cast_or_null(Call.getDecl());
   if (!MethodDecl || !MethodDecl->getParent())
 return false;
-
-  const auto *RecordDecl = MethodDecl->getParent();
-  if (!RecordDecl || !RecordDecl->getDeclContext()->isStdNamespace())
-return false;
-
-  if (RecordDecl->getDeclName().isIdentifier()) {
-StringRef Name = RecordDecl->getName();
-return Name == "shared_ptr" || Name == "unique_ptr" || Name == "weak_ptr";
-  }
-  return false;
+  return isStdSmartPtr(MethodDecl->getParent());
 }
 
 bool isNullSmartPtr(const ProgramStateRef State, const

[PATCH] D105666: [PowerPC] [Altivec] Use signed comparison for vec_all_* and vec_any_* interfaces that compare vector bool types with vector signed types

2021-07-10 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai accepted this revision.
nemanjai added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105666

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


[PATCH] D105501: [PowerPC] Power ISA features for Semachecking

2021-07-10 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai added inline comments.



Comment at: clang/lib/Sema/SemaChecking.cpp:3275
 
-static bool SemaFeatureCheck(Sema &S, CallExpr *TheCall,
- StringRef FeatureToCheck, unsigned DiagID) {
+static bool SemaArchFeatureCheck(Sema &S, CallExpr *TheCall,
+ StringRef FeatureToCheck, int Arch) {

I don't think we need another function here. Simply passing a `StringRef` 
parameter to the other one that will have a default value of empty should 
suffice. Then if the parameter is non-empty, we push it into the diagnostic.
Something like:
```
if (!S.Context.getTargetInfo().hasFeature(FeatureToCheck)) {
  S.Diag(TheCall->getBeginLoc(), DiagID);
  if (!DiagArg.empty())
Diag << DiagArg;
  Diag << TheCall->getSourceRange();
  return true;
}
```
(keep in mind that I don't know if I've adequately captured how 
`DiagnosticBuilder` works, but something along these lines should be possible). 
Then of course, the calls to this would be with `"7"` rather than `7`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105501

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


[clang] 1d5711c - [OpenMP] Unified entry point for SPMD & generic kernels in the device RTL

2021-07-10 Thread Johannes Doerfert via cfe-commits

Author: Johannes Doerfert
Date: 2021-07-10T12:32:50-05:00
New Revision: 1d5711c3eeb62098b46d4d383f2e849b9756105d

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

LOG: [OpenMP] Unified entry point for SPMD & generic kernels in the device RTL

In the spirit of TRegions [0], this patch provides a simpler and uniform
interface for a kernel to set up the device runtime. The OMPIRBuilder is
used for reuse in Flang. A custom state machine will be generated in the
follow up patch.

The "surplus" threads of the "master warp" will not exit early anymore
so we need to use non-aligned barriers. The new runtime will not have an
extra warp but also require these non-aligned barriers.

[0] https://link.springer.com/chapter/10.1007/978-3-030-28596-8_11

This was in parts extracted from D59319.

Reviewed By: ABataev, JonChesterfield

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

Added: 
openmp/libomptarget/deviceRTLs/common/include/target.h

Modified: 
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
llvm/test/Transforms/OpenMP/replace_globalization.ll
llvm/test/Transforms/OpenMP/single_threaded_execution.ll
openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
openmp/libomptarget/deviceRTLs/common/src/parallel.cu
openmp/libomptarget/deviceRTLs/interface.h
openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu

Removed: 




diff  --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index 965b3f1534d67..1cb367ec71885 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -553,63 +553,6 @@ static llvm::Value *getNVPTXLaneID(CodeGenFunction &CGF) {
"nvptx_lane_id");
 }
 
-/// Get the value of the thread_limit clause in the teams directive.
-/// For the 'generic' execution mode, the runtime encodes thread_limit in
-/// the launch parameters, always starting thread_limit+warpSize threads per
-/// CTA. The threads in the last warp are reserved for master execution.
-/// For the 'spmd' execution mode, all threads in a CTA are part of the team.
-static llvm::Value *getThreadLimit(CodeGenFunction &CGF,
-   bool IsInSPMDExecutionMode = false) {
-  CGBuilderTy &Bld = CGF.Builder;
-  auto &RT = static_cast(CGF.CGM.getOpenMPRuntime());
-  llvm::Value *ThreadLimit = nullptr;
-  if (IsInSPMDExecutionMode)
-ThreadLimit = RT.getGPUNumThreads(CGF);
-  else {
-llvm::Value *GPUNumThreads = RT.getGPUNumThreads(CGF);
-llvm::Value *GPUWarpSize = RT.getGPUWarpSize(CGF);
-ThreadLimit = Bld.CreateNUWSub(GPUNumThreads, GPUWarpSize, "thread_limit");
-  }
-  assert(ThreadLimit != nullptr && "Expected non-null ThreadLimit");
-  return ThreadLimit;
-}
-
-/// Get the thread id of the OMP master thread.
-/// The master thread id is the first thread (lane) of the last warp in the
-/// GPU block.  Warp size is assumed to be some power of 2.
-/// Thread id is 0 indexed.
-/// E.g: If NumThreads is 33, master id is 32.
-///  If NumThreads is 64, master id is 32.
-///  If NumThreads is 1024, master id is 992.
-static llvm::Value *getMasterThreadID(CodeGenFunction &CGF) {
-  CGBuilderTy &Bld = CGF.Builder;
-  auto &RT = static_cast(CGF.CGM.getOpenMPRuntime());
-  llvm::Value *NumThreads = RT.getGPUNumThreads(CGF);
-  // We assume that the warp size is a power of 2.
-  llvm::Value *Mask = Bld.CreateNUWSub(RT.getGPUWarpSize(CGF), 
Bld.getInt32(1));
-
-  llvm::Value *NumThreadsSubOne = Bld.CreateNUWSub(NumThreads, 
Bld.getInt32(1));
-  return Bld.CreateAnd(NumThreadsSubOne, Bld.CreateNot(Mask), "master_tid");
-}
-
-CGOpenMPRuntimeGPU::WorkerFunctionState::WorkerFunctionState(
-CodeGenModule &CGM, SourceLocation Loc)
-: WorkerFn(nullptr), CGFI(CGM.getTypes().arrangeNullaryFunction()),
-  Loc(Loc) {
-  createWorkerFunction(CGM);
-}
-
-void CGOpenMPRuntimeGPU::WorkerFunctionState::createWorkerFunction(
-CodeGenModule &CGM) {
-  // Create an worker function with no arguments.
-
-  WorkerFn = llvm::Function::Create(
-  CGM.getTypes().GetFunctionType(CGFI), llvm::GlobalValue::InternalLinkage,
-  /*placeholder=*/"_worker", &CGM.getModule());
-  CGM.SetInternalFunctionAttributes(GlobalDecl(), WorkerFn, CGFI);
-  WorkerFn->setDoesNotRecurse();
-}
-
 CGOpenMPRuntimeGPU::ExecutionMode
 CGOpenMPRuntimeGPU::getExecutionMode() const {
   return CurrentExecutionMode;
@@ -1073,23 +1016,19 @@ void CGOpenMPRuntimeGPU::emitNonSPMDKernel(const 
OMPExecutableDirective &D,
   

[PATCH] D101976: [OpenMP] Unified entry point for SPMD & generic kernels in the device RTL

2021-07-10 Thread Johannes Doerfert via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
jdoerfert marked an inline comment as done.
Closed by commit rG1d5711c3eeb6: [OpenMP] Unified entry point for SPMD & 
generic kernels in the device RTL (authored by jdoerfert).

Changed prior to commit:
  https://reviews.llvm.org/D101976?vs=355958&id=357736#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101976

Files:
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
  llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
  llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/lib/Transforms/IPO/OpenMPOpt.cpp
  llvm/test/Transforms/OpenMP/replace_globalization.ll
  llvm/test/Transforms/OpenMP/single_threaded_execution.ll
  openmp/libomptarget/deviceRTLs/common/include/target.h
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/common/src/parallel.cu
  openmp/libomptarget/deviceRTLs/interface.h
  openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu

Index: openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
===
--- openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
+++ openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.cu
@@ -60,7 +60,13 @@
   return Mask;
 }
 
-EXTERN void __kmpc_impl_syncthreads() { __syncthreads(); }
+EXTERN void __kmpc_impl_syncthreads() { 
+  int barrier = 2;
+  asm volatile("barrier.sync %0;"
+   :
+   : "r"(barrier)
+   : "memory");
+}
 
 EXTERN void __kmpc_impl_syncwarp(__kmpc_impl_lanemask_t Mask) {
   __nvvm_bar_warp_sync(Mask);
@@ -75,7 +81,7 @@
   // The named barrier for active parallel threads of a team in an L1 parallel
   // region to synchronize with each other.
   int barrier = 1;
-  asm volatile("bar.sync %0, %1;"
+  asm volatile("barrier.sync %0, %1;"
:
: "r"(barrier), "r"(num_threads)
: "memory");
Index: openmp/libomptarget/deviceRTLs/interface.h
===
--- openmp/libomptarget/deviceRTLs/interface.h
+++ openmp/libomptarget/deviceRTLs/interface.h
@@ -416,11 +416,11 @@
  int32_t cancelVal);
 
 // non standard
-EXTERN void __kmpc_kernel_init(int ThreadLimit, int16_t RequiresOMPRuntime);
-EXTERN void __kmpc_kernel_deinit(int16_t IsOMPRuntimeInitialized);
-EXTERN void __kmpc_spmd_kernel_init(int ThreadLimit,
-int16_t RequiresOMPRuntime);
-EXTERN void __kmpc_spmd_kernel_deinit_v2(int16_t RequiresOMPRuntime);
+EXTERN int32_t __kmpc_target_init(ident_t *Ident, bool IsSPMD,
+ bool UseGenericStateMachine,
+   bool RequiresFullRuntime);
+EXTERN void __kmpc_target_deinit(ident_t *Ident, bool IsSPMD,
+   bool RequiresFullRuntime);
 EXTERN void __kmpc_kernel_prepare_parallel(void *WorkFn);
 EXTERN bool __kmpc_kernel_parallel(void **WorkFn);
 EXTERN void __kmpc_kernel_end_parallel();
Index: openmp/libomptarget/deviceRTLs/common/src/parallel.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/parallel.cu
+++ openmp/libomptarget/deviceRTLs/common/src/parallel.cu
@@ -331,7 +331,7 @@
 (1 + (IsActiveParallelRegion ? OMP_ACTIVE_PARALLEL_LEVEL : 0));
 
   // Master signals work to activate workers.
-  __kmpc_barrier_simple_spmd(nullptr, 0);
+  __kmpc_barrier_simple_spmd(ident, 0);
 
   // OpenMP [2.5, Parallel Construct, p.49]
   // There is an implied barrier at the end of a parallel region. After the
@@ -339,7 +339,7 @@
   // execution of the enclosing task region.
   //
   // The master waits at this barrier until all workers are done.
-  __kmpc_barrier_simple_spmd(nullptr, 0);
+  __kmpc_barrier_simple_spmd(ident, 0);
 
   // Decrement parallel level for non-SPMD warps.
   for (int I = 0; I < NumWarps; ++I)
Index: openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
===
--- openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
+++ openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
@@ -12,6 +12,7 @@
 #pragma omp declare target
 
 #include "common/omptarget.h"
+#include "common/support.h"
 #include "target_impl.h"
 
 
@@ -26,16 +27,18 @@
 // init entry points
 
 
-EXTERN void __kmpc_kernel_init(int ThreadLimit, int16_t RequiresOMPRuntime) {
+static void __kmpc_generic_kernel_init() {
   PRINT(LD_IO, "call to __kmpc_kernel_init with version %f\n",
 OMPTARGET_NVPTX_VERSION);
-  ASSERT0(LT_FUSSY, Requi

[PATCH] D104898: [clang-repl] Allow passing in code as positional arguments.

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

In D104898#2855751 , @hctim wrote:

> Hi, looks like this change caused a regression on the sanitizer buildbots 
> (https://lab.llvm.org/buildbot/#/builders/169/builds/1290/steps/25/logs/stdio).
>  Error copied below for your convenience.
>
> Can be repro'd using the bot instructions at 
> https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild, or 
> (should be possible) by using `cmake -DLLVM_USE_SANITIZER=Address -GNinja && 
> ninja check-clang`.
>
>    TEST 'Clang :: Interpreter/execute.cpp' FAILED 
> 
>   Script:
>   --
>   : 'RUN: at line 1';   
> /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/clang-repl "int i = 
> 10;" 'extern "C" int printf(const char*,...);' 'auto r1 = 
> printf("i = %d\n", i);' | 
> /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck 
> --check-prefix=CHECK-DRIVER 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/test/Interpreter/execute.cpp
>   : 'RUN: at line 8';   cat 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/test/Interpreter/execute.cpp
>  | /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/clang-repl | 
> /b/sanitizer-x86_64-linux-fast/build/llvm_build_asan/bin/FileCheck 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/test/Interpreter/execute.cpp
>   --
>   Exit Code: 1
>   Command Output (stderr):
>   --
>   =
>   ==67042==ERROR: LeakSanitizer: detected memory leaks
>   Direct leak of 3384 byte(s) in 3 object(s) allocated from:
>   #0 0x44fbefd in operator new(unsigned long) 
> /b/s/w/ir/cache/builder/src/third_party/llvm/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
>   #1 0x4bb65ad in 
> llvm::RegisterTargetMachine::Allocator(llvm::Target 
> const&, llvm::Triple const&, llvm::StringRef, llvm::StringRef, 
> llvm::TargetOptions const&, llvm::Optional, 
> llvm::Optional, llvm::CodeGenOpt::Level, bool) 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/Support/TargetRegistry.h:1209:12
>   #2 0x6acad7f in createTargetMachine 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/Support/TargetRegistry.h:429:12
>   #3 0x6acad7f in (anonymous 
> namespace)::EmitAssemblyHelper::CreateTargetMachine(bool) 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:907:23
>   #4 0x6ab5a43 in (anonymous 
> namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
>  std::__1::unique_ptr std::__1::default_delete >) 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1195:3
>   #5 0x6aac51b in clang::EmitBackendOutput(clang::DiagnosticsEngine&, 
> clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, 
> clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, 
> llvm::Module*, clang::BackendAction, 
> std::__1::unique_ptr std::__1::default_delete >) 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1654:15
>   #6 0x6aa0610 in 
> clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:334:7
>   #7 0x59ba3bf in clang::IncrementalParser::ParseOrWrapTopLevelDecl() 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Interpreter/IncrementalParser.cpp:177:13
>   #8 0x59bc084 in clang::IncrementalParser::Parse(llvm::StringRef) 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Interpreter/IncrementalParser.cpp:227:27
>   #9 0x585dd64 in clang::Interpreter::Parse(llvm::StringRef) 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Interpreter/Interpreter.cpp:202:22
>   #10 0x4501f45 in clang::Interpreter::ParseAndExecute(llvm::StringRef) 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/include/clang/Interpreter/Interpreter.h:61:29
>   #11 0x4500605 in main 
> /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/tools/clang-repl/ClangRepl.cpp:95:30
>   #12 0x7f625d26909a in __libc_start_main 
> (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

Thanks @hctim!

I can reproduce the issue and I have a fix but I do not understand it:

  diff
  diff --git a/clang/test/Interpreter/execute.cpp 
b/clang/test/Interpreter/execute.cpp
  index 730796bd4016..298046c068c3 100644
  --- a/clang/test/Interpreter/execute.cpp
  +++ b/clang/test/Interpreter/execute.cpp
  @@ -2,11 +2,8 @@
   // RUN:'auto r1 = printf("i = %d\n", i);' | FileCheck 
--check-prefix=CHECK-DRIVER %s
   // REQUIRES: host-supports-jit
   // UNSUPPORTED: system-aix
  -
   // CHECK-DRIVER: i = 10
  -
   // RUN: cat %s | clang-repl | FileCheck %s
  -
   extern "C" int printf(const char *, ...);
   int i = 42;
   auto r1 = printf("i = %d\n", i);
  @@ -16,5 +13,4 @@ struct S { float f = 1.0; S *m

[PATCH] D105759: [WIP] Implement P2361 Unevaluated string literals

2021-07-10 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 357741.
cor3ntin added a comment.

Fix asserts firing


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

Files:
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/PPDirectives.cpp
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/Parser.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/test/CXX/dcl.dcl/dcl.link/p2.cpp
  clang/test/CXX/dcl.dcl/p4-0x.cpp
  clang/test/FixIt/fixit-static-assert.cpp
  clang/test/Parser/asm.c
  clang/test/Parser/asm.cpp
  clang/test/Parser/attr-availability.c
  clang/test/Sema/asm.c
  clang/test/SemaCXX/static-assert.cpp

Index: clang/test/SemaCXX/static-assert.cpp
===
--- clang/test/SemaCXX/static-assert.cpp
+++ clang/test/SemaCXX/static-assert.cpp
@@ -28,12 +28,12 @@
 S s1; // expected-note {{in instantiation of template class 'S' requested here}}
 S s2;
 
-static_assert(false, L"\x"); // expected-error {{static_assert failed L"\x"}}
-static_assert(false, u"\U000317FF"); // expected-error {{static_assert failed u"\U000317FF"}}
+static_assert(false, L"\x"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error {{hex escape sequence out of range}}
+static_assert(false, u"\U000317FF"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 // FIXME: render this as u8"\u03A9"
-static_assert(false, u8"Ω"); // expected-error {{static_assert failed u8"\316\251"}}
-static_assert(false, L"\u1234"); // expected-error {{static_assert failed L"\x1234"}}
-static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{static_assert failed L"\x1FF""0\x123""fx\xFgoop"}}
+static_assert(false, u8"Ω"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\u1234"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error 3{{hex escape sequence out of range}}
 
 template struct AlwaysFails {
   // Only give one error here.
Index: clang/test/Sema/asm.c
===
--- clang/test/Sema/asm.c
+++ clang/test/Sema/asm.c
@@ -37,14 +37,17 @@
   asm ("nop" : "=c" (a) : "r" (no_clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (no_clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
-  asm ("nop" : "=a" (a) : "b" (b) : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}} 
+  asm("nop"
+  : "=a"(a)
+  : "b"(b)
+  : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
 }
 
 // rdar://6094010
 void test3() {
   int x;
-  asm(L"foo" : "=r"(x)); // expected-error {{wide string}}
-  asm("foo" : L"=r"(x)); // expected-error {{wide string}}
+  asm(L"foo" : "=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+  asm("foo" : L"=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 }
 
 // 
Index: clang/test/Parser/attr-availability.c
===
--- clang/test/Parser/attr-availability.c
+++ clang/test/Parser/attr-availability.c
@@ -20,15 +20,18 @@
 
 void f7() __attribute__((availability(macosx,message=L"wide"))); // expected-error {{expected string literal for optional message in 'availability' attribute}}
 
-void f8() __attribute__((availability(macosx,message="a" L"b"))); // expected-error {{expected string literal for optional message in 'availability' attribute}}
+void f8() __attribute__((availability(macosx, message = "a"
+L"b"))); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 
 void f9

[clang] f01d45c - Reland "[clang-repl] Allow passing in code as positional arguments."

2021-07-10 Thread Vassil Vassilev via cfe-commits

Author: Vassil Vassilev
Date: 2021-07-10T17:54:00Z
New Revision: f01d45c378cd0271e279d971c79d6e4900f045e0

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

LOG: Reland "[clang-repl] Allow passing in code as positional arguments."

This reverts commit 3ec88ca60b24 which reverted e386871e1d21 due to a asan build
failure.

This patch removes the new lines in the test case which seem to introduce the
failure.

Differential revision: https://reviews.llvm.org/D104898

Added: 


Modified: 
clang/test/Interpreter/execute.cpp
clang/tools/clang-repl/ClangRepl.cpp

Removed: 




diff  --git a/clang/test/Interpreter/execute.cpp 
b/clang/test/Interpreter/execute.cpp
index 108b79b23a59..298046c068c3 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -1,7 +1,9 @@
-// RUN: cat %s | clang-repl | FileCheck %s
+// RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \
+// RUN:'auto r1 = printf("i = %d\n", i);' | FileCheck 
--check-prefix=CHECK-DRIVER %s
 // REQUIRES: host-supports-jit
 // UNSUPPORTED: system-aix
-
+// CHECK-DRIVER: i = 10
+// RUN: cat %s | clang-repl | FileCheck %s
 extern "C" int printf(const char *, ...);
 int i = 42;
 auto r1 = printf("i = %d\n", i);
@@ -11,5 +13,4 @@ struct S { float f = 1.0; S *m = nullptr;} s;
 
 auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, reinterpret_cast(s.m));
 // CHECK-NEXT: S[f=1.00, m=0x0]
-
 quit

diff  --git a/clang/tools/clang-repl/ClangRepl.cpp 
b/clang/tools/clang-repl/ClangRepl.cpp
index b5b5bf6e0c6b..ba6bb11abc86 100644
--- a/clang/tools/clang-repl/ClangRepl.cpp
+++ b/clang/tools/clang-repl/ClangRepl.cpp
@@ -28,6 +28,9 @@ static llvm::cl::list
   llvm::cl::CommaSeparated);
 static llvm::cl::opt OptHostSupportsJit("host-supports-jit",
   llvm::cl::Hidden);
+static llvm::cl::list OptInputs(llvm::cl::Positional,
+ llvm::cl::ZeroOrMore,
+ llvm::cl::desc("[code to run]"));
 
 static void LLVMErrorHandler(void *UserData, const std::string &Message,
  bool GenCrashDiag) {
@@ -78,15 +81,22 @@ int main(int argc, const char **argv) {
 static_cast(&CI->getDiagnostics()));
 
   auto Interp = ExitOnErr(clang::Interpreter::create(std::move(CI)));
-  llvm::LineEditor LE("clang-repl");
-  // FIXME: Add LE.setListCompleter
-  while (llvm::Optional Line = LE.readLine()) {
-if (*Line == "quit")
-  break;
-if (auto Err = Interp->ParseAndExecute(*Line))
+  for (const std::string &input : OptInputs) {
+if (auto Err = Interp->ParseAndExecute(input))
   llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
   }
 
+  if (OptInputs.empty()) {
+llvm::LineEditor LE("clang-repl");
+// FIXME: Add LE.setListCompleter
+while (llvm::Optional Line = LE.readLine()) {
+  if (*Line == "quit")
+break;
+  if (auto Err = Interp->ParseAndExecute(*Line))
+llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), "error: ");
+}
+  }
+
   // Our error handler depends on the Diagnostics object, which we're
   // potentially about to delete. Uninstall the handler now so that any
   // later errors use the default handling behavior instead.



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


[PATCH] D105759: [WIP] Implement P2361 Unevaluated string literals

2021-07-10 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 357746.
cor3ntin added a comment.
Herald added a project: clang-tools-extra.

Fix tests, windows compilation, formatting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

Files:
  clang-tools-extra/test/clang-tidy/checkers/modernize-unary-static-assert.cpp
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/PPDirectives.cpp
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/Parser.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/test/CXX/dcl.dcl/dcl.link/p2.cpp
  clang/test/CXX/dcl.dcl/p4-0x.cpp
  clang/test/FixIt/fixit-static-assert.cpp
  clang/test/Parser/asm.c
  clang/test/Parser/asm.cpp
  clang/test/Parser/attr-availability-xcore.c
  clang/test/Parser/attr-availability.c
  clang/test/Sema/asm.c
  clang/test/SemaCXX/static-assert.cpp

Index: clang/test/SemaCXX/static-assert.cpp
===
--- clang/test/SemaCXX/static-assert.cpp
+++ clang/test/SemaCXX/static-assert.cpp
@@ -28,12 +28,12 @@
 S s1; // expected-note {{in instantiation of template class 'S' requested here}}
 S s2;
 
-static_assert(false, L"\x"); // expected-error {{static_assert failed L"\x"}}
-static_assert(false, u"\U000317FF"); // expected-error {{static_assert failed u"\U000317FF"}}
+static_assert(false, L"\x"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error {{hex escape sequence out of range}}
+static_assert(false, u"\U000317FF"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 // FIXME: render this as u8"\u03A9"
-static_assert(false, u8"Ω"); // expected-error {{static_assert failed u8"\316\251"}}
-static_assert(false, L"\u1234"); // expected-error {{static_assert failed L"\x1234"}}
-static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{static_assert failed L"\x1FF""0\x123""fx\xFgoop"}}
+static_assert(false, u8"Ω"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\u1234"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error 3{{hex escape sequence out of range}}
 
 template struct AlwaysFails {
   // Only give one error here.
Index: clang/test/Sema/asm.c
===
--- clang/test/Sema/asm.c
+++ clang/test/Sema/asm.c
@@ -37,14 +37,17 @@
   asm ("nop" : "=c" (a) : "r" (no_clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (no_clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
-  asm ("nop" : "=a" (a) : "b" (b) : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}} 
+  asm("nop"
+  : "=a"(a)
+  : "b"(b)
+  : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
 }
 
 // rdar://6094010
 void test3() {
   int x;
-  asm(L"foo" : "=r"(x)); // expected-error {{wide string}}
-  asm("foo" : L"=r"(x)); // expected-error {{wide string}}
+  asm(L"foo" : "=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+  asm("foo" : L"=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 }
 
 // 
Index: clang/test/Parser/attr-availability.c
===
--- clang/test/Parser/attr-availability.c
+++ clang/test/Parser/attr-availability.c
@@ -20,15 +20,18 @@
 
 void f7() __attribute__((availability(macosx,message=L"wide"))); // expected-error {{expected string literal for optional message in 'availability' attribute}}
 
-void f8() __attribute__((availability(macosx,message="a" L"b"))); // expected-error {{expected string literal for optional message in 'availability' attribute}}
+void f8() __attribute__((av

[PATCH] D103929: [clang] P2085R0: Consistent defaulted comparisons

2021-07-10 Thread Alexandru Octavian Buțiu via Phabricator via cfe-commits
predator5047 updated this revision to Diff 357747.
predator5047 added a comment.

Addressed  Richard's comments.

Fix handling of friend functions.
Added an error dialog for when enum type are used as params.
Removed define outside of class dialog since it is no longer needed.
Moved tests to p1.cpp and added more tests.


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

https://reviews.llvm.org/D103929

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -996,7 +996,7 @@
   
   
 https://wg21.link/p2085r0";>P2085R0
-No
+Clang 13
   
 
   Access checking on specializations
Index: clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
===
--- clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
+++ clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
@@ -1,8 +1,6 @@
 // RUN: %clang_cc1 -std=c++2a -verify %s
 
 struct B {};
-bool operator==(const B&, const B&) = default; // expected-error {{equality comparison operator can only be defaulted in a class definition}} expected-note {{candidate}}
-bool operator<=>(const B&, const B&) = default; // expected-error {{three-way comparison operator can only be defaulted in a class definition}}
 
 template
   bool operator<(const B&, const B&) = default; // expected-error {{comparison operator template cannot be defaulted}}
@@ -29,11 +27,6 @@
 bool operator==(const A&) const = default; // expected-error {{comparison operator template cannot be defaulted}}
 };
 
-// FIXME: The wording is not clear as to whether these are valid, but the
-// intention is that they are not.
-bool operator<(const A&, const A&) = default; // expected-error {{relational comparison operator can only be defaulted in a class definition}}
-bool A::operator<(const A&) const = default; // expected-error {{can only be defaulted in a class definition}}
-
 template struct Dependent {
   using U = typename T::type;
   bool operator==(U) const = default; // expected-error {{found 'Dependent::U'}}
@@ -132,3 +125,98 @@
 friend bool operator==(const B&, const B&) = default; // expected-warning {{deleted}}
   };
 }
+
+namespace P2085 {
+
+// Test defaulted ref params
+struct A {
+  bool operator==(const A &) const;
+  friend bool operator!=(const A &, const A &);
+};
+
+bool A::operator==(const A &) const = default;
+bool operator!=(const A &, const A &) = default;
+
+// Test defaulted value params
+
+struct B {
+  friend bool operator==(B, B);
+  bool operator==(B) const;
+};
+bool operator==(B, B) = default;
+
+bool B::operator==(B) const = default; // expected-error {{invalid parameter type for defaulted equality comparison operator; found 'P2085::B', expected 'const P2085::B &'}}
+
+// Test for friend of C but not friend of A
+struct C {
+  friend bool operator==(const A &, const A &);
+};
+bool operator==(const A &, const A &) = default; //  expected-error {{defaulted 'operator==' is not a friend of 'P2085::A'}}
+
+struct D {
+  struct E {
+bool operator==(const E &) const = default;
+friend bool operator!=(const E &, const E &);
+  };
+};
+
+bool operator!=(const D::E &, const D::E &) = default;
+
+template 
+struct F {
+  T __Ignore;
+  bool operator==(const F &) const = default;
+  friend bool operator!=(const F &, const F &);
+};
+
+const bool R0 = F{} == F{};
+
+template 
+bool operator!=(const F &, const F &) = default; // expected-error {{comparison operator template cannot be defaulted}}
+
+struct G {
+};
+
+bool operator!=(const G &, const G &) = default; // expected-error  {{defaulted 'operator!=' is not a friend of 'P2085::G'}}
+
+enum foo { a,
+   b };
+
+struct H {
+  bool operator==(foo) const;
+};
+
+bool H::operator==(foo) const = default; //expected-error {{invalid parameter type for defaulted equality comparison operator; found 'P2085::foo', expected 'const P2085::H &'}}
+
+struct K {
+  friend bool operator==(foo, K);
+  friend bool operator==(K, foo);
+};
+
+bool operator==(foo, K) = default;   //expected-error {{parameters for defaulted equality comparison operator must have the same type (found 'P2085::foo' vs 'P2085::K')}}
+bool operator==(K, foo) = default;   //expected-error {{parameters for defaulted equality comparison operator must have the same type (found 'P2085::K' vs 'P2085::foo')}}
+bool operator==(foo, foo) = default; //expected-error {{argument 'P2085::foo' is not of class type}}
+bool operator==(const foo &, const foo &) = default; //expected-error {{argument 'const P2085::foo &' is not of class type}}
+
+s

[PATCH] D103929: [clang] P2085R0: Consistent defaulted comparisons

2021-07-10 Thread Alexandru Octavian Buțiu via Phabricator via cfe-commits
predator5047 added a comment.

Regarding

  struct A;
  bool operator==(A, A);
  struct A {
friend bool operator==(A, A) = default; // error, not first declaration
  };

GCC and msvc have marked P2085R0 as complete and do not implement this rule 
should I  implement it anyway? 
I don't know if clang  would rather adhere to the spec or do the same as  gcc 
and msvc.
https://godbolt.org/z/nhbTWs5of


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

https://reviews.llvm.org/D103929

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


[PATCH] D103929: [clang] P2085R0: Consistent defaulted comparisons

2021-07-10 Thread Alexandru Octavian Buțiu via Phabricator via cfe-commits
predator5047 updated this revision to Diff 357755.
predator5047 added a comment.

Fix clang-tidy warning


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

https://reviews.llvm.org/D103929

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -996,7 +996,7 @@
   
   
 https://wg21.link/p2085r0";>P2085R0
-No
+Clang 13
   
 
   Access checking on specializations
Index: clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
===
--- clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
+++ clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
@@ -1,8 +1,6 @@
 // RUN: %clang_cc1 -std=c++2a -verify %s
 
 struct B {};
-bool operator==(const B&, const B&) = default; // expected-error {{equality comparison operator can only be defaulted in a class definition}} expected-note {{candidate}}
-bool operator<=>(const B&, const B&) = default; // expected-error {{three-way comparison operator can only be defaulted in a class definition}}
 
 template
   bool operator<(const B&, const B&) = default; // expected-error {{comparison operator template cannot be defaulted}}
@@ -29,11 +27,6 @@
 bool operator==(const A&) const = default; // expected-error {{comparison operator template cannot be defaulted}}
 };
 
-// FIXME: The wording is not clear as to whether these are valid, but the
-// intention is that they are not.
-bool operator<(const A&, const A&) = default; // expected-error {{relational comparison operator can only be defaulted in a class definition}}
-bool A::operator<(const A&) const = default; // expected-error {{can only be defaulted in a class definition}}
-
 template struct Dependent {
   using U = typename T::type;
   bool operator==(U) const = default; // expected-error {{found 'Dependent::U'}}
@@ -132,3 +125,98 @@
 friend bool operator==(const B&, const B&) = default; // expected-warning {{deleted}}
   };
 }
+
+namespace P2085 {
+
+// Test defaulted ref params
+struct A {
+  bool operator==(const A &) const;
+  friend bool operator!=(const A &, const A &);
+};
+
+bool A::operator==(const A &) const = default;
+bool operator!=(const A &, const A &) = default;
+
+// Test defaulted value params
+
+struct B {
+  friend bool operator==(B, B);
+  bool operator==(B) const;
+};
+bool operator==(B, B) = default;
+
+bool B::operator==(B) const = default; // expected-error {{invalid parameter type for defaulted equality comparison operator; found 'P2085::B', expected 'const P2085::B &'}}
+
+// Test for friend of C but not friend of A
+struct C {
+  friend bool operator==(const A &, const A &);
+};
+bool operator==(const A &, const A &) = default; //  expected-error {{defaulted 'operator==' is not a friend of 'P2085::A'}}
+
+struct D {
+  struct E {
+bool operator==(const E &) const = default;
+friend bool operator!=(const E &, const E &);
+  };
+};
+
+bool operator!=(const D::E &, const D::E &) = default;
+
+template 
+struct F {
+  T __Ignore;
+  bool operator==(const F &) const = default;
+  friend bool operator!=(const F &, const F &);
+};
+
+const bool R0 = F{} == F{};
+
+template 
+bool operator!=(const F &, const F &) = default; // expected-error {{comparison operator template cannot be defaulted}}
+
+struct G {
+};
+
+bool operator!=(const G &, const G &) = default; // expected-error  {{defaulted 'operator!=' is not a friend of 'P2085::G'}}
+
+enum foo { a,
+   b };
+
+struct H {
+  bool operator==(foo) const;
+};
+
+bool H::operator==(foo) const = default; //expected-error {{invalid parameter type for defaulted equality comparison operator; found 'P2085::foo', expected 'const P2085::H &'}}
+
+struct K {
+  friend bool operator==(foo, K);
+  friend bool operator==(K, foo);
+};
+
+bool operator==(foo, K) = default;   //expected-error {{parameters for defaulted equality comparison operator must have the same type (found 'P2085::foo' vs 'P2085::K')}}
+bool operator==(K, foo) = default;   //expected-error {{parameters for defaulted equality comparison operator must have the same type (found 'P2085::K' vs 'P2085::foo')}}
+bool operator==(foo, foo) = default; //expected-error {{argument 'P2085::foo' is not of class type}}
+bool operator==(const foo &, const foo &) = default; //expected-error {{argument 'const P2085::foo &' is not of class type}}
+
+struct L {
+
+  bool operator==(const A &) const;
+  int operator<=>(const A &) const;
+};
+
+bool L::operator==(const A &) const = default; //expected-error {{invalid parameter type for defaulted equality comparison o

[PATCH] D103929: [clang] P2085R0: Consistent defaulted comparisons

2021-07-10 Thread Alexandru Octavian Buțiu via Phabricator via cfe-commits
predator5047 updated this revision to Diff 357756.
predator5047 added a comment.

Fix clang-tidy formatting


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

https://reviews.llvm.org/D103929

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -996,7 +996,7 @@
   
   
 https://wg21.link/p2085r0";>P2085R0
-No
+Clang 13
   
 
   Access checking on specializations
Index: clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
===
--- clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
+++ clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
@@ -1,8 +1,6 @@
 // RUN: %clang_cc1 -std=c++2a -verify %s
 
 struct B {};
-bool operator==(const B&, const B&) = default; // expected-error {{equality comparison operator can only be defaulted in a class definition}} expected-note {{candidate}}
-bool operator<=>(const B&, const B&) = default; // expected-error {{three-way comparison operator can only be defaulted in a class definition}}
 
 template
   bool operator<(const B&, const B&) = default; // expected-error {{comparison operator template cannot be defaulted}}
@@ -29,11 +27,6 @@
 bool operator==(const A&) const = default; // expected-error {{comparison operator template cannot be defaulted}}
 };
 
-// FIXME: The wording is not clear as to whether these are valid, but the
-// intention is that they are not.
-bool operator<(const A&, const A&) = default; // expected-error {{relational comparison operator can only be defaulted in a class definition}}
-bool A::operator<(const A&) const = default; // expected-error {{can only be defaulted in a class definition}}
-
 template struct Dependent {
   using U = typename T::type;
   bool operator==(U) const = default; // expected-error {{found 'Dependent::U'}}
@@ -132,3 +125,98 @@
 friend bool operator==(const B&, const B&) = default; // expected-warning {{deleted}}
   };
 }
+
+namespace P2085 {
+
+// Test defaulted ref params
+struct A {
+  bool operator==(const A &) const;
+  friend bool operator!=(const A &, const A &);
+};
+
+bool A::operator==(const A &) const = default;
+bool operator!=(const A &, const A &) = default;
+
+// Test defaulted value params
+
+struct B {
+  friend bool operator==(B, B);
+  bool operator==(B) const;
+};
+bool operator==(B, B) = default;
+
+bool B::operator==(B) const = default; // expected-error {{invalid parameter type for defaulted equality comparison operator; found 'P2085::B', expected 'const P2085::B &'}}
+
+// Test for friend of C but not friend of A
+struct C {
+  friend bool operator==(const A &, const A &);
+};
+bool operator==(const A &, const A &) = default; //  expected-error {{defaulted 'operator==' is not a friend of 'P2085::A'}}
+
+struct D {
+  struct E {
+bool operator==(const E &) const = default;
+friend bool operator!=(const E &, const E &);
+  };
+};
+
+bool operator!=(const D::E &, const D::E &) = default;
+
+template 
+struct F {
+  T __Ignore;
+  bool operator==(const F &) const = default;
+  friend bool operator!=(const F &, const F &);
+};
+
+const bool R0 = F{} == F{};
+
+template 
+bool operator!=(const F &, const F &) = default; // expected-error {{comparison operator template cannot be defaulted}}
+
+struct G {
+};
+
+bool operator!=(const G &, const G &) = default; // expected-error  {{defaulted 'operator!=' is not a friend of 'P2085::G'}}
+
+enum foo { a,
+   b };
+
+struct H {
+  bool operator==(foo) const;
+};
+
+bool H::operator==(foo) const = default; //expected-error {{invalid parameter type for defaulted equality comparison operator; found 'P2085::foo', expected 'const P2085::H &'}}
+
+struct K {
+  friend bool operator==(foo, K);
+  friend bool operator==(K, foo);
+};
+
+bool operator==(foo, K) = default;   //expected-error {{parameters for defaulted equality comparison operator must have the same type (found 'P2085::foo' vs 'P2085::K')}}
+bool operator==(K, foo) = default;   //expected-error {{parameters for defaulted equality comparison operator must have the same type (found 'P2085::K' vs 'P2085::foo')}}
+bool operator==(foo, foo) = default; //expected-error {{argument 'P2085::foo' is not of class type}}
+bool operator==(const foo &, const foo &) = default; //expected-error {{argument 'const P2085::foo &' is not of class type}}
+
+struct L {
+
+  bool operator==(const A &) const;
+  int operator<=>(const A &) const;
+};
+
+bool L::operator==(const A &) const = default; //expected-error {{invalid parameter type for defaulted equality compariso

[PATCH] D105756: [clang] C++98 implicit moves are back with a vengeance

2021-07-10 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov created this revision.
mizvekov edited the summary of this revision.
mizvekov edited the summary of this revision.
mizvekov edited the summary of this revision.
mizvekov updated this revision to Diff 357688.
mizvekov added a comment.
mizvekov updated this revision to Diff 357692.
mizvekov updated this revision to Diff 357693.
mizvekov updated this revision to Diff 357748.
mizvekov edited the summary of this revision.
mizvekov added a reviewer: rsmith.
mizvekov added subscribers: Quuxplusone, jyknight, ldionne.
mizvekov published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

clang-tidy.


mizvekov added a comment.

.


mizvekov added a comment.

.


mizvekov added a comment.

.


After taking C++98 implicit moves out in D104500 
,
we put it back in, but now in a new form which preserves
compatibility with pure C++98 programs, while at the same time
giving almost all the goodies from P1825 .

- We use the exact same rules as C++20 with regards to which id-expressions are 
move eligible. The previous incarnation would only benefit from the proper 
subset which is copy ellidable. This means we can implicit move, in addition:
  - Parameters.
  - RValue references.
  - Exception variables.
  - Variables with higher-than-natural required alignment.
- We preserve the two-overload resolution, with one small tweak to the first 
one: If we either pick a (possibly converting) constructor which does not take 
an rvalue reference, or a user conversion which is not ref-qualified, we abort 
into the second overload resolution.

This gives C++98 almost all the implicit move patterns which we had created test
cases for, while at the same time preserving the meaning of these
three patterns, which are found in pure C++98 programs:

- Classes with both const and non-const copy constructors, but no move 
constructors, continue to have their non-const copy constructor selected.
- We continue to reject as ambiguous the following pattern:

  struct A { A(B &) = delete; };
  struct B { operator A(); };
  A foo(B x) { return x; }

- We continue to pick the copy constructor in the following pattern:

  class AutoPtrRef { };
  struct AutoPtr {
AutoPtr(AutoPtr &);
AutoPtr();
  
AutoPtr(AutoPtrRef);
operator AutoPtrRef();
  };
  AutoPtr test_auto_ptr() {
AutoPtr p;
return p;
  }

Signed-off-by: Matheus Izvekov 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105756

Files:
  clang/lib/Sema/SemaStmt.cpp
  clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
  clang/test/SemaCXX/conversion-function.cpp
  clang/test/SemaObjCXX/block-capture.mm

Index: clang/test/SemaObjCXX/block-capture.mm
===
--- clang/test/SemaObjCXX/block-capture.mm
+++ clang/test/SemaObjCXX/block-capture.mm
@@ -14,6 +14,10 @@
 };
 TEST(CopyOnly); // cxx2b-error {{no matching constructor}}
 
+// Both ConstCopyOnly and NonConstCopyOnly are
+// "pure" C++98 tests (pretend 'delete' means 'private').
+// However we may extend implicit moves into C++98, we must make sure the
+// results in these are not changed.
 struct ConstCopyOnly {
   ConstCopyOnly();
   ConstCopyOnly(ConstCopyOnly &) = delete; // cxx98-note {{marked deleted here}}
@@ -31,51 +35,51 @@
 struct CopyNoMove {
   CopyNoMove();
   CopyNoMove(CopyNoMove &);
-  CopyNoMove(CopyNoMove &&) = delete; // cxx11_2b-note {{marked deleted here}}
+  CopyNoMove(CopyNoMove &&) = delete; // cxx98_2b-note {{marked deleted here}}
 };
-TEST(CopyNoMove); // cxx11_2b-error {{call to deleted constructor}}
+TEST(CopyNoMove); // cxx98_2b-error {{call to deleted constructor}}
 
 struct MoveOnly {
   MoveOnly();
-  MoveOnly(MoveOnly &) = delete; // cxx98-note {{marked deleted here}}
+  MoveOnly(MoveOnly &) = delete;
   MoveOnly(MoveOnly &&);
 };
-TEST(MoveOnly); // cxx98-error {{call to deleted constructor}}
+TEST(MoveOnly);
 
 struct NoCopyNoMove {
   NoCopyNoMove();
-  NoCopyNoMove(NoCopyNoMove &) = delete;  // cxx98-note {{marked deleted here}}
-  NoCopyNoMove(NoCopyNoMove &&) = delete; // cxx11_2b-note {{marked deleted here}}
+  NoCopyNoMove(NoCopyNoMove &) = delete;
+  NoCopyNoMove(NoCopyNoMove &&) = delete; // cxx98_2b-note {{marked deleted here}}
 };
 TEST(NoCopyNoMove); // cxx98_2b-error {{call to deleted constructor}}
 
 struct ConvertingRVRef {
   ConvertingRVRef();
-  ConvertingRVRef(ConvertingRVRef &) = delete; // cxx98-note {{marked deleted here}}
+  ConvertingRVRef(ConvertingRVRef &) = delete;
 
   struct X {};
   ConvertingRVRef(X &&);
   operator X() const & = delete;
   operator X() &&;
 };
-TEST(ConvertingRVRef); // cxx98-error {{call to deleted constructor}}
+TEST(ConvertingRVRef);
 
 struct ConvertingCLVRef {
   ConvertingCLVRef();
   ConvertingCLVRef(ConvertingCLVRef &);
 
   struct X {};
-  ConvertingCLVRef(X &&); // cxx11_2b-note {{passing argument to parameter here}}
+  Conver

[PATCH] D104500: [clang] Apply P1825 as Defect Report from C++11 up to C++20.

2021-07-10 Thread Matheus Izvekov via Phabricator via cfe-commits
mizvekov added a comment.

In D104500#2867404 , @ldionne wrote:

> I don't know what the state of those extensions is from Clang's perspective, 
> however one thing is clear - we use those extensions in libc++ very heavily. 
> If any such extension is removed, libc++ will stop working in C++03 mode, 
> which effectively means that most of the code compiled with Clang is going to 
> break. That's a pretty serious problem.

That was not clear from the clang side, we had those extensions as non 
officially supported.
Now since another project under the same umbrella depends on it, it makes sense 
to continue supporting this, at least until we agree on something else.

> So basically, you decided to downright remove the extension because it caused 
> some code to change meaning? However, in doing so, all the code that was 
> previously moving implicitly will now perform a copy instead (unless the copy 
> constructor is deleted, in which case the code breaks, as in libc++). That's 
> a pretty big behavior change. Is that accurate, or am I misunderstanding 
> something?

Well, considering from my perspective, which had those extensions as not 
officially supported and "best effort" only, it would make sense not to provide 
an extension which can break pure C++98 programs.
The options where:

1. DR P1825  down to C++11 as the comittee 
decided, but get almost no benefit from implementation complexity because we 
would still have to keep most of the code around, but this time only for C++98 
(which is not even supposed to have it).
2. Leave C++98 without implicit moves. This gives following benefits:
  - Drop huge amount of code, almost no new code.
  - Pure C++98 programs don't get broken.
  - Less work, I can spend more time doing other things.
3. DR P1825  down to C++98. This gives almost 
all the benefits from the option above, except that has risk of breaking valid 
C++98 code.
4. Invent yet another new implicit move rule.

We tried 2, and failed here.
Number 3 would be cool if we could get away with it, but I don't know if we 
should take the chances.
So I present my take on option 4: https://reviews.llvm.org/D105756


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104500

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


[PATCH] D105759: [WIP] Implement P2361 Unevaluated string literals

2021-07-10 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 357764.
cor3ntin added a comment.

Fix avaibility attribute parsing


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

Files:
  clang-tools-extra/test/clang-tidy/checkers/modernize-unary-static-assert.cpp
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/PPDirectives.cpp
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/Parser.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/test/CXX/dcl.dcl/dcl.link/p2.cpp
  clang/test/CXX/dcl.dcl/p4-0x.cpp
  clang/test/FixIt/fixit-static-assert.cpp
  clang/test/Parser/asm.c
  clang/test/Parser/asm.cpp
  clang/test/Parser/attr-availability-xcore.c
  clang/test/Parser/attr-availability.c
  clang/test/Sema/asm.c
  clang/test/SemaCXX/static-assert.cpp

Index: clang/test/SemaCXX/static-assert.cpp
===
--- clang/test/SemaCXX/static-assert.cpp
+++ clang/test/SemaCXX/static-assert.cpp
@@ -28,12 +28,12 @@
 S s1; // expected-note {{in instantiation of template class 'S' requested here}}
 S s2;
 
-static_assert(false, L"\x"); // expected-error {{static_assert failed L"\x"}}
-static_assert(false, u"\U000317FF"); // expected-error {{static_assert failed u"\U000317FF"}}
+static_assert(false, L"\x"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error {{hex escape sequence out of range}}
+static_assert(false, u"\U000317FF"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 // FIXME: render this as u8"\u03A9"
-static_assert(false, u8"Ω"); // expected-error {{static_assert failed u8"\316\251"}}
-static_assert(false, L"\u1234"); // expected-error {{static_assert failed L"\x1234"}}
-static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{static_assert failed L"\x1FF""0\x123""fx\xFgoop"}}
+static_assert(false, u8"Ω"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\u1234"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error 3{{hex escape sequence out of range}}
 
 template struct AlwaysFails {
   // Only give one error here.
Index: clang/test/Sema/asm.c
===
--- clang/test/Sema/asm.c
+++ clang/test/Sema/asm.c
@@ -37,14 +37,17 @@
   asm ("nop" : "=c" (a) : "r" (no_clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (no_clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
-  asm ("nop" : "=a" (a) : "b" (b) : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}} 
+  asm("nop"
+  : "=a"(a)
+  : "b"(b)
+  : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
 }
 
 // rdar://6094010
 void test3() {
   int x;
-  asm(L"foo" : "=r"(x)); // expected-error {{wide string}}
-  asm("foo" : L"=r"(x)); // expected-error {{wide string}}
+  asm(L"foo" : "=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+  asm("foo" : L"=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 }
 
 // 
Index: clang/test/Parser/attr-availability.c
===
--- clang/test/Parser/attr-availability.c
+++ clang/test/Parser/attr-availability.c
@@ -18,21 +18,24 @@
 
 void f6() __attribute__((availability(macosx,unavailable,introduced=10.5))); // expected-warning{{'unavailable' availability overrides all other availability information}}
 
-void f7() __attribute__((availability(macosx,message=L"wide"))); // expected-error {{expected string literal for optional message in 'availability' attribute}}
+void f7() __attri

[PATCH] D105759: [WIP] Implement P2361 Unevaluated string literals

2021-07-10 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 357765.
cor3ntin added a comment.

clang format


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

Files:
  clang-tools-extra/test/clang-tidy/checkers/modernize-unary-static-assert.cpp
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/Frontend/FrontendAction.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/PPDirectives.cpp
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/Parser.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/lib/Sema/SemaStmtAsm.cpp
  clang/test/CXX/dcl.dcl/dcl.link/p2.cpp
  clang/test/CXX/dcl.dcl/p4-0x.cpp
  clang/test/FixIt/fixit-static-assert.cpp
  clang/test/Parser/asm.c
  clang/test/Parser/asm.cpp
  clang/test/Parser/attr-availability-xcore.c
  clang/test/Parser/attr-availability.c
  clang/test/Sema/asm.c
  clang/test/SemaCXX/static-assert.cpp

Index: clang/test/SemaCXX/static-assert.cpp
===
--- clang/test/SemaCXX/static-assert.cpp
+++ clang/test/SemaCXX/static-assert.cpp
@@ -28,12 +28,12 @@
 S s1; // expected-note {{in instantiation of template class 'S' requested here}}
 S s2;
 
-static_assert(false, L"\x"); // expected-error {{static_assert failed L"\x"}}
-static_assert(false, u"\U000317FF"); // expected-error {{static_assert failed u"\U000317FF"}}
+static_assert(false, L"\x"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error {{hex escape sequence out of range}}
+static_assert(false, u"\U000317FF"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 // FIXME: render this as u8"\u03A9"
-static_assert(false, u8"Ω"); // expected-error {{static_assert failed u8"\316\251"}}
-static_assert(false, L"\u1234"); // expected-error {{static_assert failed L"\x1234"}}
-static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{static_assert failed L"\x1FF""0\x123""fx\xFgoop"}}
+static_assert(false, u8"Ω"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\u1234"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} expected-error 3{{hex escape sequence out of range}}
 
 template struct AlwaysFails {
   // Only give one error here.
Index: clang/test/Sema/asm.c
===
--- clang/test/Sema/asm.c
+++ clang/test/Sema/asm.c
@@ -37,14 +37,17 @@
   asm ("nop" : "=c" (a) : "r" (no_clobber_conflict) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (no_clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
   asm ("nop" : "=r" (clobber_conflict) : "c" (c) : "%rcx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
-  asm ("nop" : "=a" (a) : "b" (b) : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}} 
+  asm("nop"
+  : "=a"(a)
+  : "b"(b)
+  : "%rcx", "%rbx"); // expected-error {{asm-specifier for input or output variable conflicts with asm clobber list}}
 }
 
 // rdar://6094010
 void test3() {
   int x;
-  asm(L"foo" : "=r"(x)); // expected-error {{wide string}}
-  asm("foo" : L"=r"(x)); // expected-error {{wide string}}
+  asm(L"foo" : "=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+  asm("foo" : L"=r"(x)); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
 }
 
 // 
Index: clang/test/Parser/attr-availability.c
===
--- clang/test/Parser/attr-availability.c
+++ clang/test/Parser/attr-availability.c
@@ -18,21 +18,24 @@
 
 void f6() __attribute__((availability(macosx,unavailable,introduced=10.5))); // expected-warning{{'unavailable' availability overrides all other availability information}}
 
-void f7() __attribute__((availability(macosx,message=L"wide"))); // expected-error {{expected string literal for optional message in 'availability' attribute}}
+void f7() __attribute__((availability

[PATCH] D105754: [PowerPC] Fix L[D|W]ARX Implementation

2021-07-10 Thread Albion Fung via Phabricator via cfe-commits
Conanap added a comment.

looking at the failing test cases, for example 
`./clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vadd.c`, which are not 
test cases compiled for `PPC`, I'm seeing this following error:

  clang: /home/conanap/llvm/ccom/llvm-project/llvm/lib/IR/Instructions.cpp:494: 
void llvm::CallInst::init(llvm::FunctionType *, llvm::Value *, 
ArrayRef, ArrayRef, const llvm::Twine 
&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == 
Args[i]->getType()) && "Calling a function with a bad signature!"' failed.

Debug prints show that it's entering the code block `emitLoadReserveIntrinsic` 
and `BuiltinID` evaluates to `clang::PPC::BI__builtin_ppc_lwarx`. The `FTy` 
dump shows `i32 (i32 *)`, which is correct... I'm not exactly sure what to make 
of this yet, just putting this update here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105754

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


[clang] a706b94 - [OpenMP][NFCI] Re-enable two remarks tests after D101977 landed

2021-07-10 Thread Johannes Doerfert via cfe-commits

Author: Johannes Doerfert
Date: 2021-07-10T18:18:34-05:00
New Revision: a706b94ea5560a7733e403006a9066cc41e82b5d

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

LOG: [OpenMP][NFCI] Re-enable two remarks tests after D101977 landed

Added: 


Modified: 
clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
clang/test/OpenMP/remarks_parallel_in_target_state_machine.c

Removed: 




diff  --git 
a/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c 
b/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
index f0e156c6ca38..d50311f2d869 100644
--- a/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
+++ b/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
@@ -3,8 +3,6 @@
 // RUN: %clang_cc1 -fexperimental-new-pass-manager -verify=all,safe  
-Rpass=openmp-opt -Rpass-analysis=openmp-opt -fopenmp -O2 -x c++ -triple 
nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s 
-fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o %t.out
 
 // host-no-diagnostics
-// Will be renabled with D101977
-// XFAIL: *
 
 void bar1(void) {
 #pragma omp parallel // #0
@@ -25,6 +23,7 @@ void bar2(void) {
 
 void foo1(void) {
 #pragma omp target teams // #2
+ // all-remark@#2 {{Generic-mode kernel is executed 
with a customized state machine [3 known parallel regions] (good).}}
  // all-remark@#2 {{Target region containing the 
parallel region that is specialized. (parallel region ID: 
__omp_outlined__1_wrapper, kernel ID: __omp_offloading}}
  // all-remark@#2 {{Target region containing the 
parallel region that is specialized. (parallel region ID: 
__omp_outlined__2_wrapper, kernel ID: __omp_offloading}}
   {
@@ -44,6 +43,7 @@ void foo1(void) {
 
 void foo2(void) {
 #pragma omp target teams // #5
+ // all-remark@#5 {{Generic-mode kernel is executed 
with a customized state machine [4 known parallel regions] (good).}}
  // all-remark@#5 {{Target region containing the 
parallel region that is specialized. (parallel region ID: 
__omp_outlined__5_wrapper, kernel ID: __omp_offloading}}
  // all-remark@#5 {{Target region containing the 
parallel region that is specialized. (parallel region ID: 
__omp_outlined__4_wrapper, kernel ID: __omp_offloading}}
   {
@@ -66,6 +66,7 @@ void foo2(void) {
 
 void foo3(void) {
 #pragma omp target teams // #8
+ // all-remark@#8 {{Generic-mode kernel is executed 
with a customized state machine [4 known parallel regions] (good).}}
  // all-remark@#8 {{Target region containing the 
parallel region that is specialized. (parallel region ID: 
__omp_outlined__7_wrapper, kernel ID: __omp_offloading}}
  // all-remark@#8 {{Target region containing the 
parallel region that is specialized. (parallel region ID: 
__omp_outlined__8_wrapper, kernel ID: __omp_offloading}}
   {
@@ -99,4 +100,4 @@ void spmd(void) {
 }
 
 // all-remark@* 5 {{OpenMP runtime call __kmpc_global_thread_num moved to 
beginning of OpenMP region}}
-// all-remark@* 12 {{OpenMP runtime call __kmpc_global_thread_num 
deduplicated}}
+// all-remark@* 9 {{OpenMP runtime call __kmpc_global_thread_num deduplicated}}

diff  --git a/clang/test/OpenMP/remarks_parallel_in_target_state_machine.c 
b/clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
index e38c101e022f..cc656b78d8e8 100644
--- a/clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
+++ b/clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
@@ -3,8 +3,6 @@
 // RUN: %clang_cc1 -fexperimental-new-pass-manager -verify  
-Rpass=openmp-opt -Rpass-analysis=openmp-opt -fopenmp -O2 -x c++ -triple 
nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s 
-fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o %t.out
 
 // host-no-diagnostics
-// Will be renabled with D101977
-// XFAIL: *
 
 void bar(void) {
 #pragma omp parallel // #1 



  \
@@ -16,6 +14,7 @@ void bar(void) {
 
 void foo(void) {
 #pragma omp target teams // #2 

 \
+ // expected-remark@#2 {{Generic-mode kern

[clang] 514c033 - [OpenMP] Detect SPMD compatible kernels and execute them as such

2021-07-10 Thread Johannes Doerfert via cfe-commits

Author: Johannes Doerfert
Date: 2021-07-10T18:44:25-05:00
New Revision: 514c033db1e0c237eccd56b9fc11fe05a6baff39

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

LOG: [OpenMP] Detect SPMD compatible kernels and execute them as such

In the spirit of TRegions [0], this patch analyzes a kernel and tracks
if it can be executed in SPMD-mode. If so, we flip the arguments of
the __kmpc_target_init and deinit call to enable the mode. We also
update the `_exec_mode` flag to indicate to the runtime we
changed the mode to SPMD.

The code analysis is done interprocedurally by extending the
AAKernelInfo abstract attribute to track SPMD compatibility as well.

[0] https://link.springer.com/chapter/10.1007/978-3-030-28596-8_11

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

Added: 
llvm/test/Transforms/OpenMP/spmdization.ll
llvm/test/Transforms/OpenMP/spmdization_remarks.ll

Modified: 
clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
llvm/lib/IR/Assumptions.cpp
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
llvm/test/Transforms/OpenMP/custom_state_machines.ll
llvm/test/Transforms/OpenMP/custom_state_machines_remarks.ll

Removed: 




diff  --git 
a/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c 
b/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
index d50311f2d8692..20142d944f362 100644
--- a/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
+++ b/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
@@ -4,6 +4,8 @@
 
 // host-no-diagnostics
 
+void baz(void) __attribute__((assume("omp_no_openmp")));
+
 void bar1(void) {
 #pragma omp parallel // #0
  // all-remark@#0 {{Found a parallel region that is called 
in a target region but not part of a combined target construct nor nested 
inside a target construct without intermediate code. This can lead to excessive 
register usage for unrelated target regions in the same translation unit due to 
spurious call edges assumed by ptxas.}}
@@ -27,6 +29,7 @@ void foo1(void) {
  // all-remark@#2 {{Target region containing the 
parallel region that is specialized. (parallel region ID: 
__omp_outlined__1_wrapper, kernel ID: __omp_offloading}}
  // all-remark@#2 {{Target region containing the 
parallel region that is specialized. (parallel region ID: 
__omp_outlined__2_wrapper, kernel ID: __omp_offloading}}
   {
+baz();   // all-remark {{Kernel will be executed in generic-mode 
due to this potential side-effect, consider to add 
`__attribute__((assume("ompx_spmd_amenable")))` to the called function 
'_Z3bazv'.}}
 #pragma omp parallel // #3
  // all-remark@#3 {{Found a parallel region that is called 
in a target region but not part of a combined target construct nor nested 
inside a target construct without intermediate code. This can lead to excessive 
register usage for unrelated target regions in the same translation unit due to 
spurious call edges assumed by ptxas.}}
  // all-remark@#3 {{Specialize parallel region that is 
only reached from a single target region to avoid spurious call edges and 
excessive register usage in other target regions. (parallel region ID: 
__omp_outlined__1_wrapper, kernel ID: __omp_offloading}}
@@ -47,6 +50,7 @@ void foo2(void) {
  // all-remark@#5 {{Target region containing the 
parallel region that is specialized. (parallel region ID: 
__omp_outlined__5_wrapper, kernel ID: __omp_offloading}}
  // all-remark@#5 {{Target region containing the 
parallel region that is specialized. (parallel region ID: 
__omp_outlined__4_wrapper, kernel ID: __omp_offloading}}
   {
+baz();   // all-remark {{Kernel will be executed in generic-mode 
due to this potential side-effect, consider to add 
`__attribute__((assume("ompx_spmd_amenable")))` to the called function 
'_Z3bazv'.}}
 #pragma omp parallel // #6
  // all-remark@#6 {{Found a parallel region that is called 
in a target region but not part of a combined target construct nor nested 
inside a target construct without intermediate code. This can lead to excessive 
register usage for unrelated target regions in the same translation unit due to 
spurious call edges assumed by ptxas.}}
  // all-remark@#6 {{Specialize parallel region that is 
only reached from a single target region to avoid spurious call edges and 
excessive register usage in other target regions. (parallel region ID: 
__omp_outlined__4_wrapper, kernel ID: __omp_of

[PATCH] D105756: [clang] C++98 implicit moves are back with a vengeance

2021-07-10 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone accepted this revision.
Quuxplusone added a comment.
This revision is now accepted and ready to land.

It would be an excellent idea to try the libc++ test suite with this patch 
(make sure to pass `--param std=c++03`).




Comment at: clang/lib/Sema/SemaStmt.cpp:3484
+  : cast(FD)->getRefQualifier() == RQ_None)
+goto second_overload_resolution;
+}

It sure would be nice to factor something out into a function here so that we 
didn't need a `goto`. Either replace the `goto` with

return PerformCopyInitialization(Entity, SourceLocation(), Value);

or else pull the `Step` stuff out into a `static bool 
PermitImplicitMoveSequence(...)` or whatever an appropriate name might be:

if ((Res == OR_Success || Res == OR_Deleted) && 
PermitImplicitMoveSequence(Seq)) {
  // Promote "AsRvalue" to the heap, etc etc




Comment at: clang/test/CXX/class/class.init/class.copy.elision/p3.cpp:404
 
+// Both tests in test_constandnonconstcopy, and also test_conversion::t1, are
+// "pure" C++98 tests (pretend 'delete' means 'private').

/t1/test1/?
Thanks for this note; this answers my question about whether we're testing the 
problematic cases. :)



Comment at: clang/test/SemaObjCXX/block-capture.mm:40
 };
-TEST(CopyNoMove); // cxx11_2b-error {{call to deleted constructor}}
+TEST(CopyNoMove); // cxx98_2b-error {{call to deleted constructor}}
 

`cxx98_2b` is just `expected`, isn't it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105756

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


[PATCH] D105755: [WebAssembly] Custom combines for f32x4.demote_zero_f64x2

2021-07-10 Thread Heejin Ahn via Phabricator via cfe-commits
aheejin accepted this revision.
aheejin added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/include/clang/Basic/BuiltinsWebAssembly.def:192-193
 
 TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_s_f64x2_i32x4, "V4iV2d", "nc", 
"simd128")
 TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_u_f64x2_i32x4, "V4UiV2d", "nc", 
"simd128")
-TARGET_BUILTIN(__builtin_wasm_demote_zero_f64x2_f32x4, "V4fV2d", "nc", 
"simd128")

If these share the same pattern, do we need these builtins?



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:2367
+
+if (!IsZeroSplat(N->getOperand(1)))
+  return SDValue();

Do we not need to check if `N->getOpernad(1)` is a specific type, such as 
`v2f32` or `v2i32`?



Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:2410
 
-  auto *Splat = dyn_cast(N->getOperand(1));
-  APInt SplatValue, SplatUndef;
-  unsigned SplatBitSize;
-  bool HasAnyUndefs;
-  if (!Splat || !Splat->isConstantSplat(SplatValue, SplatUndef, SplatBitSize,
-HasAnyUndefs))
+  if (!IsZeroSplat(Concat.getOperand(1)))
 return SDValue();

Same here; do we not need to check if `Concat.getOpernad(1)` is `v2f64`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105755

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


[PATCH] D105754: [PowerPC] Fix L[D|W]ARX Implementation

2021-07-10 Thread Kai Luo via Phabricator via cfe-commits
lkail added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:997
 
+static llvm::Value *emitLoadReserveIntrinsic(CodeGenFunction &CGF,
+ unsigned BuiltinID,

Maybe rename to `emitPPCLoadReserveIntrinsic` should be more appropriate, since 
other targets also have similar load-reserve/load-linked/load-acquire notions 
and what this function does is ad hoc to PPC.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105754

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


[PATCH] D105754: [PowerPC] Fix L[D|W]ARX Implementation

2021-07-10 Thread Kai Luo via Phabricator via cfe-commits
lkail added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:1015
+break;
+  }
+

Adding `default: llvm_unreachable` would be nice.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105754

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