[PATCH] D86844: [LoopDeletion] Allows deletion of possibly infinite side-effect free loops

2020-12-30 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

Do you plan to implement gcc’s option in Clang as followup?

-ffinite-loops / -fno-finite-loops
Assume that a loop with an exit will eventually take the exit and not loop 
indefinitely. This allows the compiler to remove loops that otherwise have no 
side-effects, not considering eventual endless looping as such.

This option is enabled by default at -O2 for C++ with -std=c++11 or higher.

?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86844

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


[PATCH] D92837: [X86] Support tilezero intrinsic and c interface for AMX.

2020-12-30 Thread LuoYuanke via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG08665b180568: Support tilezero intrinsic and c interface for 
AMX. (authored by LuoYuanke).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92837

Files:
  clang/include/clang/Basic/BuiltinsX86_64.def
  clang/lib/Headers/amxintrin.h
  clang/test/CodeGen/X86/amx_api.c
  llvm/include/llvm/IR/IntrinsicsX86.td
  llvm/lib/Target/X86/X86ExpandPseudo.cpp
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/lib/Target/X86/X86InstrAMX.td
  llvm/lib/Target/X86/X86PreTileConfig.cpp
  llvm/lib/Target/X86/X86RegisterInfo.cpp
  llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll

Index: llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll
@@ -0,0 +1,38 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+amx-tile -mattr=+avx512f -verify-machineinstrs | FileCheck %s
+
+define void @test_amx(i8* %pointer, i8* %base, i64 %stride) {
+; CHECK-LABEL: test_amx:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:vpxord %zmm0, %zmm0, %zmm0
+; CHECK-NEXT:vmovdqu64 %zmm0, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $1, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:ldtilecfg -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, %ax
+; CHECK-NEXT:tilezero %tmm0
+; CHECK-NEXT:tileloadd (%rsi,%rdx), %tmm1
+; CHECK-NEXT:tileloadd (%rsi,%rdx), %tmm2
+; CHECK-NEXT:tdpbssd %tmm2, %tmm1, %tmm0
+; CHECK-NEXT:tilestored %tmm0, (%rdi,%rdx)
+; CHECK-NEXT:tilerelease
+; CHECK-NEXT:vzeroupper
+; CHECK-NEXT:retq
+  %c = call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
+  %a = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
+  %b = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
+  %d = call x86_amx @llvm.x86.tdpbssd.internal(i16 8, i16 8, i16 8, x86_amx %c, x86_amx %a, x86_amx %b)
+  call void @llvm.x86.tilestored64.internal(i16 8, i16 8, i8* %pointer, i64 %stride, x86_amx %d)
+
+  ret void
+}
+
+declare x86_amx @llvm.x86.tilezero.internal(i16, i16)
+declare x86_amx @llvm.x86.tileloadd64.internal(i16, i16, i8*, i64)
+declare x86_amx @llvm.x86.tdpbssd.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
+declare void @llvm.x86.tilestored64.internal(i16, i16, i8*, i64, x86_amx)
Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
===
--- llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -873,6 +873,7 @@
   // We only collect the tile shape that is defined.
   case X86::PTILELOADDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 MachineOperand  = MI->getOperand(1);
 MachineOperand  = MI->getOperand(2);
 ShapeT Shape(, , MRI);
Index: llvm/lib/Target/X86/X86PreTileConfig.cpp
===
--- llvm/lib/Target/X86/X86PreTileConfig.cpp
+++ llvm/lib/Target/X86/X86PreTileConfig.cpp
@@ -132,6 +132,7 @@
 llvm_unreachable("Unexpected machine instruction on tile");
   case X86::PTILELOADDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 MachineOperand  = const_cast(MI.getOperand(1));
 MachineOperand  = const_cast(MI.getOperand(2));
 ShapeT Shape(, , MRI);
@@ -230,6 +231,7 @@
   case X86::PTILELOADDV:
   case X86::PTILESTOREDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 unsigned NumOperands = MI.getNumOperands();
 MI.RemoveOperand(NumOperands - 1);
 MI.addOperand(MF, MachineOperand::CreateReg(CFG, false));
Index: llvm/lib/Target/X86/X86InstrAMX.td
===
--- llvm/lib/Target/X86/X86InstrAMX.td
+++ llvm/lib/Target/X86/X86InstrAMX.td
@@ -62,6 +62,9 @@
 def PTILESTOREDV : PseudoI<(outs), (ins GR16:$src1,
 GR16:$src2, opaquemem:$src3,
 TILE:$src4, TILECFG:$cfg), []>;
+def PTILEZEROV : PseudoI<(outs TILE: $dst), (ins GR16:$src1,
+ GR16:$src2,
+ TILECFG:$cfg), []>;
 
 let usesCustomInserter = 1 in {
   // Pseudo instructions, using immediates instead of tile registers.
Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
===
--- 

[clang] 08665b1 - Support tilezero intrinsic and c interface for AMX.

2020-12-30 Thread via cfe-commits

Author: Luo, Yuanke
Date: 2020-12-31T13:24:57+08:00
New Revision: 08665b180568c82a1b2b8bd38a1e5769a862c2a9

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

LOG: Support tilezero intrinsic and c interface for AMX.

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

Added: 
llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll

Modified: 
clang/include/clang/Basic/BuiltinsX86_64.def
clang/lib/Headers/amxintrin.h
clang/test/CodeGen/X86/amx_api.c
llvm/include/llvm/IR/IntrinsicsX86.td
llvm/lib/Target/X86/X86ExpandPseudo.cpp
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/lib/Target/X86/X86InstrAMX.td
llvm/lib/Target/X86/X86PreTileConfig.cpp
llvm/lib/Target/X86/X86RegisterInfo.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsX86_64.def 
b/clang/include/clang/Basic/BuiltinsX86_64.def
index 98327ade17e8..974ba35b3233 100644
--- a/clang/include/clang/Basic/BuiltinsX86_64.def
+++ b/clang/include/clang/Basic/BuiltinsX86_64.def
@@ -104,6 +104,7 @@ TARGET_BUILTIN(__builtin_ia32_senduipi, "vUWi", "n", 
"uintr")
 TARGET_BUILTIN(__builtin_ia32_tileloadd64_internal, "V256iUsUsvC*z", "n", 
"amx-tile")
 TARGET_BUILTIN(__builtin_ia32_tdpbssd_internal, "V256iUsUsUsV256iV256iV256i", 
"n", "amx-int8")
 TARGET_BUILTIN(__builtin_ia32_tilestored64_internal, "vUsUsv*zV256i", "n", 
"amx-tile")
+TARGET_BUILTIN(__builtin_ia32_tilezero_internal, "V256iUsUs", "n", "amx-tile")
 // AMX
 TARGET_BUILTIN(__builtin_ia32_tile_loadconfig, "vvC*", "n", "amx-tile")
 TARGET_BUILTIN(__builtin_ia32_tile_storeconfig, "vvC*", "n", "amx-tile")

diff  --git a/clang/lib/Headers/amxintrin.h b/clang/lib/Headers/amxintrin.h
index 03a468ef15b1..901488a17e8c 100644
--- a/clang/lib/Headers/amxintrin.h
+++ b/clang/lib/Headers/amxintrin.h
@@ -251,7 +251,7 @@ typedef struct __tile1024i_str {
   _tile1024i tile;
 } __tile1024i;
 
-__DEFAULT_FN_ATTRS_INT8
+__DEFAULT_FN_ATTRS_TILE
 static void __tile_loadd(__tile1024i *dst, const void *base,
  __SIZE_TYPE__ stride) {
   dst->tile = _tile_loadd_internal(dst->row, dst->col, base, stride);
@@ -264,10 +264,15 @@ static void __tile_dpbsud(__tile1024i *dst, __tile1024i 
src1,
 src1.tile, src2.tile);
 }
 
-__DEFAULT_FN_ATTRS_INT8
+__DEFAULT_FN_ATTRS_TILE
 static void __tile_stored(void *base, __SIZE_TYPE__ stride, __tile1024i src) {
   _tile_stored_internal(src.row, src.col, base, stride, src.tile);
 }
 
+__DEFAULT_FN_ATTRS_TILE
+static void __tile_zero(__tile1024i *dst) {
+  dst->tile = __builtin_ia32_tilezero_internal(dst->row, dst->col);
+}
+
 #endif /* __x86_64__ */
 #endif /* __AMXINTRIN_H */

diff  --git a/clang/test/CodeGen/X86/amx_api.c 
b/clang/test/CodeGen/X86/amx_api.c
index 52eb9542228d..55290f3fa6fb 100644
--- a/clang/test/CodeGen/X86/amx_api.c
+++ b/clang/test/CodeGen/X86/amx_api.c
@@ -52,3 +52,10 @@ void test_tile_stored(__tile1024i c) {
   //CHECK-NEXT: call void @llvm.x86.tilestored64.internal
   __tile_stored(buf, STRIDE, c);
 }
+
+void test_tile_zero(__tile1024i c) {
+  //CHECK-LABEL: @test_tile_zero
+  //CHECK: call x86_amx @llvm.x86.tilezero.internal
+  //CHECK-NEXT bitcast x86_amx {{%.*}} to <256 x i32>
+  __tile_zero();
+}

diff  --git a/llvm/include/llvm/IR/IntrinsicsX86.td 
b/llvm/include/llvm/IR/IntrinsicsX86.td
index dba44523e153..68b076c594be 100644
--- a/llvm/include/llvm/IR/IntrinsicsX86.td
+++ b/llvm/include/llvm/IR/IntrinsicsX86.td
@@ -5057,6 +5057,10 @@ let TargetPrefix = "x86" in {
   GCCBuiltin<"__builtin_ia32_tilestored64_internal">,
   Intrinsic<[], [llvm_i16_ty, llvm_i16_ty, llvm_ptr_ty,
  llvm_i64_ty, llvm_x86amx_ty], []>;
+  def int_x86_tilezero_internal :
+  GCCBuiltin<"__builtin_ia32_tilezero_internal">,
+  Intrinsic<[llvm_x86amx_ty], [llvm_i16_ty, llvm_i16_ty],
+[]>;
 }
 
 
//===--===//

diff  --git a/llvm/lib/Target/X86/X86ExpandPseudo.cpp 
b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
index a2fe09aecc49..15af0fb2e888 100644
--- a/llvm/lib/Target/X86/X86ExpandPseudo.cpp
+++ b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
@@ -494,6 +494,12 @@ bool X86ExpandPseudo::ExpandMI(MachineBasicBlock ,
 MI.setDesc(TII->get(X86::TILESTORED));
 return true;
   }
+  case X86::PTILEZEROV: {
+for (int i = 3; i > 0; --i) // Remove row, col, $tmmcfg
+  MI.RemoveOperand(i);
+MI.setDesc(TII->get(X86::TILEZERO));
+return true;
+  }
   }
   llvm_unreachable("Previous switch has a fallthrough?");
 }

diff  --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp 
b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 883b6bfc145d..a96f73df855d 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ 

[PATCH] D92837: [X86] Support tilezero intrinsic and c interface for AMX.

2020-12-30 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke updated this revision to Diff 314170.
LuoYuanke added a comment.

Rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92837

Files:
  clang/include/clang/Basic/BuiltinsX86_64.def
  clang/lib/Headers/amxintrin.h
  clang/test/CodeGen/X86/amx_api.c
  llvm/include/llvm/IR/IntrinsicsX86.td
  llvm/lib/Target/X86/X86ExpandPseudo.cpp
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/lib/Target/X86/X86InstrAMX.td
  llvm/lib/Target/X86/X86PreTileConfig.cpp
  llvm/lib/Target/X86/X86RegisterInfo.cpp
  llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll

Index: llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll
@@ -0,0 +1,38 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+amx-tile -mattr=+avx512f -verify-machineinstrs | FileCheck %s
+
+define void @test_amx(i8* %pointer, i8* %base, i64 %stride) {
+; CHECK-LABEL: test_amx:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:vpxord %zmm0, %zmm0, %zmm0
+; CHECK-NEXT:vmovdqu64 %zmm0, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $1, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:ldtilecfg -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, %ax
+; CHECK-NEXT:tilezero %tmm0
+; CHECK-NEXT:tileloadd (%rsi,%rdx), %tmm1
+; CHECK-NEXT:tileloadd (%rsi,%rdx), %tmm2
+; CHECK-NEXT:tdpbssd %tmm2, %tmm1, %tmm0
+; CHECK-NEXT:tilestored %tmm0, (%rdi,%rdx)
+; CHECK-NEXT:tilerelease
+; CHECK-NEXT:vzeroupper
+; CHECK-NEXT:retq
+  %c = call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
+  %a = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
+  %b = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
+  %d = call x86_amx @llvm.x86.tdpbssd.internal(i16 8, i16 8, i16 8, x86_amx %c, x86_amx %a, x86_amx %b)
+  call void @llvm.x86.tilestored64.internal(i16 8, i16 8, i8* %pointer, i64 %stride, x86_amx %d)
+
+  ret void
+}
+
+declare x86_amx @llvm.x86.tilezero.internal(i16, i16)
+declare x86_amx @llvm.x86.tileloadd64.internal(i16, i16, i8*, i64)
+declare x86_amx @llvm.x86.tdpbssd.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
+declare void @llvm.x86.tilestored64.internal(i16, i16, i8*, i64, x86_amx)
Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
===
--- llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -873,6 +873,7 @@
   // We only collect the tile shape that is defined.
   case X86::PTILELOADDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 MachineOperand  = MI->getOperand(1);
 MachineOperand  = MI->getOperand(2);
 ShapeT Shape(, , MRI);
Index: llvm/lib/Target/X86/X86PreTileConfig.cpp
===
--- llvm/lib/Target/X86/X86PreTileConfig.cpp
+++ llvm/lib/Target/X86/X86PreTileConfig.cpp
@@ -132,6 +132,7 @@
 llvm_unreachable("Unexpected machine instruction on tile");
   case X86::PTILELOADDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 MachineOperand  = const_cast(MI.getOperand(1));
 MachineOperand  = const_cast(MI.getOperand(2));
 ShapeT Shape(, , MRI);
@@ -230,6 +231,7 @@
   case X86::PTILELOADDV:
   case X86::PTILESTOREDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 unsigned NumOperands = MI.getNumOperands();
 MI.RemoveOperand(NumOperands - 1);
 MI.addOperand(MF, MachineOperand::CreateReg(CFG, false));
Index: llvm/lib/Target/X86/X86InstrAMX.td
===
--- llvm/lib/Target/X86/X86InstrAMX.td
+++ llvm/lib/Target/X86/X86InstrAMX.td
@@ -62,6 +62,9 @@
 def PTILESTOREDV : PseudoI<(outs), (ins GR16:$src1,
 GR16:$src2, opaquemem:$src3,
 TILE:$src4, TILECFG:$cfg), []>;
+def PTILEZEROV : PseudoI<(outs TILE: $dst), (ins GR16:$src1,
+ GR16:$src2,
+ TILECFG:$cfg), []>;
 
 let usesCustomInserter = 1 in {
   // Pseudo instructions, using immediates instead of tile registers.
Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
===
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -4641,6 +4641,18 @@
   ReplaceNode(Node, CNode);
   return;
 }
+case 

[clang] 809a1e0 - [CodeGenModule] Set dso_local for Mach-O GlobalValue

2020-12-30 Thread Fangrui Song via cfe-commits

Author: Fangrui Song
Date: 2020-12-30T20:52:01-08:00
New Revision: 809a1e0ffd7af40ee27270ff8ba2ffc927330e71

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

LOG: [CodeGenModule] Set dso_local for Mach-O GlobalValue

* static relocation model: always
* other relocation models: if isStrongDefinitionForLinker

This will make LLVM IR emitted for COFF/Mach-O and executable ELF similar.

Added: 


Modified: 
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGenCXX/const-init.cpp
clang/test/CodeGenCXX/linkage.cpp
clang/test/CodeGenCXX/type_visibility.cpp
clang/test/CodeGenCXX/visibility.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index 6d14298d9f5f..bf0a38bf83ab 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -946,14 +946,20 @@ static bool shouldAssumeDSOLocal(const CodeGenModule ,
   if (TT.isOSBinFormatCOFF() || (TT.isOSWindows() && TT.isOSBinFormatMachO()))
 return true;
 
+  const auto  = CGM.getCodeGenOpts();
+  llvm::Reloc::Model RM = CGOpts.RelocationModel;
+  const auto  = CGM.getLangOpts();
+
+  if (TT.isOSBinFormatMachO()) {
+if (RM == llvm::Reloc::Static)
+  return true;
+return GV->isStrongDefinitionForLinker();
+  }
+
   // Only handle COFF and ELF for now.
   if (!TT.isOSBinFormatELF())
 return false;
 
-  // If this is not an executable, don't assume anything is local.
-  const auto  = CGM.getCodeGenOpts();
-  llvm::Reloc::Model RM = CGOpts.RelocationModel;
-  const auto  = CGM.getLangOpts();
   if (RM != llvm::Reloc::Static && !LOpts.PIE) {
 // On ELF, if -fno-semantic-interposition is specified, we can set 
dso_local
 // if using a local alias is preferable (can avoid GOT indirection).

diff  --git a/clang/test/CodeGenCXX/const-init.cpp 
b/clang/test/CodeGenCXX/const-init.cpp
index f5c9dae7ba4b..5b305bc5e4d6 100644
--- a/clang/test/CodeGenCXX/const-init.cpp
+++ b/clang/test/CodeGenCXX/const-init.cpp
@@ -2,17 +2,17 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -std=c++98 -o - %s | 
FileCheck %s
 // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -std=c++11 -o - %s | 
FileCheck %s
 
-// CHECK: @a = global i32 10
+// CHECK: @a = dso_local global i32 10
 int a = 10;
-// CHECK: @ar = constant i32* @a
+// CHECK: @ar = dso_local constant i32* @a
 int  = a;
 
 void f();
-// CHECK: @fr = constant void ()* @_Z1fv
+// CHECK: @fr = dso_local constant void ()* @_Z1fv
 void ()() = f;
 
 struct S { int& a; };
-// CHECK: @s = global %struct.S { i32* @a }
+// CHECK: @s = dso_local global %struct.S { i32* @a }
 S s = { a };
 
 // PR5581
@@ -23,7 +23,7 @@ class C {
   unsigned f;
 };
 
-// CHECK: @_ZN6PR55812g0E = global %"class.PR5581::C" { i32 1 }
+// CHECK: @_ZN6PR55812g0E = dso_local global %"class.PR5581::C" { i32 1 }
 C g0 = { C::e1 };
 }
 
@@ -39,10 +39,10 @@ namespace test2 {
 static int g();
   } a;
 
-  // CHECK: @_ZN5test22t0E = global double {{1\.0+e\+0+}}, align 8
-  // CHECK: @_ZN5test22t1E = global [2 x double] [double {{1\.0+e\+0+}}, 
double {{5\.0+e-0*}}1], align 16
-  // CHECK: @_ZN5test22t2E = global double* @_ZN5test21A1d
-  // CHECK: @_ZN5test22t3E = global {{.*}} @_ZN5test21A1g
+  // CHECK: @_ZN5test22t0E = dso_local global double {{1\.0+e\+0+}}, align 8
+  // CHECK: @_ZN5test22t1E = dso_local global [2 x double] [double 
{{1\.0+e\+0+}}, double {{5\.0+e-0*}}1], align 16
+  // CHECK: @_ZN5test22t2E = dso_local global double* @_ZN5test21A1d
+  // CHECK: @_ZN5test22t3E = dso_local global {{.*}} @_ZN5test21A1g
   double t0 = A::d;
   double t1[] = { A::d, A::f };
   const double *t2 = 
@@ -50,7 +50,7 @@ namespace test2 {
 }
 
 // We don't expect to fold this in the frontend, but make sure it doesn't 
crash.
-// CHECK: @PR9558 = global float 0.00e+0
+// CHECK: @PR9558 = dso_local global float 0.00e+0
 float PR9558 = reinterpret_cast("asd");
 
 // An initialized const automatic variable cannot be promoted to a constant
@@ -66,7 +66,7 @@ int writeToMutable() {
 
 // Make sure we don't try to fold this in the frontend; the backend can't
 // handle it.
-// CHECK: @PR11705 = global i128 0
+// CHECK: @PR11705 = dso_local global i128 0
 __int128_t PR11705 = (__int128_t)
 
 // Make sure we don't try to fold this either.
@@ -77,11 +77,11 @@ void UnfoldableAddrLabelDiff() { static __int128_t x = 
(long)&(long)& a:b:
 // CHECK: @_ZZ21FoldableAddrLabelDiffvE1x = internal global i64 sub (i64 
ptrtoint (i8* blockaddress(@_Z21FoldableAddrLabelDiffv
 void FoldableAddrLabelDiff() { static long x = (long)&(long)& 
a:b:return;}
 
-// CHECK: @i = constant i32* bitcast (float* @PR9558 to i32*)
+// CHECK: @i = dso_local constant i32* bitcast (float* @PR9558 to i32*)
 int  = reinterpret_cast(PR9558);
 
 

[PATCH] D93952: [Clang][Misc] Fix fragile test

2020-12-30 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

You can check the CMake configurations of these bots.

https://github.com/llvm/llvm-zorg `buildbot/osuosl/master/config/builders.py`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93952

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


[PATCH] D93952: [Clang][Misc] Fix fragile test

2020-12-30 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel added a comment.

I can't say that I know with any certainty, I'm too inexperienced. This failure 
was missed by me locally, the pre-merge bot, and by most of the buildbots other 
than the ones I mentioned above. I have no idea under what configuration of 
CMake options will clang not emit this particular case of a label for a BB.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93952

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


[PATCH] D93952: [Clang][Misc] Fix fragile test

2020-12-30 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Do you know why some bots don't emit `entry:`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93952

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


[PATCH] D92837: [X86] Support tilezero intrinsic and c interface for AMX.

2020-12-30 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei accepted this revision.
pengfei added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92837

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


[PATCH] D93952: [Clang][Misc] Fix fragile test

2020-12-30 Thread Atmn Patel via Phabricator via cfe-commits
atmnpatel created this revision.
atmnpatel added a reviewer: MaskRay.
Herald added a subscriber: pengfei.
atmnpatel requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

clang-with-thin-lto-ubuntu, clang-with-lto-ubuntu, 
clang-x86_64-debian-new-pass-manager-fast, and fuchsia-x86_64-linux do not emit 
a label for the
basic block, but each of the other buildbots do. Removing this CHECK
line should fix these buildbot errors.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93952

Files:
  clang/test/Misc/loop-opt-setup.c


Index: clang/test/Misc/loop-opt-setup.c
===
--- clang/test/Misc/loop-opt-setup.c
+++ clang/test/Misc/loop-opt-setup.c
@@ -31,6 +31,5 @@
 // C99: br label
 // C99-NOT: br i1
 // C99: br label
-// CHECK: entry:
 // CHECK-NOT: br i1
-// CHECK-NEXT: ret void
+// CHECK: ret void


Index: clang/test/Misc/loop-opt-setup.c
===
--- clang/test/Misc/loop-opt-setup.c
+++ clang/test/Misc/loop-opt-setup.c
@@ -31,6 +31,5 @@
 // C99: br label
 // C99-NOT: br i1
 // C99: br label
-// CHECK: entry:
 // CHECK-NOT: br i1
-// CHECK-NEXT: ret void
+// CHECK: ret void
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2020-12-30 Thread Ally Tiritoglu via Phabricator via cfe-commits
atirit updated this revision to Diff 314162.
atirit added a comment.

Changed commit username and email


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

Files:
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/unittests/Format/FormatTest.cpp


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -1344,8 +1344,7 @@
   Style.AllowShortEnumsOnASingleLine = true;
   verifyFormat("enum { A, B, C } ShortEnum1, ShortEnum2;", Style);
   Style.AllowShortEnumsOnASingleLine = false;
-  verifyFormat("enum\n"
-   "{\n"
+  verifyFormat("enum {\n"
"  A,\n"
"  B,\n"
"  C\n"
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1301,7 +1301,7 @@
   if (!parseEnum())
 break;
   // This only applies for C++.
-  if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) {
+  if (!Style.isCpp()) {
 addUnwrappedLine();
 return;
   }
@@ -2484,6 +2484,9 @@
 return true;
   }
 
+  if (!Style.AllowShortEnumsOnASingleLine && Style.BraceWrapping.AfterEnum)
+addUnwrappedLine();
+
   // Parse enum body.
   nextToken();
   if (!Style.AllowShortEnumsOnASingleLine) {


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -1344,8 +1344,7 @@
   Style.AllowShortEnumsOnASingleLine = true;
   verifyFormat("enum { A, B, C } ShortEnum1, ShortEnum2;", Style);
   Style.AllowShortEnumsOnASingleLine = false;
-  verifyFormat("enum\n"
-   "{\n"
+  verifyFormat("enum {\n"
"  A,\n"
"  B,\n"
"  C\n"
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1301,7 +1301,7 @@
   if (!parseEnum())
 break;
   // This only applies for C++.
-  if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) {
+  if (!Style.isCpp()) {
 addUnwrappedLine();
 return;
   }
@@ -2484,6 +2484,9 @@
 return true;
   }
 
+  if (!Style.AllowShortEnumsOnASingleLine && Style.BraceWrapping.AfterEnum)
+addUnwrappedLine();
+
   // Parse enum body.
   nextToken();
   if (!Style.AllowShortEnumsOnASingleLine) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6f1503d - [LoopDeletion] Allows deletion of possibly infinite side-effect free loops

2020-12-30 Thread via cfe-commits

Author: Atmn Patel
Date: 2020-12-30T21:43:01-05:00
New Revision: 6f1503d59854b331f1f970d39839619b0a26bbc7

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

LOG: [LoopDeletion] Allows deletion of possibly infinite side-effect free loops

>From C11 and C++11 onwards, a forward-progress requirement has been
introduced for both languages. In the case of C, loops with non-constant
conditionals that do not have any observable side-effects (as defined by
6.8.5p6) can be assumed by the implementation to terminate, and in the
case of C++, this assumption extends to all functions. The clang
frontend will emit the `mustprogress` function attribute for C++
functions (D86233, D85393, D86841) and emit the loop metadata
`llvm.loop.mustprogress` for every loop in C11 or later that has a
non-constant conditional.

This patch modifies LoopDeletion so that only loops with
the `llvm.loop.mustprogress` metadata or loops contained in functions
that are required to make progress (`mustprogress` or `willreturn`) are
checked for observable side-effects. If these loops do not have an
observable side-effect, then we delete them.

Loops without observable side-effects that do not satisfy the above
conditions will not be deleted.

Reviewed By: jdoerfert

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

Added: 
llvm/test/Transforms/LoopDeletion/mustprogress.ll

Modified: 
clang/test/Misc/loop-opt-setup.c
llvm/include/llvm/Transforms/Utils/LoopUtils.h
llvm/lib/Transforms/Scalar/LoopDeletion.cpp
llvm/lib/Transforms/Utils/LoopUtils.cpp
llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll

Removed: 




diff  --git a/clang/test/Misc/loop-opt-setup.c 
b/clang/test/Misc/loop-opt-setup.c
index c5c2ec4fda84..660eea25c6af 100644
--- a/clang/test/Misc/loop-opt-setup.c
+++ b/clang/test/Misc/loop-opt-setup.c
@@ -1,4 +1,5 @@
 // RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+// RUN: %clang -std=c99 -O1 -fno-unroll-loops -S -o - %s -emit-llvm | 
FileCheck %s --check-prefix C99
 
 extern int a[16];
 int b = 0;
@@ -24,7 +25,12 @@ void Helper() {
 }
 
 // Check br i1 to make sure the loop is gone, there will still be a label 
branch for the infinite loop.
+// In C99, there was no forward progress requirement, so we expect the 
infinite loop to still exist,
+// but for C11 and onwards, the infinite loop can be deleted.
 // CHECK-LABEL: Helper
-// CHECK: br label
-// CHECK-NOT: br i1
-// CHECK: br label
+// C99: br label
+// C99-NOT: br i1
+// C99: br label
+// CHECK: entry:
+// CHECK-NOT: br i1
+// CHECK-NEXT: ret void

diff  --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h 
b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
index ba2bb0a4c6b0..fc6b72eb28af 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
@@ -255,6 +255,9 @@ bool hasDisableAllTransformsHint(const Loop *L);
 /// Look for the loop attribute that disables the LICM transformation 
heuristics.
 bool hasDisableLICMTransformsHint(const Loop *L);
 
+/// Look for the loop attribute that requires progress within the loop.
+bool hasMustProgress(const Loop *L);
+
 /// The mode sets how eager a transformation should be applied.
 enum TransformationMode {
   /// The pass can use heuristics to determine whether a transformation should

diff  --git a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp 
b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
index 065db647561e..814cfc7ac6a9 100644
--- a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
@@ -128,10 +128,11 @@ static bool isLoopNeverExecuted(Loop *L) {
 
 /// Remove a loop if it is dead.
 ///
-/// A loop is considered dead if it does not impact the observable behavior of
-/// the program other than finite running time. This never removes a loop that
-/// might be infinite (unless it is never executed), as doing so could change
-/// the halting/non-halting nature of a program.
+/// A loop is considered dead either if it does not impact the observable
+/// behavior of the program other than finite running time, or if it is
+/// required to make progress by an attribute such as 'mustprogress' or
+/// 'llvm.loop.mustprogress' and does not make any. This may remove
+/// infinite loops that have been required to make progress.
 ///
 /// This entire process relies pretty heavily on LoopSimplify form and LCSSA in
 /// order to make various safety checks work.
@@ -207,11 +208,13 @@ static LoopDeletionResult deleteLoopIfDead(Loop *L, 
DominatorTree ,
: LoopDeletionResult::Unmodified;
   }
 
-  // Don't remove loops for which we can't solve the trip count.
-  // They could be infinite, in which case we'd be changing program behavior.
+  // 

[PATCH] D86844: [LoopDeletion] Allows deletion of possibly infinite side-effect free loops

2020-12-30 Thread Atmn Patel via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6f1503d59854: [LoopDeletion] Allows deletion of possibly 
infinite side-effect free loops (authored by atmnpatel, committed by adpatel6).

Changed prior to commit:
  https://reviews.llvm.org/D86844?vs=313593=314159#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86844

Files:
  clang/test/Misc/loop-opt-setup.c
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/Transforms/Scalar/LoopDeletion.cpp
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/Transforms/LoopDeletion/mustprogress.ll
  llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll

Index: llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll
===
--- llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll
+++ llvm/test/Transforms/LoopDeletion/no-exit-blocks.ll
@@ -5,14 +5,7 @@
 ; CHECK: Function Attrs: mustprogress
 ; CHECK-LABEL: define {{[^@]+}}@f
 ; CHECK-SAME: () [[ATTR0:#.*]] {
-; CHECK-NEXT:br label [[TMP1:%.*]]
-; CHECK:   1:
-; CHECK-NEXT:[[DOT01:%.*]] = phi i32 [ 1, [[TMP0:%.*]] ], [ [[TMP3:%.*]], [[TMP2:%.*]] ]
-; CHECK-NEXT:[[DOT0:%.*]] = phi i32 [ 1, [[TMP0]] ], [ [[TMP3]], [[TMP2]] ]
-; CHECK-NEXT:br label [[TMP2]]
-; CHECK:   2:
-; CHECK-NEXT:[[TMP3]] = add nsw i32 [[DOT01]], [[DOT0]]
-; CHECK-NEXT:br label [[TMP1]]
+; CHECK-NEXT:unreachable
 ;
   br label %1
 
Index: llvm/test/Transforms/LoopDeletion/mustprogress.ll
===
--- /dev/null
+++ llvm/test/Transforms/LoopDeletion/mustprogress.ll
@@ -0,0 +1,237 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes
+; RUN: opt < %s -loop-deletion -verify-dom-info -S | FileCheck %s
+
+;; Original C Code:
+;;  void unknown_tripcount_mustprogress_attr_mustprogress_loopmd(int a, int b) {
+;;for (; a < b;) ;
+;;for (;;) ;
+;;  }
+
+define void @unknown_tripcount_mustprogress_attr_mustprogress_loopmd(i32 %a, i32 %b) #0 {
+; CHECK: Function Attrs: mustprogress
+; CHECK-LABEL: define {{[^@]+}}@unknown_tripcount_mustprogress_attr_mustprogress_loopmd
+; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) [[ATTR0:#.*]] {
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:br label [[FOR_END:%.*]]
+; CHECK:   for.end:
+; CHECK-NEXT:unreachable
+;
+entry:
+  br label %for.cond
+for.cond:
+  %cmp = icmp slt i32 %a, %b
+  br i1 %cmp, label %for.body, label %for.end
+for.body:
+  br label %for.cond, !llvm.loop !2
+for.end:
+  br label %for.cond1
+for.cond1:
+  br label %for.cond1
+}
+
+;; Original C Code:
+;;  void unknown_tripcount_mustprogress_attr_no_mustprogress_loopmd(int a, int b) {
+;;for (; a < b;) ;
+;;for (;;) ;
+;;  }
+;;  => Removed mustprogress loop attribute
+
+define void @unknown_tripcount_mustprogress_attr_no_mustprogess_loopmd(i32 %a, i32 %b) #0 {
+; CHECK: Function Attrs: mustprogress
+; CHECK-LABEL: define {{[^@]+}}@unknown_tripcount_mustprogress_attr_no_mustprogess_loopmd
+; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) [[ATTR0]] {
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:br label [[FOR_END:%.*]]
+; CHECK:   for.end:
+; CHECK-NEXT:unreachable
+;
+entry:
+  br label %for.cond
+for.cond:
+  %cmp = icmp slt i32 %a, %b
+  br i1 %cmp, label %for.body, label %for.end
+for.body:
+  br label %for.cond
+for.end:
+  br label %for.cond1
+for.cond1:
+  br label %for.cond1
+}
+
+;; Original C Code:
+;;  void known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
+;;for (int i = 0; i < 5; i++) ;
+;;  }
+
+define void @known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
+; CHECK-LABEL: define {{[^@]+}}@known_tripcount_no_mustprogress_attr_no_mustprogress_loopmd() {
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:br label [[FOR_END:%.*]]
+; CHECK:   for.end:
+; CHECK-NEXT:ret void
+;
+entry:
+  br label %for.cond
+for.cond:
+  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+  %cmp = icmp slt i32 %i.0, 5
+  br i1 %cmp, label %for.body, label %for.end
+for.body:
+  br label %for.inc
+for.inc:
+  %inc = add nsw i32 %i.0, 1
+  br label %for.cond
+for.end:
+  ret void
+}
+
+;; Original C Code:
+;;  void known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
+;;for (int i = 0; i < 5; i++) ;
+;;  }
+;;  => Added mustprogress loop attribute
+
+define void @known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
+; CHECK-LABEL: define {{[^@]+}}@known_tripcount_no_mustprogress_attr_mustprogress_loopmd() {
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:br label [[FOR_END:%.*]]
+; CHECK:   for.end:
+; CHECK-NEXT:ret void
+;
+entry:
+  br label %for.cond
+for.cond:
+  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+  %cmp = icmp slt i32 %i.0, 5
+  br i1 %cmp, label %for.body, label %for.end
+for.body:
+  br label %for.inc
+for.inc:
+  %inc = add 

[PATCH] D92837: [X86] Support tilezero intrinsic and c interface for AMX.

2020-12-30 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke updated this revision to Diff 314157.
LuoYuanke added a comment.

Add avx512f in test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92837

Files:
  clang/include/clang/Basic/BuiltinsX86_64.def
  clang/lib/Headers/amxintrin.h
  clang/test/CodeGen/X86/amx_api.c
  llvm/include/llvm/IR/IntrinsicsX86.td
  llvm/lib/Target/X86/X86ExpandPseudo.cpp
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/lib/Target/X86/X86InstrAMX.td
  llvm/lib/Target/X86/X86PreTileConfig.cpp
  llvm/lib/Target/X86/X86RegisterInfo.cpp
  llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll

Index: llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll
@@ -0,0 +1,38 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+amx-tile -mattr=+avx512f -verify-machineinstrs | FileCheck %s
+
+define void @test_amx(i8* %pointer, i8* %base, i64 %stride) {
+; CHECK-LABEL: test_amx:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:vpxord %zmm0, %zmm0, %zmm0
+; CHECK-NEXT:vmovdqu64 %zmm0, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $1, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:ldtilecfg -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, %ax
+; CHECK-NEXT:tilezero %tmm0
+; CHECK-NEXT:tileloadd (%rsi,%rdx), %tmm1
+; CHECK-NEXT:tileloadd (%rsi,%rdx), %tmm2
+; CHECK-NEXT:tdpbssd %tmm2, %tmm1, %tmm0
+; CHECK-NEXT:tilestored %tmm0, (%rdi,%rdx)
+; CHECK-NEXT:tilerelease
+; CHECK-NEXT:vzeroupper
+; CHECK-NEXT:retq
+  %c = call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
+  %a = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
+  %b = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
+  %d = call x86_amx @llvm.x86.tdpbssd.internal(i16 8, i16 8, i16 8, x86_amx %c, x86_amx %a, x86_amx %b)
+  call void @llvm.x86.tilestored64.internal(i16 8, i16 8, i8* %pointer, i64 %stride, x86_amx %d)
+
+  ret void
+}
+
+declare x86_amx @llvm.x86.tilezero.internal(i16, i16)
+declare x86_amx @llvm.x86.tileloadd64.internal(i16, i16, i8*, i64)
+declare x86_amx @llvm.x86.tdpbssd.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
+declare void @llvm.x86.tilestored64.internal(i16, i16, i8*, i64, x86_amx)
Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
===
--- llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -873,6 +873,7 @@
   // We only collect the tile shape that is defined.
   case X86::PTILELOADDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 MachineOperand  = MI->getOperand(1);
 MachineOperand  = MI->getOperand(2);
 ShapeT Shape(, , MRI);
Index: llvm/lib/Target/X86/X86PreTileConfig.cpp
===
--- llvm/lib/Target/X86/X86PreTileConfig.cpp
+++ llvm/lib/Target/X86/X86PreTileConfig.cpp
@@ -132,6 +132,7 @@
 llvm_unreachable("Unexpected machine instruction on tile");
   case X86::PTILELOADDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 MachineOperand  = const_cast(MI.getOperand(1));
 MachineOperand  = const_cast(MI.getOperand(2));
 ShapeT Shape(, , MRI);
@@ -230,6 +231,7 @@
   case X86::PTILELOADDV:
   case X86::PTILESTOREDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 unsigned NumOperands = MI.getNumOperands();
 MI.RemoveOperand(NumOperands - 1);
 MI.addOperand(MF, MachineOperand::CreateReg(CFG, false));
Index: llvm/lib/Target/X86/X86InstrAMX.td
===
--- llvm/lib/Target/X86/X86InstrAMX.td
+++ llvm/lib/Target/X86/X86InstrAMX.td
@@ -62,6 +62,9 @@
 def PTILESTOREDV : PseudoI<(outs), (ins GR16:$src1,
 GR16:$src2, opaquemem:$src3,
 TILE:$src4, TILECFG:$cfg), []>;
+def PTILEZEROV : PseudoI<(outs TILE: $dst), (ins GR16:$src1,
+ GR16:$src2,
+ TILECFG:$cfg), []>;
 
 let usesCustomInserter = 1 in {
   // Pseudo instructions, using immediates instead of tile registers.
Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
===
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -4641,6 +4641,18 @@
   ReplaceNode(Node, CNode);
   return;
 }
+

[PATCH] D93656: Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.

2020-12-30 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: llvm/tools/opt/NewPMDriver.cpp:136-138
+static cl::opt PseudoProbeForProfiling(
+"new-pm-pseudo-probe-for-profiling", cl::init(false), cl::Hidden,
+cl::desc("Emit pseudo probes to enable PGO profile generation."));

aeubanks wrote:
> hoy wrote:
> > dblaikie wrote:
> > > I guess this should probably have some separate testing, if it's a 
> > > separate flag/feature? (& flag+tests could be in a separate commit)
> > I'm not sure there's a separate need for this switch except for being 
> > tested in `unique-internal-linkage-names.ll`. The point of this whole patch 
> > is to place the unique name pass before the pseudo probe pass and test it 
> > works. Hence it sounds appropriate to me to include all changes in one 
> > patch. What do you think?
> +1 to hoy's comment. I don't think there's a need to make patches strictly as 
> incremental as possible if they're already small. (I would have been okay 
> with keeping the Clang change here FWIW)
I understand I'm a bit of a stickler for some of this stuff - though the 
particular reason I brought it up here is that this adds two flags, but doesn't 
test them separately, only together. So it's not clear/tested as to which 
behaviors are provided by which flags.

Separating the flags would make it clear that each flag/functionality was 
tested fully.

Please add test coverage for each flag separately, optionally separate this 
into two patches to make it clearer how each piece of functionality is tested.



Comment at: llvm/tools/opt/NewPMDriver.cpp:253-258
 if (DebugInfoForProfiling)
   P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
  true);
+else if (PseudoProbeForProfiling)
+  P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
+ false, true);

hoy wrote:
> dblaikie wrote:
> > Both of these might be more readably written as something like:
> > ```
> > P.emplace();
> > P.PseudoProbeForProfiling = true;
> > ```
> > & similar. (you can commit the change to DebugInfoForProfiling separately 
> > before/after this change to make it consistent with the new one)
> > 
> > But no big deal either way - while it makes these tidier it makes them a 
> > bit less consistent with the other three
> That looks cleaner, but there are assertions in the constructor of 
> `PGOOptions` which I would not like to bypass by setting the 
> `PseudoProbeForProfiling` field separately.
Ah, fair enough.

Though given the struct has publicly mutable members, these assertions aren't 
especially effective. Looks like they started being added here: 
https://reviews.llvm.org/D36040 - which I guess doesn't tell us much, but I was 
curious. Wonder if we could move the checks to somewhere more robust. (separate 
patch, in any case)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93656

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


[PATCH] D93822: [clang][Sema] Add diagnostics for implicit widening of multiplication result

2020-12-30 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: 
clang/test/Sema/implicit-widening-of-pointer-offset-in-array-subscript-expression.c:24
+void t1(char *base, int a, int b) {
+  // FIXME: test `[a * b]base` pattern?
+}

lebedev.ri wrote:
> dblaikie wrote:
> > lebedev.ri wrote:
> > > dblaikie wrote:
> > > > Question is unclear - is there uncertainty about whether this should be 
> > > > tested? Or is this a false negative case? In which case I'd probably 
> > > > include the test showing no diagnostic and mention it could be 
> > > > fixed/improved?
> > > I may be misremembering things, but IIRC `a[b]` and `b[a]` is the same 
> > > thing,
> > > but i'm not sure how to exercise the second spelling.
> > > I.e. i'm just not sure how to write a test for it.
> > > I may be misremembering things, but IIRC a[b] and b[a] is the same thing,
> > Yep, that's the case - `a[b]` where one of them is a pointer and teh other 
> > is an integer, is equivalent to `*(a + b)`, so that means it's the same as 
> > `b[a]`.
> > 
> > I guess you'd write it the same as t0, but with the expressions reversed? 
> > `return *(a * b)[base];`
> That's what i tried, and it does't work - https://godbolt.org/z/as4vP4
Sorry, my mistake - the `*` was wrong. This works: https://godbolt.org/z/j9jqx3


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93822

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


[PATCH] D91927: [X86] Add x86_amx type for intel AMX.

2020-12-30 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke added a comment.

Thank @pengfei and @MaskRay.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91927

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


[PATCH] D93940: [clang-tidy] Add a check for blocking types and functions.

2020-12-30 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:319
+assert(L);
+const auto *EV = L->ensureEvaluatedStmt();
+if (EV && EV->Evaluated.getKind() == APValue::ValueKind::None) {

Please don't use auto when type is not explicitly spelled in same statement or 
iterator.


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

https://reviews.llvm.org/D93940

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


[PATCH] D93873: [clangd] Cache preambles of closed files

2020-12-30 Thread Quentin Chateau via Phabricator via cfe-commits
qchateau updated this revision to Diff 314152.
qchateau added a comment.

- Fix keep preamble command line option
- Fix tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93873

Files:
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/TUScheduler.h
  clang-tools-extra/clangd/test/memory_tree.test
  clang-tools-extra/clangd/tool/ClangdMain.cpp
  clang-tools-extra/clangd/unittests/ClangdTests.cpp

Index: clang-tools-extra/clangd/unittests/ClangdTests.cpp
===
--- clang-tools-extra/clangd/unittests/ClangdTests.cpp
+++ clang-tools-extra/clangd/unittests/ClangdTests.cpp
@@ -1256,7 +1256,7 @@
   MemoryTree MT();
   Server.profile(MT);
   ASSERT_TRUE(MT.children().count("tuscheduler"));
-  EXPECT_TRUE(MT.child("tuscheduler").children().count(FooCpp));
+  EXPECT_TRUE(MT.child("tuscheduler").child("files").children().count(FooCpp));
 }
 } // namespace
 } // namespace clangd
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -347,6 +347,16 @@
 init(getDefaultAsyncThreadsCount()),
 };
 
+// Magic value to know when the user does not specify a value
+constexpr size_t DefaultKeepPreambleValue = std::numeric_limits::max();
+constexpr size_t DefaultKeepPreambleMemory = 10;
+constexpr size_t DefaultKeepPreambleDisk = 1000;
+opt KeepPreambles{
+"keep-preambles", cat(Misc),
+desc("Number of preambles of closed files that clangd will keep in cache.\n"
+ "Note that preambles may be stored in memory or in disk."),
+init(DefaultKeepPreambleValue)};
+
 opt IndexFile{
 "index-file",
 cat(Misc),
@@ -821,6 +831,13 @@
 Opts.StaticIndex = PAI.get();
   }
   Opts.AsyncThreadsCount = WorkerThreadsCount;
+
+  if (KeepPreambles == DefaultKeepPreambleValue) // User did not specify a value
+Opts.KeepPreambles = Opts.StorePreamblesInMemory ? DefaultKeepPreambleMemory
+ : DefaultKeepPreambleDisk;
+  else
+Opts.KeepPreambles = KeepPreambles;
+
   Opts.BuildRecoveryAST = RecoveryAST;
   Opts.PreserveRecoveryASTType = RecoveryASTType;
   Opts.FoldingRanges = FoldingRanges;
Index: clang-tools-extra/clangd/test/memory_tree.test
===
--- clang-tools-extra/clangd/test/memory_tree.test
+++ clang-tools-extra/clangd/test/memory_tree.test
@@ -57,20 +57,32 @@
 # CHECK-NEXT: }
 # CHECK-NEXT:   },
 # CHECK-NEXT:   "tuscheduler": {
-# CHECK-NEXT: "{{.*}}main.cpp": {
+# CHECK-NEXT: "_self": {{[0-9]+}},
+# CHECK-NEXT: "_total": {{[0-9]+}},
+# CHECK-NEXT: "cache": {
 # CHECK-NEXT:   "_self": {{[0-9]+}},
 # CHECK-NEXT:   "_total": {{[0-9]+}},
-# CHECK-NEXT:   "ast": {
-# CHECK-NEXT: "_self": {{[0-9]+}},
-# CHECK-NEXT: "_total": {{[0-9]+}}
-# CHECK-NEXT:   },
-# CHECK-NEXT:   "preamble": {
+# CHECK-NEXT:   "containers": {
 # CHECK-NEXT: "_self": {{[0-9]+}},
 # CHECK-NEXT: "_total": {{[0-9]+}}
 # CHECK-NEXT:   }
 # CHECK-NEXT: },
-# CHECK-NEXT: "_self": {{[0-9]+}},
-# CHECK-NEXT: "_total": {{[0-9]+}}
+# CHECK-NEXT: "files": {
+# CHECK-NEXT:   "{{.*}}main.cpp": {
+# CHECK-NEXT: "_self": {{[0-9]+}},
+# CHECK-NEXT: "_total": {{[0-9]+}},
+# CHECK-NEXT: "ast": {
+# CHECK-NEXT:   "_self": {{[0-9]+}},
+# CHECK-NEXT:   "_total": {{[0-9]+}}
+# CHECK-NEXT: },
+# CHECK-NEXT: "preamble": {
+# CHECK-NEXT:   "_self": {{[0-9]+}},
+# CHECK-NEXT:   "_total": {{[0-9]+}}
+# CHECK-NEXT: }
+# CHECK-NEXT:   },
+# CHECK-NEXT:   "_self": {{[0-9]+}},
+# CHECK-NEXT:   "_total": {{[0-9]+}}
+# CHECK-NEXT: }
 # CHECK-NEXT:   }
 # CHECK-NEXT: }
 # CHECK-NEXT:   }
Index: clang-tools-extra/clangd/TUScheduler.h
===
--- clang-tools-extra/clangd/TUScheduler.h
+++ clang-tools-extra/clangd/TUScheduler.h
@@ -197,6 +197,10 @@
 /// No-op if AsyncThreadsCount is 0.
 bool AsyncPreambleBuilds = true;
 
+// The number of preambles that will be retained even after the file is
+// closed
+size_t KeepPreambles = 0;
+
 /// Used to create a context that wraps each single operation.
 /// Typically to inject per-file configuration.
 /// If the path is empty, context sholud be "generic".
@@ -305,6 +309,9 @@
   /// an LRU cache.
   class ASTCache;
 
+  /// Responsible for retaining preambles.
+  

[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2020-12-30 Thread Ally Tiritoglu via Phabricator via cfe-commits
atirit updated this revision to Diff 314149.
atirit added a comment.

Fixed the FormatTest.ShortEnums unit test and fixed compatibility with 
`FormatTestCSharp.CSharpKeyWordEscaping` and `FormatTestJS.EnumDeclarations`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

Files:
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/unittests/Format/FormatTest.cpp


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -1344,8 +1344,7 @@
   Style.AllowShortEnumsOnASingleLine = true;
   verifyFormat("enum { A, B, C } ShortEnum1, ShortEnum2;", Style);
   Style.AllowShortEnumsOnASingleLine = false;
-  verifyFormat("enum\n"
-   "{\n"
+  verifyFormat("enum {\n"
"  A,\n"
"  B,\n"
"  C\n"
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1301,7 +1301,7 @@
   if (!parseEnum())
 break;
   // This only applies for C++.
-  if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) {
+  if (!Style.isCpp()) {
 addUnwrappedLine();
 return;
   }
@@ -2484,6 +2484,9 @@
 return true;
   }
 
+  if (!Style.AllowShortEnumsOnASingleLine && Style.BraceWrapping.AfterEnum)
+addUnwrappedLine();
+
   // Parse enum body.
   nextToken();
   if (!Style.AllowShortEnumsOnASingleLine) {


Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -1344,8 +1344,7 @@
   Style.AllowShortEnumsOnASingleLine = true;
   verifyFormat("enum { A, B, C } ShortEnum1, ShortEnum2;", Style);
   Style.AllowShortEnumsOnASingleLine = false;
-  verifyFormat("enum\n"
-   "{\n"
+  verifyFormat("enum {\n"
"  A,\n"
"  B,\n"
"  C\n"
Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1301,7 +1301,7 @@
   if (!parseEnum())
 break;
   // This only applies for C++.
-  if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) {
+  if (!Style.isCpp()) {
 addUnwrappedLine();
 return;
   }
@@ -2484,6 +2484,9 @@
 return true;
   }
 
+  if (!Style.AllowShortEnumsOnASingleLine && Style.BraceWrapping.AfterEnum)
+addUnwrappedLine();
+
   // Parse enum body.
   nextToken();
   if (!Style.AllowShortEnumsOnASingleLine) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2020-12-30 Thread Ally Tiritoglu via Phabricator via cfe-commits
atirit added a comment.

The `FormatTestJS.EnumDeclarations` test in fact isn't broken, but 
`FormatTest.ShortEnums` and `FormatTestCSharp.CSharpKeyWordEscaping` are.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

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


[PATCH] D93377: [Clang] Add __ibm128 type to represent ppc_fp128

2020-12-30 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/lib/AST/ASTContext.cpp:6230
 /// LHS < RHS, return -1.
 int ASTContext::getFloatingTypeOrder(QualType LHS, QualType RHS) const {
   FloatingRank LHSR = getFloatingRank(LHS);

qiucf wrote:
> hubert.reinterpretcast wrote:
> > nemanjai wrote:
> > > hubert.reinterpretcast wrote:
> > > > I think this function should vocally fail when presented with 
> > > > "unordered" cases.
> > > But is it possible to emit errors here or should there be code explicitly 
> > > added to Sema to disallow conversions between `__ibm128` and `__float128` 
> > > (and `long double` to/from either of those to which it is not equivalent)?
> > I did not mean a user-facing error message. I meant that there should be 
> > some form of assertion or internal diagnostic here. I believe `assert` is 
> > appropriate.
> > 
> > I will note that this is a public member function of ASTContext. Regardless 
> > of explicit code in Sema that does what you describe, I think this function 
> > should not present an interface where it does not report "unordered" cases 
> > as unordered.
> > 
> Adding assertion here makes `unsupportedTypeConversion` always fail in such 
> cases.
Yes, I know. I think `unsupportedTypeConversion` should avoid calling this 
function when it is possibly dealing with an "unordered" case unless if this 
function has a way of indicating "unordered" as a result. If there is a helper 
function for testing the unordered case in this class, then I think 
`unsupportedTypeConversion` can simply say that all ordered cases are supported 
(before doing more to figure out the unordered cases that are safe).



Comment at: clang/lib/Parse/ParseExprCXX.cpp:2245
+  case tok::kw___ibm128:
+DS.SetTypeSpecType(DeclSpec::TST_ibm128, Loc, PrevSpec, DiagID, Policy);
+break;

qiucf wrote:
> hubert.reinterpretcast wrote:
> > Not sure what the best method is to implement this, but `long double` and 
> > `__ibm128` are the same type for GCC when `-mabi=ibmlongdouble` is in 
> > effect.
> Seems clang is also different from GCC under `-mabi=ieeelongdouble`? I saw 
> `__float128` and `long double` are the same for GCC but not for clang.
Have you checked whether the new libstdc++ for which this support is being 
added needs the GCC behaviour to work properly?

The GCC behaviour allows the following to be compiled without introducing novel 
overload resolution tiebreakers:
```
void f(__float128);
void f(__ibm128);
void f(int);

long double ld;

int main() { f(ld); }
```



Comment at: clang/lib/Sema/SemaType.cpp:1562-1563
+if (!S.Context.getTargetInfo().hasIbm128Type() &&
+!S.getLangOpts().SYCLIsDevice &&
+!(S.getLangOpts().OpenMP && S.getLangOpts().OpenMPIsDevice))
+  S.Diag(DS.getTypeSpecTypeLoc(), diag::err_type_unsupported) << 
"__ibm128";

qiucf wrote:
> hubert.reinterpretcast wrote:
> > Do the SYCL and OpenMP device exceptions to the error really apply for 
> > `__ibm128`?
> If host supports `__ibm128` but device does not?
Can you add a test that makes use of this? Also, there should be a case that 
triggers `err_device_unsupported_type`.


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

https://reviews.llvm.org/D93377

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


[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2020-12-30 Thread Ally Tiritoglu via Phabricator via cfe-commits
atirit added a comment.

From what I can tell the unit tests are broken. Take `FormatTest.ShortEnums` 
for example. It passes the following code:

  enum
  {
A,
B,
C
  } ShortEnum1, ShortEnum2;

And expects no changes to be made.

However, format unit tests use the `BreakBeforeBraces: Attach` option. This 
option should attach braces to the same line, as demonstrated in the docs 
:

> `BS_Attach` (in configuration: `Attach`) Always attach braces to surrounding 
> context.
>
>   namespace N {
>   enum E {
> E1,
> E2,
>   };
>   // ...
>   }

I'm new to this project so please correct me if I'm wrong, but this appears to 
indicate broken tests. I'll push a commit with fixed tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

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


[PATCH] D87702: [Frontend] Add pragma align natural and sort out pragma pack stack effect

2020-12-30 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L updated this revision to Diff 314141.
Xiangling_L marked 6 inline comments as done.
Xiangling_L added a comment.

- used memcpy to burn AlignPackInfo into uint32_t and vice versa;
- named XL on AIX stack effect and related options after  "xl" instead of "aix"
- adjusted natural align related code


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

https://reviews.llvm.org/D87702

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/include/clang/Sema/Sema.h
  clang/include/clang/Serialization/ASTReader.h
  clang/include/clang/Serialization/ASTWriter.h
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Parse/ParsePragma.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaAttr.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/Driver/aix-pragma-pack.c
  clang/test/Layout/aix-double-struct-member.cpp
  clang/test/Layout/aix-power-natural-interaction.cpp
  clang/test/PCH/aix-pragma-pack.c
  clang/test/Sema/aix-pragma-pack-and-align.c

Index: clang/test/Sema/aix-pragma-pack-and-align.c
===
--- /dev/null
+++ clang/test/Sema/aix-pragma-pack-and-align.c
@@ -0,0 +1,231 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -fdump-record-layouts \
+// RUN: -fxl-pragma-pack -verify -fsyntax-only -x c++ %s | \
+// RUN:   FileCheck %s
+
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -fdump-record-layouts \
+// RUN: -fxl-pragma-pack -verify -fsyntax-only -x c++ %s | \
+// RUN:   FileCheck %s
+
+namespace test1 {
+#pragma align(natural)
+#pragma pack(4)
+#pragma pack(2)
+struct A {
+  int i;
+  double d;
+};
+
+int a = sizeof(A);
+#pragma pack()
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 4}}
+#pragma pack(pop)
+#pragma pack(show) // expected-warning {{value of #pragma pack(show) == 8}}
+struct B {
+  int i;
+  double d;
+};
+#pragma align(reset)
+
+int b = sizeof(B);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test1::A
+// CHECK-NEXT:  0 |   int i
+// CHECK-NEXT:  4 |   double d
+// CHECK-NEXT:| [sizeof=12, dsize=12, align=2, preferredalign=2,
+// CHECK-NEXT:|  nvsize=12, nvalign=2, preferrednvalign=2]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test1::B
+// CHECK-NEXT:  0 |   int i
+// CHECK-NEXT:  8 |   double d
+// CHECK-NEXT:| [sizeof=16, dsize=16, align=4, preferredalign=8,
+// CHECK-NEXT:|  nvsize=16, nvalign=4, preferrednvalign=8]
+
+} // namespace test1
+
+namespace test2 {
+#pragma align(natural)
+#pragma pack(2)
+struct A {
+  int i;
+  double d;
+};
+
+int a = sizeof(A);
+#pragma align(reset)
+
+struct B {
+  int i;
+  double d;
+};
+
+int b = sizeof(B);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test2::A
+// CHECK-NEXT:  0 |   int i
+// CHECK-NEXT:  4 |   double d
+// CHECK-NEXT:| [sizeof=12, dsize=12, align=2, preferredalign=2,
+// CHECK-NEXT:|  nvsize=12, nvalign=2, preferrednvalign=2]
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test2::B
+// CHECK-NEXT:  0 |   int i
+// CHECK-NEXT:  4 |   double d
+// CHECK-NEXT:| [sizeof=12, dsize=12, align=4, preferredalign=4,
+// CHECK-NEXT:|  nvsize=12, nvalign=4, preferrednvalign=4]
+
+} // namespace test2
+
+namespace test3 {
+#pragma pack(2)
+#pragma align(natural)
+struct A {
+  double d;
+};
+#pragma align(reset)
+#pragma pack(pop)
+
+int a = sizeof(A);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test3::A
+// CHECK-NEXT:  0 |   double d
+// CHECK-NEXT:| [sizeof=8, dsize=8, align=4, preferredalign=8,
+// CHECK-NEXT:|  nvsize=8, nvalign=4, preferrednvalign=8]
+
+} // namespace test3
+
+namespace test4 {
+#pragma pack(2)
+#pragma align(natural)
+#pragma pack(pop)
+
+struct A {
+  int i;
+  double d;
+} a;
+#pragma align(reset)
+#pragma pack(pop)
+
+int i = sizeof(A);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test4::A
+// CHECK-NEXT:  0 |   int i
+// CHECK-NEXT:  8 |   double d
+// CHECK-NEXT:| [sizeof=16, dsize=16, align=4, preferredalign=8,
+// CHECK-NEXT:|  nvsize=16, nvalign=4, preferrednvalign=8]
+
+} // namespace test4
+
+namespace test5 {
+#pragma align(power)
+#pragma align(natural)
+#pragma pack(2)
+#pragma align(reset)
+struct A {
+  int i;
+  double d;
+};
+#pragma align(reset)
+
+int a = sizeof(A);
+
+// CHECK:  *** Dumping AST Record Layout
+// CHECK-NEXT:  0 | struct test5::A
+// 

[PATCH] D90159: [DDG] Data Dependence Graph - DOT printer

2020-12-30 Thread Bardia Mahjour via Phabricator via cfe-commits
bmahjour added a comment.

In D90159#2466599 , @MaskRay wrote:

> Should this have some tests? Even if guarded by `REQUIRES:` if some feature 
> is needed.

Test coverage for the DDG functionality has been added under LIT and unittests. 
I've opened https://reviews.llvm.org/D93949 to add a test and verify the 
formatting of the dot file produced when using `-dot-ddg`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90159

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


[PATCH] D93940: [clang-tidy] Add a check for blocking types and functions.

2020-12-30 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/concurrency-async-blocking.rst:7
+Checks for some synchronous functions and types that volunteerly preempt system
+thread.  Volunteer preemption of a system thread in asynchronous code (e.g. in
+coroutines/fibers/green threads) is a bug that prevents the current thread from

Please fix double space.


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

https://reviews.llvm.org/D93940

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


[PATCH] D93940: [clang-tidy] Add a check for blocking types and functions.

2020-12-30 Thread Vasily Kulikov via Phabricator via cfe-commits
segoon added inline comments.



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/concurrency-async-blocking.cpp:450
+
+// TODO: remove CHECKT-MESSAGES

njames93 wrote:
> Whats this for?
WIP tests for not yet ready atomic::is_always_lock_free check


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

https://reviews.llvm.org/D93940

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


[PATCH] D93940: [clang-tidy] Add a check for blocking types and functions.

2020-12-30 Thread Vasily Kulikov via Phabricator via cfe-commits
segoon added inline comments.



Comment at: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:35
+/* C++ std */
+"std::mutex", //
+"std::timed_mutex",   //

njames93 wrote:
> Is it wise to fully qualify these?
> `::std::mutex`
> 
> Also whats with the comments at the end of each line, they don't seem to add 
> anything.
the comments signal clang-format not to join multiple items into a single line


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

https://reviews.llvm.org/D93940

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


[PATCH] D93940: [clang-tidy] Add a check for blocking types and functions.

2020-12-30 Thread Vasily Kulikov via Phabricator via cfe-commits
segoon updated this revision to Diff 314136.
segoon marked 19 inline comments as done.
segoon added a comment.

review fixes


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

https://reviews.llvm.org/D93940

Files:
  clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
  clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.h
  clang-tools-extra/clang-tidy/concurrency/CMakeLists.txt
  clang-tools-extra/clang-tidy/concurrency/ConcurrencyTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/concurrency-async-blocking.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/test/clang-tidy/checkers/concurrency-async-blocking.c
  clang-tools-extra/test/clang-tidy/checkers/concurrency-async-blocking.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/concurrency-async-blocking.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/concurrency-async-blocking.cpp
@@ -0,0 +1,449 @@
+// RUN: %check_clang_tidy %s concurrency-async-blocking %t -- \
+// RUN: -config='{CheckOptions: [{key: "concurrency-async-blocking.LockableExtra", value: "my::mutex;my::shared_mutex"}, {key: "concurrency-async-blocking.WaitableExtra", value: "my::Future;my::cv"}, {key: "concurrency-async-blocking.LockableExtra", value: "my::mutex;my::shared_mutex"}, {key: "concurrency-async-blocking.FunctionsExtra", value: "my_sleep;my::sleep"}, {key: "concurrency-async-blocking.TypesExtra", value: "my::big_lock;my::other_lock"}]}'
+
+/* Poor man's declaration of std::mutex and friends */
+namespace std {
+namespace chrono {
+class seconds {
+public:
+  seconds(int);
+};
+} // namespace chrono
+
+class mutex {
+public:
+  void lock();
+
+  // non-std methods
+  void lock_suffix();
+  void prefix_lock();
+
+  template 
+  void try_lock_for(Duration);
+};
+class recursive_mutex {};
+class recursive_timed_mutex {};
+class shared_mutex {};
+class shared_timed_mutex {};
+class mutex_suffix {};
+class prefix_mutex {};
+
+template 
+class unique_lock {
+public:
+  unique_lock(Lock &);
+
+  void lock();
+  template 
+  void try_lock_for(Duration);
+
+  // non-std methods
+  void lock_suffix();
+  void prefix_lock();
+};
+
+} // namespace std
+
+namespace ns {
+class mutex {};
+} // namespace ns
+
+class mutex {};
+
+template 
+class nonlock {};
+
+namespace my {
+class mutex {
+public:
+  void lock();
+};
+class shared_mutex {};
+class non_mutex {
+public:
+  void lock();
+};
+} // namespace my
+
+void test_lockable() {
+  std::mutex m;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'mutex' may sleep and is not coroutine-safe [concurrency-async-blocking]
+  ::std::mutex mns;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'mutex' may sleep and is not coroutine-safe [concurrency-async-blocking]
+  std::shared_mutex sm;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'shared_mutex' may sleep and is not coroutine-safe [concurrency-async-blocking]
+  std::recursive_mutex rm;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'recursive_mutex' may sleep and is not coroutine-safe [concurrency-async-blocking]
+  std::recursive_timed_mutex rtm;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'recursive_timed_mutex' may sleep and is not coroutine-safe [concurrency-async-blocking]
+  my::mutex mym;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'mutex' may sleep and is not coroutine-safe [concurrency-async-blocking]
+
+  std::mutex_suffix m1;
+  std::prefix_mutex m2;
+  ns::mutex m3;
+  mutex m4;
+  my::non_mutex myn;
+
+  m.lock();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'lock' may sleep and is not coroutine-safe [concurrency-async-blocking]
+  mns.lock();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'lock' may sleep and is not coroutine-safe [concurrency-async-blocking]
+  mym.lock();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method 'lock' may sleep and is not coroutine-safe [concurrency-async-blocking]
+  myn.lock();
+
+  m.lock_suffix();
+  m.prefix_lock();
+
+  std::unique_lock lock(m);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type 'unique_lock' may sleep and is not coroutine-safe [concurrency-async-blocking]
+
+  std::unique_lock l1(m1);
+  std::unique_lock l2(m2);
+  std::unique_lock l3(m3);
+  std::unique_lock l4(m4);
+
+  nonlock nonlock;
+}
+
+void sleep(int);
+void nanosleep(int);
+void usleep(int);
+void xsleep(int);
+void sleepx(int);
+void system(const char *);
+int wait(int *);
+int waitpid(int, int *, int);
+int waitid(int idtype, int id, int *infop, int options);
+
+struct rusage {};
+using pid_t = int;
+pid_t wait3(int *status, int options,
+struct rusage *rusage);
+
+pid_t wait4(pid_t pid, int *status, int options,
+struct rusage *rusage);
+
+namespace std {
+namespace this_thread {
+void yield();
+
+template 
+void sleep_for(Duration);
+
+template 
+void sleep_until(Duration);
+} // 

[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-30 Thread Albertas Vyšniauskas via Phabricator via cfe-commits
thezbyg updated this revision to Diff 314129.
thezbyg marked 3 inline comments as done.
thezbyg added a comment.

Added missing full stop.
Executed clang/doc/tools/dump_style.py to update ClangFormatStyleOptions.rst.


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

https://reviews.llvm.org/D93846

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/test/Format/access-modifiers.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -8540,6 +8540,186 @@
getLLVMStyle());
 }
 
+TEST_F(FormatTest, FormatsAccessModifiers) {
+  EXPECT_EQ("struct foo {\n"
+"  int i;\n"
+"\n"
+"private:\n"
+"  int j;\n"
+"}\n",
+format("struct foo {\n"
+   "  int i;\n"
+   "\n"
+   "private:\n"
+   "  int j;\n"
+   "}\n",
+   getLLVMStyle()));
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  int i;\n"
+   "}\n",
+   "struct foo {\n"
+   "private:\n"
+   "  int i;\n"
+   "}\n");
+  EXPECT_EQ("struct foo {\n"
+"  int i;\n"
+"\n"
+"private:\n"
+"  int j;\n"
+"}\n",
+format("struct foo {\n"
+   "  int i;\n"
+   "private:\n"
+   "  int j;\n"
+   "}\n",
+   getLLVMStyle()));
+  verifyFormat("struct foo {\n"
+   "  // comment\n"
+   "private:\n"
+   "  int j;\n"
+   "}\n",
+   "struct foo {\n"
+   "  // comment\n"
+   "private:\n"
+   "  int j;\n"
+   "}\n");
+  EXPECT_EQ("struct foo {\n"
+"  /* comment */\n"
+"private:\n"
+"  int j;\n"
+"}\n",
+format("struct foo {\n"
+   "  /* comment */\n"
+   "private:\n"
+   "  int j;\n"
+   "}\n",
+   getLLVMStyle()));
+  verifyFormat("struct foo {\n"
+   "#ifdef FOO\n"
+   "#endif\n"
+   "private:\n"
+   "  int i;\n"
+   "  int j;\n"
+   "}\n",
+   "struct foo {\n"
+   "#ifdef FOO\n"
+   "#endif\n"
+   "private:\n"
+   "  int i;\n"
+   "  int j;\n"
+   "}\n");
+  verifyFormat("struct foo {\n"
+   "#ifdef FOO\n"
+   "private:\n"
+   "#endif\n"
+   "  int i;\n"
+   "  int j;\n"
+   "}\n",
+   "struct foo {\n"
+   "#ifdef FOO\n"
+   "private:\n"
+   "#endif\n"
+   "  int i;\n"
+   "  int j;\n"
+   "}\n");
+  FormatStyle Style = getLLVMStyle();
+  Style.EmptyLineBeforeAccessModifier = false;
+  verifyFormat("struct foo {\n"
+   "  int i;\n"
+   "private:\n"
+   "  int j;\n"
+   "}\n",
+   "struct foo {\n"
+   "  int i;\n"
+   "\n"
+   "private:\n"
+   "  int j;\n"
+   "}\n",
+   Style);
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  int i;\n"
+   "  int j;\n"
+   "}\n",
+   "struct foo {\n"
+   "private:\n"
+   "  int i;\n"
+   "  int j;\n"
+   "}\n",
+   Style);
+  verifyFormat("struct foo {\n"
+   "private:\n"
+   "  int i;\n"
+   "  int j;\n"
+   "}\n",
+   "struct foo {\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "  int j;\n"
+   "}\n",
+   Style);
+  verifyFormat("struct foo {\n"
+   "  // comment\n"
+   "private:\n"
+   "  int i;\n"
+   "  int j;\n"
+   "}\n",
+   "struct foo {\n"
+   "  // comment\n"
+   "\n"
+   "private:\n"
+   "  int i;\n"
+   "  int j;\n"
+   "}\n",
+   Style);
+  EXPECT_EQ("struct foo {\n"
+"  /* comment */\n"
+"private:\n"
+"  int i;\n"
+"  int j;\n"
+"}\n",
+format("struct foo {\n"
+   "  /* comment */\n"
+   "\n"
+   

[PATCH] D91927: [X86] Add x86_amx type for intel AMX.

2020-12-30 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

D93944  fixed an llvm-c-test issue. Note, 
adding new enum members usually requires `check-all` (at least `check-llvm`, 
but Clang may use these enum as well).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91927

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


[PATCH] D93942: [OpenCL] Improve online documentation.

2020-12-30 Thread Marco Antognini via Phabricator via cfe-commits
mantognini added a comment.

Looks good, only a few typos and minor comments.




Comment at: clang/docs/OpenCLSupport.rst:69
++==+==+==+===+
+| Command line interface   | New value for `-cl-std` flag  
   | :good:`done` | https://reviews.llvm.org/D88300 
 |
++--+--+--+---+

I'm not sure it matters, but just in case it messes up with the rendering: the 
last `|` is not aligned.



Comment at: clang/docs/UsersManual.rst:2832-2833
+Note that if compiled to bitcode for generic targets such as SPIR,
+portable IR is produced i.e. it can be used with various vendor
+tools as well as open source tools i.e. `SPIRV-LLVM Translator
+`_





Comment at: clang/docs/UsersManual.rst:2864-2868
+Adds builtin function declarations during compilations. By default
+the OpenCL headers are not loaded and therefore the builtin functions
+ are not declared. To load them automatically this flag can be
+passed to the frontend (see also :ref:`the section on the OpenCL Header
+`):

This also applies to types I believe (e.g. int2). Maybe this paragraph should 
be slightly altered to reflect this?



Comment at: clang/docs/UsersManual.rst:2875
+Note that this is a frontend-only flag and therefore it requires the use of
+flags that forward options to the frontend e.g. `-cc1` or `-Xclang`.
+





Comment at: clang/docs/UsersManual.rst:2877
+
+Alternatively the internal header with the declarations can be added manually
+using ``-include`` or ``-I`` followed by the path to the header





Comment at: clang/docs/UsersManual.rst:2894
 
-Disables support of OpenCL extensions. All OpenCL targets provide a list
+Disables support of OpenCL extensions. All OpenCL targets set a list
 of extensions that they support. Clang allows to amend this using the 
``-cl-ext``

I feel "provide" was slightly better.



Comment at: clang/docs/UsersManual.rst:3059
+underscore to avoid clashing with user space identifiers. Vendor extension
+ca have reserved prefix name e.g. amd, arm, intel.
 





Comment at: clang/docs/UsersManual.rst:3242-3245
+in`the latest build
 
`_.
+or in `the official release
+`_





Comment at: clang/docs/UsersManual.rst:3279-3280
+In OpenCL versions earlier than v2.2 there is no support for invoking global
+constructors. However, an easy workaround would be to manually enqueue the
+constructor initialization kernel that has the following name sceme
+``_GLOBAL__sub_I_``.





Comment at: clang/docs/UsersManual.rst:3303
+There is no manual workaround for the construction of static objects with 
non-trivial
+constructors inside the functions.
 




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

https://reviews.llvm.org/D93942

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


[PATCH] D92792: [clang] - Also look for devtoolset-10

2020-12-30 Thread Stephan Dollberg via Phabricator via cfe-commits
stephan.dollberg added a comment.

Ping @phosek


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92792

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


[PATCH] D93817: Update transformations to use poison for insertelement/shufflevector's placeholder value

2020-12-30 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune added a comment.

I'll share the result after checking the validity of this patch using alive2.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93817

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


[PATCH] D93817: Update transformations to use poison for new insertelement's placeholder value

2020-12-30 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune updated this revision to Diff 314123.
aqjune added a comment.
Herald added subscribers: cfe-commits, pengfei, aheejin, jgravelle-google, 
sbc100, dschuff.
Herald added a project: clang.

Rebase, update transformations with shufflevector involved too


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93817

Files:
  clang/test/CodeGen/SystemZ/builtins-systemz-zvector-constrained.c
  clang/test/CodeGen/SystemZ/builtins-systemz-zvector.c
  clang/test/CodeGen/SystemZ/builtins-systemz-zvector2-constrained.c
  clang/test/CodeGen/SystemZ/builtins-systemz-zvector2.c
  clang/test/CodeGen/X86/avx-shuffle-builtins.c
  clang/test/CodeGen/aarch64-bf16-dotprod-intrinsics.c
  clang/test/CodeGen/aarch64-bf16-getset-intrinsics.c
  clang/test/CodeGen/aarch64-bf16-lane-intrinsics.c
  clang/test/CodeGen/aarch64-bf16-ldst-intrinsics.c
  clang/test/CodeGen/aarch64-neon-dot-product.c
  clang/test/CodeGen/arm-bf16-convert-intrinsics.c
  clang/test/CodeGen/arm-bf16-dotprod-intrinsics.c
  clang/test/CodeGen/arm-bf16-getset-intrinsics.c
  clang/test/CodeGen/arm-neon-dot-product.c
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/InterleavedAccessPass.cpp
  llvm/lib/Target/X86/X86InstCombineIntrinsic.cpp
  llvm/lib/Target/X86/X86InterleavedAccess.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Scalar/Scalarizer.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
  
llvm/test/Transforms/CodeGenPrepare/ARM/sink-add-mul-shufflevector-inseltpoison.ll
  
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll
  llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts.ll
  llvm/test/Transforms/InstCombine/X86/x86-avx2-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-avx2.ll
  llvm/test/Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-avx512.ll
  llvm/test/Transforms/InstCombine/X86/x86-f16c-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-f16c.ll
  llvm/test/Transforms/InstCombine/X86/x86-vector-shifts-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-vector-shifts.ll
  llvm/test/Transforms/InstCombine/X86/x86-vpermil-inseltpoison.ll
  llvm/test/Transforms/InstCombine/X86/x86-vpermil.ll
  llvm/test/Transforms/InstCombine/bitcast-vec-canon-inseltpoison.ll
  llvm/test/Transforms/InstCombine/bitcast-vec-canon.ll
  llvm/test/Transforms/InstCombine/broadcast-inseltpoison.ll
  llvm/test/Transforms/InstCombine/broadcast.ll
  llvm/test/Transforms/InstCombine/canonicalize-vector-extract.ll
  llvm/test/Transforms/InstCombine/extractelement-inseltpoison.ll
  llvm/test/Transforms/InstCombine/extractelement.ll
  llvm/test/Transforms/InstCombine/gep-inbounds-null.ll
  llvm/test/Transforms/InstCombine/getelementptr.ll
  llvm/test/Transforms/InstCombine/icmp-vec-inseltpoison.ll
  llvm/test/Transforms/InstCombine/icmp-vec.ll
  llvm/test/Transforms/InstCombine/insert-extract-shuffle-inseltpoison.ll
  llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll
  llvm/test/Transforms/InstCombine/masked_intrinsics-inseltpoison.ll
  llvm/test/Transforms/InstCombine/masked_intrinsics.ll
  llvm/test/Transforms/InstCombine/obfuscated_splat-inseltpoison.ll
  llvm/test/Transforms/InstCombine/obfuscated_splat.ll
  llvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll
  llvm/test/Transforms/InstCombine/select-extractelement-inseltpoison.ll
  llvm/test/Transforms/InstCombine/select-extractelement.ll
  llvm/test/Transforms/InstCombine/shufflevector-div-rem-inseltpoison.ll
  llvm/test/Transforms/InstCombine/shufflevector-div-rem.ll
  llvm/test/Transforms/InstCombine/trunc-extractelement-inseltpoison.ll
  llvm/test/Transforms/InstCombine/trunc-extractelement.ll
  llvm/test/Transforms/InstCombine/trunc-inseltpoison.ll
  llvm/test/Transforms/InstCombine/trunc.ll
  llvm/test/Transforms/InstCombine/vec-binop-select-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vec-binop-select.ll
  llvm/test/Transforms/InstCombine/vec_demanded_elts-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vec_demanded_elts.ll
  llvm/test/Transforms/InstCombine/vec_gep_scalar_arg-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vec_shuffle-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vec_shuffle.ll
  llvm/test/Transforms/InstCombine/vector-casts-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vector_insertelt_shuffle-inseltpoison.ll
  llvm/test/Transforms/InstCombine/vector_insertelt_shuffle.ll
  llvm/test/Transforms/InstCombine/vscale_cmp.ll
  llvm/test/Transforms/InstSimplify/insertelement.ll
  

[PATCH] D93940: [clang-tidy] Add a check for blocking types and functions.

2020-12-30 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:1
+//===--- AsyncBlockingCheck.cpp - clang-tidy ===//
+//

Please make length same as end of comment.



Comment at: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.h:27
+  void storeOptions(ClangTidyOptions::OptionMap ) override;
+
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;

Please remove empty line between methods. See other checks as example. Same 
below.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/concurrency-async-blocking.rst:6
+
+Checks for some synchronous functions and types that volunteerly preempt 
system thread.
+Volunteer preemption of a system thread in asynchronous code

Please distribute words more evenly up to 80 characters.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/concurrency-async-blocking.rst:13
+The preemptive functions/types can be separated into the following categories:
+ - explicit sleep(3)-like functions
+ - sleeping/waiting synchronization primitives

See other documentation for example of lists. Same below.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/concurrency-async-blocking.rst:28
+  Specifies additional lock type names separated with semicolon. Usually they
+  implement C++17 BasicLockable, Lockable, TimedLockable, Mutex, or TimedMutex
+  requirement or has one or several methods from the following list:

Will be good idea to highlight `BasicLockable` and other with single back-ticks.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/concurrency-async-blocking.rst:30
+  requirement or has one or several methods from the following list:
+- `lock`
+- `try_lock_for`

Please use double beck-ticks for language constructs. Same below.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/concurrency-async-blocking.rst:68
+
+  Specifies whether search for std::atomic types which are not always 
lock-free.
+  Non-lockfree atomics use std synchronization primitives (e.g. std::mutex), so

Please highlight `std::atomic` with double back-ticks.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/concurrency-async-blocking.rst:69
+  Specifies whether search for std::atomic types which are not always 
lock-free.
+  Non-lockfree atomics use std synchronization primitives (e.g. std::mutex), so
+  they may block current system thread for a while. If such accesses are

Please highlight `std::mutex` with double back-ticks.



Comment at: 
clang-tools-extra/docs/clang-tidy/checks/concurrency-async-blocking.rst:74
+
+  If set to true, checks `std::atomic::is_always_lock_free` and warns about
+  `std::atomic`.

Please use double beck-ticks for language constructs. Same below.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93940

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


[PATCH] D93656: Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.

2020-12-30 Thread Arthur Eubanks via Phabricator via cfe-commits
aeubanks added inline comments.



Comment at: llvm/tools/opt/NewPMDriver.cpp:136-138
+static cl::opt PseudoProbeForProfiling(
+"new-pm-pseudo-probe-for-profiling", cl::init(false), cl::Hidden,
+cl::desc("Emit pseudo probes to enable PGO profile generation."));

hoy wrote:
> dblaikie wrote:
> > I guess this should probably have some separate testing, if it's a separate 
> > flag/feature? (& flag+tests could be in a separate commit)
> I'm not sure there's a separate need for this switch except for being tested 
> in `unique-internal-linkage-names.ll`. The point of this whole patch is to 
> place the unique name pass before the pseudo probe pass and test it works. 
> Hence it sounds appropriate to me to include all changes in one patch. What 
> do you think?
+1 to hoy's comment. I don't think there's a need to make patches strictly as 
incremental as possible if they're already small. (I would have been okay with 
keeping the Clang change here FWIW)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93656

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


[PATCH] D93031: Enable fexec-charset option

2020-12-30 Thread Abhina Sree via Phabricator via cfe-commits
abhina.sreeskantharajan added inline comments.



Comment at: clang/lib/Lex/LiteralSupport.cpp:1593-1597
+  ConversionState State = TranslationState;
+  if (Kind == tok::wide_string_literal)
+State = TranslateToSystemCharset;
+  else if (isUTFLiteral(Kind))
+State = NoTranslation;

tahonermann wrote:
> The stored `TranslationState` should not be completely ignored for wide and 
> UTF string literals.  The standard permits things like the following.
>   #pragma rigoot L"bozit"
>   #pragma rigoot u"bozit"
>   _Pragma(L"rigoot bozit")
>   _Pragma(u8"rigoot bozit")
> For at least the `_Pragma(L"...")` case, the C++ standard [[ 
> http://eel.is/c++draft/cpp.pragma.op | states ]] the `L` is ignored, but it 
> doesn't say anything about other encoding prefixes.
Please correct me if I'm wrong, these Pragma strings are not parsed through 
StringLiteralParser, they are parsed in **clang/lib/Lex/Pragma.cpp** in this 
function.
**void Preprocessor::Handle_Pragma(Token )**
So if they require translation, it would need to be done in that function.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93031

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


[PATCH] D93844: [clang-format] Add possibility to be based on parent directory

2020-12-30 Thread Nathan James via Phabricator via cfe-commits
njames93 added inline comments.



Comment at: clang/lib/Format/Format.cpp:2962
+llvm::sys::path::filename(FileName));
+if (auto OuterStyle = getStyle(DefaultFormatStyle, FileForLanguage,
+   FallbackStyleName, Code, FS,

HazardyKnusperkeks wrote:
> njames93 wrote:
> > This seems a very inefficient way of doing this, getStyle does a lot of 
> > things we simple don't need to worry about. Maybe the file loading part 
> > should be extracted out into its own function, that can then recursively 
> > call itself. Or use the clang-tidy approach of storing configurations in a 
> > stack (will have to be unparsed cause how clang-format works) and then 
> > parse them on top of each other.
> Yeah I know that this is double work, but I thought it only affects the case 
> `BasedOnStyle: File` and keeps the "normal" way untouched.
> 
> If I do build a stack I would actually parse all `.clang-format` files up to 
> the root directory and in the not `BasedOnStyle: File` case throw away the 
> results, wouldn't I? The question is how often someone has a `.clang-fomrat` 
> in one of his parent directories which is not used because it got overwritten.
> 
> But I can do that.
> 
> Or is there an easy way to just check the `BasedOnStyle` value? As far as I 
> understood the yaml code it parses the whole file into an internal structure 
> and we only query this structure, right?
> Yeah I know that this is double work, but I thought it only affects the case 
> `BasedOnStyle: File` and keeps the "normal" way untouched.
> 
> If I do build a stack I would actually parse all `.clang-format` files up to 
> the root directory and in the not `BasedOnStyle: File` case throw away the 
> results, wouldn't I? The question is how often someone has a `.clang-fomrat` 
> in one of his parent directories which is not used because it got overwritten.

I'm not saying start at the route directory and work down to the child. Still 
start at the child, but when you parse a configuration that has needs the 
parent, put that unparsed config into a stack, then carry on. At the end then 
you can join all those configurations
> 
> But I can do that.
> 
> Or is there an easy way to just check the `BasedOnStyle` value? As far as I 
> understood the yaml code it parses the whole file into an internal structure 
> and we only query this structure, right?
It should be possible, not an expert but I'm not sure it like being traversed 
multiple times normally, though a workaround should be feasible. 




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93844

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


[PATCH] D93031: Enable fexec-charset option

2020-12-30 Thread Abhina Sree via Phabricator via cfe-commits
abhina.sreeskantharajan marked 2 inline comments as done.
abhina.sreeskantharajan added inline comments.



Comment at: clang/lib/Lex/LiteralSupport.cpp:235
+Converter->convert(std::string(1, ByteChar), ResultCharConv);
+memcpy((void *), ResultCharConv.data(), sizeof(unsigned));
+  }

tahonermann wrote:
> As Richard previously noted, this `memcpy()` needs to be addressed.  The 
> intended behavior here is not clear.  Are there valid scenarios in which the 
> conversion will produce a sequence of more than one code units?  I believe 
> the input is limited to ASCII characters and invalid code units (e.g., a lead 
> byte of a UTF-8 sequence) and in the latter case, an error and/or 
> substitution of a `?` (in the execution encoding) seem like acceptable 
> behaviors to me.
I replaced memcpy with an assignment. Please let me know if there is a better 
solution. 



Comment at: clang/lib/Lex/LiteralSupport.cpp:238
+  void *Pointer = 
+  memcpy(Pointer, ResultCharConv.data(), sizeof(unsigned));
+}

abhina.sreeskantharajan wrote:
> rsmith wrote:
> > What should happen if the result doesn't fit into an `unsigned`? This also 
> > appears to be making problematic assumptions about the endianness of the 
> > host. If we really want to pack multiple bytes of encoded output into a 
> > single `unsigned` result value (which itself seems dubious), we should do 
> > so with an endianness that doesn't depend on the host.
> This may be a problem we need to revisit since ResultChar is expecting a char.
I added an assertion for this case where the size of the character increases 
after translation. I've also removed the memcpy to avoid endianness issues.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93031

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


[PATCH] D93031: Enable fexec-charset option

2020-12-30 Thread Abhina Sree via Phabricator via cfe-commits
abhina.sreeskantharajan updated this revision to Diff 314115.
abhina.sreeskantharajan added a comment.

This patch replaces the memcpy in CharLiteralParser with an assignment. I've 
added an assertion for cases where the character size increases after 
translation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93031

Files:
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Basic/TokenKinds.h
  clang/include/clang/Driver/Options.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/include/clang/Lex/LiteralTranslator.h
  clang/include/clang/Lex/Preprocessor.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Lex/CMakeLists.txt
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/LiteralTranslator.cpp
  clang/lib/Lex/Preprocessor.cpp
  clang/test/CodeGen/systemz-charset.c
  clang/test/CodeGen/systemz-charset.cpp
  clang/test/Driver/cl-options.c
  clang/test/Driver/clang_f_opts.c
  llvm/include/llvm/ADT/Triple.h
  llvm/lib/Support/Triple.cpp

Index: llvm/lib/Support/Triple.cpp
===
--- llvm/lib/Support/Triple.cpp
+++ llvm/lib/Support/Triple.cpp
@@ -1023,6 +1023,13 @@
   return Tmp.split('-').second;  // Strip second component
 }
 
+// System charset on z/OS is IBM-1047 and UTF-8 otherwise
+StringRef Triple::getSystemCharset() const {
+  if (getOS() == llvm::Triple::ZOS)
+return "IBM-1047";
+  return "UTF-8";
+}
+
 static unsigned EatNumber(StringRef ) {
   assert(!Str.empty() && Str[0] >= '0' && Str[0] <= '9' && "Not a number");
   unsigned Result = 0;
Index: llvm/include/llvm/ADT/Triple.h
===
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -390,6 +390,9 @@
   /// if the environment component is present).
   StringRef getOSAndEnvironmentName() const;
 
+  /// getSystemCharset - Get the system charset of the triple.
+  StringRef getSystemCharset() const;
+
   /// @}
   /// @name Convenience Predicates
   /// @{
Index: clang/test/Driver/clang_f_opts.c
===
--- clang/test/Driver/clang_f_opts.c
+++ clang/test/Driver/clang_f_opts.c
@@ -209,8 +209,14 @@
 // RUN: %clang -### -S -finput-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-CHARSET %s
 // CHECK-INVALID-CHARSET: error: invalid value 'iso-8859-1' in '-finput-charset=iso-8859-1'
 
-// RUN: %clang -### -S -fexec-charset=iso-8859-1 -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s
-// CHECK-INVALID-INPUT-CHARSET: error: invalid value 'iso-8859-1' in '-fexec-charset=iso-8859-1'
+// RUN: %clang -### -S -fexec-charset=invalid-charset -o /dev/null %s 2>&1 | FileCheck -check-prefix=CHECK-INVALID-INPUT-CHARSET %s
+// CHECK-INVALID-INPUT-CHARSET: error: invalid value 'invalid-charset' in '-fexec-charset'
+
+// Test that we support the following exec charsets.
+// RUN: %clang -### -S -fexec-charset=UTF-8 -o /dev/null %s 2>&1 | FileCheck --check-prefix=INVALID %s
+// RUN: %clang -### -S -fexec-charset=ISO8859-1 -o /dev/null %s 2>&1 | FileCheck --check-prefix=INVALID %s
+// RUN: %clang -### -S -fexec-charset=IBM-1047 -o /dev/null %s 2>&1 | FileCheck --check-prefix=INVALID %s
+// INVALID-NOT: error: invalid value
 
 // Test that we don't error on these.
 // RUN: %clang -### -S -Werror\
@@ -224,7 +230,7 @@
 // RUN: -fident -fno-ident\
 // RUN: -fimplicit-templates -fno-implicit-templates  \
 // RUN: -finput-charset=UTF-8 \
-// RUN: -fexec-charset=UTF-8 \
+// RUN: -fexec-charset=UTF-8  \
 // RUN: -fivopts -fno-ivopts  \
 // RUN: -fnon-call-exceptions -fno-non-call-exceptions\
 // RUN: -fpermissive -fno-permissive  \
Index: clang/test/Driver/cl-options.c
===
--- clang/test/Driver/cl-options.c
+++ clang/test/Driver/cl-options.c
@@ -209,10 +209,11 @@
 // RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
 // source-charset-utf-16: invalid value 'utf-16' in '/source-charset:utf-16'
 
-// /execution-charset: should warn on everything except UTF-8.
-// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s
-// execution-charset-utf-16: invalid value 'utf-16' in '/execution-charset:utf-16'
+// /execution-charset: should warn on invalid charsets.
+// RUN: 

[PATCH] D91927: [X86] Add x86_amx type for intel AMX.

2020-12-30 Thread Mikael Holmén via Phabricator via cfe-commits
uabelho added inline comments.



Comment at: llvm/include/llvm/IR/Type.h:68
 X86_MMXTyID,   ///< MMX vectors (64 bits, X86 specific)
+X86_AMXTyID,   ///< AMX vectors (8192 bits, X86 specific)
 TokenTyID, ///< Tokens

pengfei wrote:
> uabelho wrote:
> > This addition causes a compilation warning in HexagonTargetObjectFile.cpp:
> > 
> > ```
> > ../lib/Target/Hexagon/HexagonTargetObjectFile.cpp:297:11: error: 
> > enumeration value 'X86_AMXTyID' not handled in switch [-Werror,-Wswitch]
> >   switch (Ty->getTypeID()) {
> >   ^
> > 1 error generated.
> > ```
> > Seen in build bots, e.g. here:
> > http://lab.llvm.org:8011/#/builders/57/builds/2889/steps/6/logs/stdio
> Thanks Mikael for pointing it out. I think we just need to put the type in 
> the switch table. I've posted a patch to fix it. rG16c2067cf212.
Yep, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91927

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


[PATCH] D91927: [X86] Add x86_amx type for intel AMX.

2020-12-30 Thread Pengfei Wang via Phabricator via cfe-commits
pengfei added inline comments.



Comment at: llvm/include/llvm/IR/Type.h:68
 X86_MMXTyID,   ///< MMX vectors (64 bits, X86 specific)
+X86_AMXTyID,   ///< AMX vectors (8192 bits, X86 specific)
 TokenTyID, ///< Tokens

uabelho wrote:
> This addition causes a compilation warning in HexagonTargetObjectFile.cpp:
> 
> ```
> ../lib/Target/Hexagon/HexagonTargetObjectFile.cpp:297:11: error: enumeration 
> value 'X86_AMXTyID' not handled in switch [-Werror,-Wswitch]
>   switch (Ty->getTypeID()) {
>   ^
> 1 error generated.
> ```
> Seen in build bots, e.g. here:
> http://lab.llvm.org:8011/#/builders/57/builds/2889/steps/6/logs/stdio
Thanks Mikael for pointing it out. I think we just need to put the type in the 
switch table. I've posted a patch to fix it. rG16c2067cf212.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91927

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


[PATCH] D93942: [OpenCL] Improve online documentation.

2020-12-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia updated this revision to Diff 314111.
Anastasia added a comment.

Fixed some build warning/formating issues.


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

https://reviews.llvm.org/D93942

Files:
  clang/docs/OpenCLSupport.rst
  clang/docs/UsersManual.rst

Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -41,7 +41,8 @@
variants depending on base language.
 -  :ref:`C++ Language `
 -  :ref:`Objective C++ Language `
--  :ref:`OpenCL C Language `: v1.0, v1.1, v1.2, v2.0.
+-  :ref:`OpenCL Kernel Language `: OpenCL C v1.0, v1.1, v1.2, v2.0,
+   plus C++ for OpenCL.
 
 In addition to these base languages and their dialects, Clang supports a
 broad variety of language extensions, which are documented in the
@@ -2796,8 +2797,8 @@
 ===
 
 Clang can be used to compile OpenCL kernels for execution on a device
-(e.g. GPU). It is possible to compile the kernel into a binary (e.g. for AMD or
-Nvidia targets) that can be uploaded to run directly on a device (e.g. using
+(e.g. GPU). It is possible to compile the kernel into a binary (e.g. for AMDGPU)
+that can be uploaded to run directly on a device (e.g. using
 `clCreateProgramWithBinary
 `_) or
 into generic bitcode files loadable into other toolchains.
@@ -2824,13 +2825,26 @@
 
  $ clang -c -emit-llvm test.cl
 
-This will produce a generic test.bc file that can be used in vendor toolchains
+This will produce test.bc file that can be used in vendor toolchains
 to perform machine code generation.
 
-Clang currently supports OpenCL C language standards up to v2.0. Starting from
-clang 9 a C++ mode is available for OpenCL (see
+Note that if compiled to bitcode for generic targets such as SPIR,
+portable IR is produced i.e. it can be used with various vendor
+tools as well as open source tools i.e. `SPIRV-LLVM Translator
+`_
+to produce SPIR-V binary.
+
+
+Clang currently supports OpenCL C language standards up to v2.0. Clang mainly
+supports full profile, there is only very limited support of the embedded
+profile. 
+Starting from clang 9 a C++ mode is available for OpenCL (see
 :ref:`C++ for OpenCL `).
 
+There is ongoing support for OpenCL v3.0 that is documented along with other
+experimental functionality and features in development on :doc:`OpenCLSupport`
+page.
+
 OpenCL Specific Options
 ---
 
@@ -2847,30 +2861,37 @@
 
 .. option:: -finclude-default-header
 
-Loads standard includes during compilations. By default OpenCL headers are not
-loaded and therefore standard library includes are not available. To load them
-automatically a flag has been added to the frontend (see also :ref:`the section
-on the OpenCL Header `):
+Adds builtin function declarations during compilations. By default
+the OpenCL headers are not loaded and therefore the builtin functions
+ are not declared. To load them automatically this flag can be
+passed to the frontend (see also :ref:`the section on the OpenCL Header
+`):
 
.. code-block:: console
 
  $ clang -Xclang -finclude-default-header test.cl
 
-Alternatively ``-include`` or ``-I`` followed by the path to the header location
-can be given manually.
+Note that this is a frontend-only flag and therefore it requires the use of
+flags that forward options to the frontend e.g. `-cc1` or `-Xclang`.
+
+Alternatively the internal header with the declarations can be added manually
+using ``-include`` or ``-I`` followed by the path to the header
+location. The header can be found in the clang source tree or installation
+directory.
 
.. code-block:: console
 
- $ clang -I/lib/Headers/opencl-c.h test.cl
+ $ clang -I/lib/Headers/opencl-c.h test.cl
+ $ clang -I/lib/clang//include/opencl-c.h/opencl-c.h test.cl
 
-In this case the kernel code should contain ``#include `` just as a
-regular C include.
+In this example it is assumed that the kernel code contains
+``#include `` just as a regular C include.
 
 .. _opencl_cl_ext:
 
 .. option:: -cl-ext
 
-Disables support of OpenCL extensions. All OpenCL targets provide a list
+Disables support of OpenCL extensions. All OpenCL targets set a list
 of extensions that they support. Clang allows to amend this using the ``-cl-ext``
 flag with a comma-separated list of extensions prefixed with ``'+'`` or ``'-'``.
 The syntax: ``-cl-ext=<(['-'|'+'][,])+>``,  where extensions
@@ -2878,6 +2899,10 @@
 `_
 or any known vendor extension. Alternatively, ``'all'`` can be used to enable
 or disable all known extensions.
+
+Note that this is a frontend-only flag and therefore it requires the use of
+flags that forward options to the frontend e.g. `-cc1` or `-Xclang`.
+
 Example disabling double support for the 64-bit 

[PATCH] D91927: [X86] Add x86_amx type for intel AMX.

2020-12-30 Thread Mikael Holmén via Phabricator via cfe-commits
uabelho added inline comments.



Comment at: llvm/include/llvm/IR/Type.h:68
 X86_MMXTyID,   ///< MMX vectors (64 bits, X86 specific)
+X86_AMXTyID,   ///< AMX vectors (8192 bits, X86 specific)
 TokenTyID, ///< Tokens

This addition causes a compilation warning in HexagonTargetObjectFile.cpp:

```
../lib/Target/Hexagon/HexagonTargetObjectFile.cpp:297:11: error: enumeration 
value 'X86_AMXTyID' not handled in switch [-Werror,-Wswitch]
  switch (Ty->getTypeID()) {
  ^
1 error generated.
```
Seen in build bots, e.g. here:
http://lab.llvm.org:8011/#/builders/57/builds/2889/steps/6/logs/stdio


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91927

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


[clang] 420d046 - clang-format, address warnings

2020-12-30 Thread Juneyoung Lee via cfe-commits

Author: Juneyoung Lee
Date: 2020-12-30T23:05:07+09:00
New Revision: 420d046d6bdd8d950dad389a97e31f841052efb2

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

LOG: clang-format, address warnings

Added: 


Modified: 
clang/test/CodeGen/X86/avx512-reduceMinMaxIntrin.c
clang/test/CodeGen/X86/avx512f-builtins.c
clang/test/CodeGen/X86/avx512vl-builtins-constrained.c
clang/test/CodeGen/arm64-abi-vector.c
llvm/lib/IR/AutoUpgrade.cpp
llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Removed: 




diff  --git a/clang/test/CodeGen/X86/avx512-reduceMinMaxIntrin.c 
b/clang/test/CodeGen/X86/avx512-reduceMinMaxIntrin.c
index bb43d348205f..d32eb4b00040 100644
--- a/clang/test/CodeGen/X86/avx512-reduceMinMaxIntrin.c
+++ b/clang/test/CodeGen/X86/avx512-reduceMinMaxIntrin.c
@@ -15,16 +15,16 @@ unsigned long long test_mm512_reduce_max_epu64(__m512i __W){
 }
 
 double test_mm512_reduce_max_pd(__m512d __W){
-// CHECK-LABEL: @test_mm512_reduce_max_pd(
-// CHECK:shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x 
i32> 
-// CHECK:shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x 
i32> 
-// CHECK:call <4 x double> @llvm.x86.avx.max.pd.256(<4 x double> %{{.*}}, 
<4 x double> %{{.*}})
-// CHECK:shufflevector <4 x double> %{{.*}}, <4 x double> poison, <2 x 
i32> 
-// CHECK:shufflevector <4 x double> %{{.*}}, <4 x double> poison, <2 x 
i32> 
-// CHECK:call <2 x double> @llvm.x86.sse2.max.pd(<2 x double> %{{.*}}, <2 
x double> %{{.*}})
-// CHECK:shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x 
i32> 
-// CHECK:call <2 x double> @llvm.x86.sse2.max.pd(<2 x double> %{{.*}}, <2 
x double> %{{.*}})
-// CHECK:extractelement <2 x double> %{{.*}}, i32 0
+  // CHECK-LABEL: @test_mm512_reduce_max_pd(
+  // CHECK:shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x 
i32> 
+  // CHECK:shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x 
i32> 
+  // CHECK:call <4 x double> @llvm.x86.avx.max.pd.256(<4 x double> 
%{{.*}}, <4 x double> %{{.*}})
+  // CHECK:shufflevector <4 x double> %{{.*}}, <4 x double> poison, <2 x 
i32> 
+  // CHECK:shufflevector <4 x double> %{{.*}}, <4 x double> poison, <2 x 
i32> 
+  // CHECK:call <2 x double> @llvm.x86.sse2.max.pd(<2 x double> %{{.*}}, 
<2 x double> %{{.*}})
+  // CHECK:shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x 
i32> 
+  // CHECK:call <2 x double> @llvm.x86.sse2.max.pd(<2 x double> %{{.*}}, 
<2 x double> %{{.*}})
+  // CHECK:extractelement <2 x double> %{{.*}}, i32 0
   return _mm512_reduce_max_pd(__W); 
 }
 
@@ -41,16 +41,16 @@ unsigned long long test_mm512_reduce_min_epu64(__m512i __W){
 }
 
 double test_mm512_reduce_min_pd(__m512d __W){
-// CHECK-LABEL: @test_mm512_reduce_min_pd(
-// CHECK:shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x 
i32> 
-// CHECK:shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x 
i32> 
-// CHECK:call <4 x double> @llvm.x86.avx.min.pd.256(<4 x double> %{{.*}}, 
<4 x double> %{{.*}})
-// CHECK:shufflevector <4 x double> %{{.*}}, <4 x double> poison, <2 x 
i32> 
-// CHECK:shufflevector <4 x double> %{{.*}}, <4 x double> poison, <2 x 
i32> 
-// CHECK:call <2 x double> @llvm.x86.sse2.min.pd(<2 x double> %{{.*}}, <2 
x double> %{{.*}})
-// CHECK:shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x 
i32> 
-// CHECK:call <2 x double> @llvm.x86.sse2.min.pd(<2 x double> %{{.*}}, <2 
x double> %{{.*}})
-// CHECK:extractelement <2 x double> %{{.*}}, i32 0
+  // CHECK-LABEL: @test_mm512_reduce_min_pd(
+  // CHECK:shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x 
i32> 
+  // CHECK:shufflevector <8 x double> %{{.*}}, <8 x double> poison, <4 x 
i32> 
+  // CHECK:call <4 x double> @llvm.x86.avx.min.pd.256(<4 x double> 
%{{.*}}, <4 x double> %{{.*}})
+  // CHECK:shufflevector <4 x double> %{{.*}}, <4 x double> poison, <2 x 
i32> 
+  // CHECK:shufflevector <4 x double> %{{.*}}, <4 x double> poison, <2 x 
i32> 
+  // CHECK:call <2 x double> @llvm.x86.sse2.min.pd(<2 x double> %{{.*}}, 
<2 x double> %{{.*}})
+  // CHECK:shufflevector <2 x double> %{{.*}}, <2 x double> %{{.*}}, <2 x 
i32> 
+  // CHECK:call <2 x double> @llvm.x86.sse2.min.pd(<2 x double> %{{.*}}, 
<2 x double> %{{.*}})
+  // CHECK:extractelement <2 x double> %{{.*}}, i32 0
   return _mm512_reduce_min_pd(__W); 
 }
 
@@ -71,18 +71,18 @@ unsigned long test_mm512_mask_reduce_max_epu64(__mmask8 
__M, __m512i __W){
 }
 
 double test_mm512_mask_reduce_max_pd(__mmask8 __M, __m512d __W){
-// CHECK-LABEL: 

[PATCH] D93923: Use unary CreateShuffleVector if possible

2020-12-30 Thread Juneyoung Lee via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9b29610228c8: Use unary CreateShuffleVector if possible 
(authored by aqjune).

Changed prior to commit:
  https://reviews.llvm.org/D93923?vs=314108=314109#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93923

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/test/CodeGen/X86/avx-builtins.c
  clang/test/CodeGen/X86/avx2-builtins.c
  clang/test/CodeGen/X86/avx512-reduceMinMaxIntrin.c
  clang/test/CodeGen/X86/avx512bw-builtins.c
  clang/test/CodeGen/X86/avx512dq-builtins.c
  clang/test/CodeGen/X86/avx512f-builtins.c
  clang/test/CodeGen/X86/avx512vl-builtins-constrained.c
  clang/test/CodeGen/X86/avx512vl-builtins.c
  clang/test/CodeGen/X86/avx512vlbw-builtins.c
  clang/test/CodeGen/X86/avx512vldq-builtins.c
  clang/test/CodeGen/X86/f16c-builtins-constrained.c
  clang/test/CodeGen/X86/f16c-builtins.c
  clang/test/CodeGen/X86/sse2-builtins.c
  clang/test/CodeGen/arm-mve-intrinsics/vmovl.c
  clang/test/CodeGen/arm-mve-intrinsics/vmovn.c
  clang/test/CodeGen/arm-mve-intrinsics/vrev.c
  clang/test/CodeGen/arm64-abi-vector.c
  clang/test/CodeGenOpenCL/as_type.cl
  clang/test/CodeGenOpenCL/partial_initializer.cl
  clang/test/CodeGenOpenCL/preserve_vec3.cl
  clang/test/CodeGenOpenCL/vectorLoadStore.cl
  clang/test/CodeGenOpenCL/vector_literals_valid.cl
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
  llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
  llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
  llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
  llvm/lib/Target/X86/X86InterleavedAccess.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/CodeGen/AArch64/aarch64-interleaved-ld-combine.ll
  llvm/test/CodeGen/AMDGPU/lower-kernargs.ll
  llvm/test/CodeGen/AMDGPU/rewrite-out-arguments-address-space.ll
  llvm/test/CodeGen/AMDGPU/rewrite-out-arguments.ll
  llvm/test/CodeGen/Generic/expand-experimental-reductions.ll
  llvm/test/Instrumentation/MemorySanitizer/clmul.ll
  
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll
  llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts.ll
  llvm/test/Transforms/InstCombine/canonicalize-vector-insert.ll
  
llvm/test/Transforms/InterleavedAccess/AArch64/interleaved-accesses-inseltpoison.ll
  llvm/test/Transforms/InterleavedAccess/AArch64/interleaved-accesses.ll
  
llvm/test/Transforms/InterleavedAccess/ARM/interleaved-accesses-inseltpoison.ll
  llvm/test/Transforms/InterleavedAccess/ARM/interleaved-accesses.ll
  llvm/test/Transforms/InterleavedAccess/X86/interleavedStore-inseltpoison.ll
  llvm/test/Transforms/InterleavedAccess/X86/interleavedStore.ll
  llvm/test/Transforms/LoopVectorize/AMDGPU/packed-math.ll
  llvm/test/Transforms/LoopVectorize/ARM/sphinx.ll
  llvm/test/Transforms/LoopVectorize/PowerPC/widened-massv-call.ll
  llvm/test/Transforms/LoopVectorize/PowerPC/widened-massv-vfabi-attr.ll
  llvm/test/Transforms/LoopVectorize/float-minmax-instruction-flag.ll
  llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
  llvm/test/Transforms/LoopVectorize/invariant-store-vectorization.ll
  llvm/test/Transforms/LoopVectorize/reduction.ll
  llvm/test/Transforms/LoopVectorize/select-reduction.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/bigger-expressions-double.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/const-gep.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/load-align-volatile.ll
  
llvm/test/Transforms/LowerMatrixIntrinsics/multiply-add-sub-double-row-major.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction-fmf.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-row-major.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction-fmf.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused-volatile.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32-row-major.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backward.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backwards-unsupported.ll
  

[PATCH] D93923: Use unary CreateShuffleVector if possible

2020-12-30 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune updated this revision to Diff 314108.
aqjune added a comment.

- clang-format, address warnings


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93923

Files:
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/test/CodeGen/X86/avx-builtins.c
  clang/test/CodeGen/X86/avx2-builtins.c
  clang/test/CodeGen/X86/avx512-reduceMinMaxIntrin.c
  clang/test/CodeGen/X86/avx512bw-builtins.c
  clang/test/CodeGen/X86/avx512dq-builtins.c
  clang/test/CodeGen/X86/avx512f-builtins.c
  clang/test/CodeGen/X86/avx512vl-builtins-constrained.c
  clang/test/CodeGen/X86/avx512vl-builtins.c
  clang/test/CodeGen/X86/avx512vlbw-builtins.c
  clang/test/CodeGen/X86/avx512vldq-builtins.c
  clang/test/CodeGen/X86/f16c-builtins-constrained.c
  clang/test/CodeGen/X86/f16c-builtins.c
  clang/test/CodeGen/X86/sse2-builtins.c
  clang/test/CodeGen/arm-mve-intrinsics/vmovl.c
  clang/test/CodeGen/arm-mve-intrinsics/vmovn.c
  clang/test/CodeGen/arm-mve-intrinsics/vrev.c
  clang/test/CodeGen/arm64-abi-vector.c
  clang/test/CodeGenOpenCL/as_type.cl
  clang/test/CodeGenOpenCL/partial_initializer.cl
  clang/test/CodeGenOpenCL/preserve_vec3.cl
  clang/test/CodeGenOpenCL/vectorLoadStore.cl
  clang/test/CodeGenOpenCL/vector_literals_valid.cl
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
  llvm/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp
  llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
  llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
  llvm/lib/Target/X86/X86InterleavedAccess.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
  llvm/lib/Transforms/Scalar/SROA.cpp
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/CodeGen/AArch64/aarch64-interleaved-ld-combine.ll
  llvm/test/CodeGen/AMDGPU/lower-kernargs.ll
  llvm/test/CodeGen/AMDGPU/rewrite-out-arguments-address-space.ll
  llvm/test/CodeGen/AMDGPU/rewrite-out-arguments.ll
  llvm/test/CodeGen/Generic/expand-experimental-reductions.ll
  llvm/test/Instrumentation/MemorySanitizer/clmul.ll
  
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts-inseltpoison.ll
  llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-demanded-vector-elts.ll
  llvm/test/Transforms/InstCombine/canonicalize-vector-insert.ll
  
llvm/test/Transforms/InterleavedAccess/AArch64/interleaved-accesses-inseltpoison.ll
  llvm/test/Transforms/InterleavedAccess/AArch64/interleaved-accesses.ll
  
llvm/test/Transforms/InterleavedAccess/ARM/interleaved-accesses-inseltpoison.ll
  llvm/test/Transforms/InterleavedAccess/ARM/interleaved-accesses.ll
  llvm/test/Transforms/InterleavedAccess/X86/interleavedStore-inseltpoison.ll
  llvm/test/Transforms/InterleavedAccess/X86/interleavedStore.ll
  llvm/test/Transforms/LoopVectorize/AMDGPU/packed-math.ll
  llvm/test/Transforms/LoopVectorize/ARM/sphinx.ll
  llvm/test/Transforms/LoopVectorize/PowerPC/widened-massv-call.ll
  llvm/test/Transforms/LoopVectorize/PowerPC/widened-massv-vfabi-attr.ll
  llvm/test/Transforms/LoopVectorize/float-minmax-instruction-flag.ll
  llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
  llvm/test/Transforms/LoopVectorize/invariant-store-vectorization.ll
  llvm/test/Transforms/LoopVectorize/reduction.ll
  llvm/test/Transforms/LoopVectorize/select-reduction.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/bigger-expressions-double.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/const-gep.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/load-align-volatile.ll
  
llvm/test/Transforms/LowerMatrixIntrinsics/multiply-add-sub-double-row-major.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction-fmf.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-contraction.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double-row-major.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-double.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction-fmf.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float-contraction.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-float.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused-volatile.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32-row-major.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/multiply-i32.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backward.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/propagate-backwards-unsupported.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/propagate-forward.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/propagate-mixed-users.ll
  llvm/test/Transforms/LowerMatrixIntrinsics/store-align-volatile.ll
  

[PATCH] D93923: Use unary CreateShuffleVector if possible

2020-12-30 Thread Juneyoung Lee via Phabricator via cfe-commits
aqjune added a comment.

Thanks! :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93923

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


[PATCH] D93940: [clang-tidy] Add a check for blocking types and functions.

2020-12-30 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment.

Few stylistic nits, Also Theres lots of cases where single stmt if statements 
have braces, typically we elide those braces.
Is it worth flagging methods with Thread safety analysis 
 attributes.
These are only used in clang, but if a project annotates their methods with 
these, it would be nice to autodetect these attributes, though I can see this 
being a big job and likely better for a follow up.




Comment at: 
clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:16-21
+static const auto kName = "name";
+static const auto kType = "type";
+static const auto kFunction = "function";
+static const auto kMethod = "method";
+static const auto kAtomic = "atomic";
+static const auto kLockfree = "lockfree";

These go against llvm naming convention of Variables being CamelCase.
Also don't use auto when the type is spelled in the initialization.



Comment at: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:23
+
+static std::vector
+toVector(const std::vector Base, clang::StringRef Extra) {

`clang::StringRef` is a code smell imo, use `llvm::StringRef` or move this code 
into the clang namespace and drop the qualifier.



Comment at: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:24
+static std::vector
+toVector(const std::vector Base, clang::StringRef Extra) {
+  llvm::SmallVector Tmp{Base.begin(), Base.end()};

This could take an ArrayRef instead of const vector ref.



Comment at: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:33
+
+static const std::vector LockableBase = {
+/* C++ std */

This and all examples below don't belong on the heap, Just use an array.




Comment at: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:35
+/* C++ std */
+"std::mutex", //
+"std::timed_mutex",   //

Is it wise to fully qualify these?
`::std::mutex`

Also whats with the comments at the end of each line, they don't seem to add 
anything.



Comment at: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:222
+  // std::mutex
+  auto Lockable = toVector(LockableBase, StringRef(LockableExtra));
+  Finder->addMatcher(

No need to case to `StringRef`, its implicit.



Comment at: 
clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:292-293
+
+  const auto *D = Result.Nodes.getNodeAs(kType);
+  if (D) {
+diag(D->getBeginLoc(), "type " + D->getType().getAsString() +





Comment at: 
clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:299-300
+
+  const auto *CE = Result.Nodes.getNodeAs(kMethod);
+  if (CE) {
+if (Name) {





Comment at: 
clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:302-304
+  diag(CE->getBeginLoc(), "method " + Name->getNameAsString() +
+  " may sleep and is not coroutine-safe")
+  << SourceRange(CE->getBeginLoc(), CE->getEndLoc());

Diagnostics support "%0" style formatting.
That formatting handles NamedDecls.
Stmt has a SourceRange that does the same job as (getBeginLoc(), getEndLoc()]
This can be applied in other places.



Comment at: 
clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:308-309
+
+  const auto *E = Result.Nodes.getNodeAs(kFunction);
+  if (E) {
+if (Name) {





Comment at: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp:320
+const auto *Lockfree = Result.Nodes.getNodeAs(kLockfree);
+if (Lockfree) {
+  const auto *EV = Lockfree->ensureEvaluatedStmt();

From the code, Lockfree can't be null if Atomic binds, maybe make this an assert



Comment at: 
clang-tools-extra/test/clang-tidy/checkers/concurrency-async-blocking.cpp:450
+
+// TODO: remove CHECKT-MESSAGES

Whats this for?


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

https://reviews.llvm.org/D93940

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


[PATCH] D93923: Use unary CreateShuffleVector if possible

2020-12-30 Thread Sanjay Patel via Phabricator via cfe-commits
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

See inline comments to avoid bot failures - otherwise, LGTM. Thanks for the 
cleanup!




Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:3193
 IRBuilder<> IRB();
 Type *ShadowTy = getShadowTy();
 unsigned Width =

ShadowTy is now an unused variable. Delete to avoid a compile warning.



Comment at: llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp:337
   Value *Vec = isColumnMajor() ? getColumn(J) : getRow(I);
   Value *Undef = UndefValue::get(Vec->getType());
   return Builder.CreateShuffleVector(

`Undef` is now an unused variable. Delete to avoid a compile warning.



Comment at: llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp:450
 SmallVector SplitVecs;
 Value *Undef = UndefValue::get(VType);
 for (unsigned MaskStart = 0;

Undef is now an unused variable. Delete to avoid a compile warning.



Comment at: llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp:944
 
 Value *Undef = UndefValue::get(Block->getType());
 Block = Builder.CreateShuffleVector(

Undef is now an unused variable. Delete to avoid a compile warning.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93923

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


[PATCH] D93822: [clang][Sema] Add diagnostics for implicit widening of multiplication result

2020-12-30 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments.



Comment at: 
clang/test/Sema/implicit-widening-of-pointer-offset-in-array-subscript-expression.c:24
+void t1(char *base, int a, int b) {
+  // FIXME: test `[a * b]base` pattern?
+}

dblaikie wrote:
> lebedev.ri wrote:
> > dblaikie wrote:
> > > Question is unclear - is there uncertainty about whether this should be 
> > > tested? Or is this a false negative case? In which case I'd probably 
> > > include the test showing no diagnostic and mention it could be 
> > > fixed/improved?
> > I may be misremembering things, but IIRC `a[b]` and `b[a]` is the same 
> > thing,
> > but i'm not sure how to exercise the second spelling.
> > I.e. i'm just not sure how to write a test for it.
> > I may be misremembering things, but IIRC a[b] and b[a] is the same thing,
> Yep, that's the case - `a[b]` where one of them is a pointer and teh other is 
> an integer, is equivalent to `*(a + b)`, so that means it's the same as 
> `b[a]`.
> 
> I guess you'd write it the same as t0, but with the expressions reversed? 
> `return *(a * b)[base];`
That's what i tried, and it does't work - https://godbolt.org/z/as4vP4


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93822

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


[PATCH] D93822: [clang][Sema] Add diagnostics for implicit widening of multiplication result

2020-12-30 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri updated this revision to Diff 314103.
lebedev.ri marked 2 inline comments as done.
lebedev.ri added a comment.

NFC, rebased, added test with multiplication of `short`s.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93822

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Misc/warning-wall.c
  clang/test/Sema/implicit-widening-of-multiplication-result.c
  
clang/test/Sema/implicit-widening-of-pointer-offset-in-array-subscript-expression.c
  clang/test/Sema/implicit-widening-of-pointer-offset.c

Index: clang/test/Sema/implicit-widening-of-pointer-offset.c
===
--- /dev/null
+++ clang/test/Sema/implicit-widening-of-pointer-offset.c
@@ -0,0 +1,107 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wimplicit-widening-of-pointer-offset -verify %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wimplicit-widening-of-pointer-offset -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck --implicit-check-not="fix-it" %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wimplicit-widening-of-pointer-offset -verify -x c++ %s
+
+// RUN: %clang_cc1 -triple i686-linux-gnu   -fsyntax-only -Wimplicit-widening-of-pointer-offset -verify=silent %s
+// RUN: %clang_cc1 -triple i686-linux-gnu   -fsyntax-only -Wimplicit-widening-of-pointer-offset -verify=silent -x c++ %s
+
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wimplicit-widening-conversion -verify %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wall -verify %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify=silent %s
+
+// silent-no-diagnostics
+
+char *t0(char *base, int a, int b) {
+  return base + a * b; // #0
+  // expected-warning@#0 {{result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ssize_t'}}
+  // expected-note@#0 {{make conversion explicit to silence this warning}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:17-[[@LINE-3]]:17}:"(ssize_t)("
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:21}:")"
+  // expected-note@#0 {{perform multiplication in a wider type}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:17-[[@LINE-6]]:17}:"(ssize_t)"
+}
+char *t1(char *base, int a, int b) {
+  return a * b + base; // #1
+  // expected-warning@#1 {{result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ssize_t'}}
+  // expected-note@#1 {{make conversion explicit to silence this warning}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:10-[[@LINE-3]]:10}:"(ssize_t)("
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:14-[[@LINE-4]]:14}:")"
+  // expected-note@#1 {{perform multiplication in a wider type}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:10-[[@LINE-6]]:10}:"(ssize_t)"
+}
+
+char *t2(char *base, unsigned int a, int b) {
+  return base + a * b; // #2
+  // expected-warning@#2 {{result of multiplication in type 'unsigned int' is used as a pointer offset after an implicit widening conversion to type 'size_t'}}
+  // expected-note@#2 {{make conversion explicit to silence this warning}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:17-[[@LINE-3]]:17}:"(size_t)("
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:21}:")"
+  // expected-note@#2 {{perform multiplication in a wider type}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:17-[[@LINE-6]]:17}:"(size_t)"
+}
+
+char *t3(char *base, int a, unsigned int b) {
+  return base + a * b; // #3
+  // expected-warning@#3 {{result of multiplication in type 'unsigned int' is used as a pointer offset after an implicit widening conversion to type 'size_t'}}
+  // expected-note@#3 {{make conversion explicit to silence this warning}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:17-[[@LINE-3]]:17}:"(size_t)("
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:21}:")"
+  // expected-note@#3 {{perform multiplication in a wider type}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:17-[[@LINE-6]]:17}:"(size_t)"
+}
+
+char *t4(char *base, unsigned int a, unsigned int b) {
+  return base + a * b; // #4
+  // expected-warning@#4 {{result of multiplication in type 'unsigned int' is used as a pointer offset after an implicit widening conversion to type 'size_t'}}
+  // expected-note@#4 {{make conversion explicit to silence this warning}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:17-[[@LINE-3]]:17}:"(size_t)("
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-4]]:21-[[@LINE-4]]:21}:")"
+  // expected-note@#4 {{perform multiplication in a wider type}}
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-6]]:17-[[@LINE-6]]:17}:"(size_t)"
+}
+
+char *t5(char *base, int a, int b, int 

[PATCH] D93942: [OpenCL] Improve online documentation.

2020-12-30 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Anastasia added reviewers: svenvh, azabaznov, mantognini, yaxunl.
Herald added subscribers: ebevhan, jfb.
Anastasia requested review of this revision.

Update UsersManual and OpenCLSupport pages to reflect recent functionality i.e. 
SPIR-V generation, C++ for OpenCL, OpenCL 3.0 development plans.


https://reviews.llvm.org/D93942

Files:
  clang/docs/OpenCLSupport.rst
  clang/docs/UsersManual.rst

Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -41,7 +41,8 @@
variants depending on base language.
 -  :ref:`C++ Language `
 -  :ref:`Objective C++ Language `
--  :ref:`OpenCL C Language `: v1.0, v1.1, v1.2, v2.0.
+-  :ref:`OpenCL Kernel Language `: OpenCL C v1.0, v1.1, v1.2, v2.0,
+   plus C++ for OpenCL.
 
 In addition to these base languages and their dialects, Clang supports a
 broad variety of language extensions, which are documented in the
@@ -2796,8 +2797,8 @@
 ===
 
 Clang can be used to compile OpenCL kernels for execution on a device
-(e.g. GPU). It is possible to compile the kernel into a binary (e.g. for AMD or
-Nvidia targets) that can be uploaded to run directly on a device (e.g. using
+(e.g. GPU). It is possible to compile the kernel into a binary (e.g. for AMDGPU)
+that can be uploaded to run directly on a device (e.g. using
 `clCreateProgramWithBinary
 `_) or
 into generic bitcode files loadable into other toolchains.
@@ -2824,13 +2825,26 @@
 
  $ clang -c -emit-llvm test.cl
 
-This will produce a generic test.bc file that can be used in vendor toolchains
+This will produce test.bc file that can be used in vendor toolchains
 to perform machine code generation.
 
-Clang currently supports OpenCL C language standards up to v2.0. Starting from
-clang 9 a C++ mode is available for OpenCL (see
+Note that if compiled to bitcode for generic targets such as SPIR,
+portable IR is produced i.e. it can be used with various vendor
+tools as well as open source tools i.e. `SPIRV-LLVM Translator
+`_
+to produce SPIR-V binary.
+
+
+Clang currently supports OpenCL C language standards up to v2.0. Clang mainly
+supports full profile, there is only very limited support of the embedded
+profile. 
+Starting from clang 9 a C++ mode is available for OpenCL (see
 :ref:`C++ for OpenCL `).
 
+There is ongoing support for OpenCL v3.0 that is documented along with other
+experimental functionality and features in development on :doc:`OpenCLSupport`
+page.
+
 OpenCL Specific Options
 ---
 
@@ -2847,30 +2861,37 @@
 
 .. option:: -finclude-default-header
 
-Loads standard includes during compilations. By default OpenCL headers are not
-loaded and therefore standard library includes are not available. To load them
-automatically a flag has been added to the frontend (see also :ref:`the section
-on the OpenCL Header `):
+Adds builtin function declarations during compilations. By default
+the OpenCL headers are not loaded and therefore the builtin functions
+ are not declared. To load them automatically this flag can be
+passed to the frontend (see also :ref:`the section on the OpenCL Header
+`):
 
.. code-block:: console
 
  $ clang -Xclang -finclude-default-header test.cl
 
-Alternatively ``-include`` or ``-I`` followed by the path to the header location
-can be given manually.
+Note that this is a frontend-only flag and therefore it requires the use of
+flags that forward options to the frontend e.g. `-cc1` or `-Xclang`.
+
+Alternatively the internal header with the declarations can be added manually
+using ``-include`` or ``-I`` followed by the path to the header
+location. The header can be found in the clang source tree or installation
+directory.
 
.. code-block:: console
 
- $ clang -I/lib/Headers/opencl-c.h test.cl
+ $ clang -I/lib/Headers/opencl-c.h test.cl
+ $ clang -I/lib/clang//include/opencl-c.h/opencl-c.h test.cl
 
-In this case the kernel code should contain ``#include `` just as a
-regular C include.
+In this example it is assumed that the kernel code contains
+``#include `` just as a regular C include.
 
 .. _opencl_cl_ext:
 
 .. option:: -cl-ext
 
-Disables support of OpenCL extensions. All OpenCL targets provide a list
+Disables support of OpenCL extensions. All OpenCL targets set a list
 of extensions that they support. Clang allows to amend this using the ``-cl-ext``
 flag with a comma-separated list of extensions prefixed with ``'+'`` or ``'-'``.
 The syntax: ``-cl-ext=<(['-'|'+'][,])+>``,  where extensions
@@ -2878,6 +2899,10 @@
 `_
 or any known vendor extension. Alternatively, ``'all'`` can be used to enable
 or disable all known extensions.
+
+Note that this is a frontend-only flag and therefore 

[PATCH] D93940: [clang-tidy] Add a check for blocking types and functions.

2020-12-30 Thread Vasily Kulikov via Phabricator via cfe-commits
segoon updated this revision to Diff 314093.
segoon retitled this revision from "Add a check for blocking types and 
functions." to "[clang-tidy] Add a check for blocking types and functions.".
segoon added a comment.
Herald added a reviewer: jfb.
Herald added subscribers: xazax.hun, mgorny.
Herald added a reviewer: jfb.

fix the mess


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

https://reviews.llvm.org/D93940

Files:
  clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
  clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.h
  clang-tools-extra/clang-tidy/concurrency/CMakeLists.txt
  clang-tools-extra/clang-tidy/concurrency/ConcurrencyTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/concurrency-async-blocking.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/test/clang-tidy/checkers/concurrency-async-blocking.c
  clang-tools-extra/test/clang-tidy/checkers/concurrency-async-blocking.cpp

Index: clang-tools-extra/test/clang-tidy/checkers/concurrency-async-blocking.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/concurrency-async-blocking.cpp
@@ -0,0 +1,450 @@
+// RUN: %check_clang_tidy %s concurrency-async-blocking %t -- \
+// RUN: -config='{CheckOptions: [{key: "concurrency-async-blocking.LockableExtra", value: "my::mutex;my::shared_mutex"}, {key: "concurrency-async-blocking.WaitableExtra", value: "my::Future;my::cv"}, {key: "concurrency-async-blocking.LockableExtra", value: "my::mutex;my::shared_mutex"}, {key: "concurrency-async-blocking.FunctionsExtra", value: "my_sleep;my::sleep"}, {key: "concurrency-async-blocking.TypesExtra", value: "my::big_lock;my::other_lock"}]}'
+
+/* Poor man's declaration of std::mutex and friends */
+namespace std {
+namespace chrono {
+class seconds {
+public:
+  seconds(int);
+};
+} // namespace chrono
+
+class mutex {
+public:
+  void lock();
+
+  // non-std methods
+  void lock_suffix();
+  void prefix_lock();
+
+  template 
+  void try_lock_for(Duration);
+};
+class recursive_mutex {};
+class recursive_timed_mutex {};
+class shared_mutex {};
+class shared_timed_mutex {};
+class mutex_suffix {};
+class prefix_mutex {};
+
+template 
+class unique_lock {
+public:
+  unique_lock(Lock &);
+
+  void lock();
+  template 
+  void try_lock_for(Duration);
+
+  // non-std methods
+  void lock_suffix();
+  void prefix_lock();
+};
+
+} // namespace std
+
+namespace ns {
+class mutex {};
+} // namespace ns
+
+class mutex {};
+
+template 
+class nonlock {};
+
+namespace my {
+class mutex {
+public:
+  void lock();
+};
+class shared_mutex {};
+class non_mutex {
+public:
+  void lock();
+};
+} // namespace my
+
+void test_lockable() {
+  std::mutex m;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type std::mutex may sleep and is not coroutine-safe [concurrency-async-blocking]
+  ::std::mutex mns;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type ::std::mutex may sleep and is not coroutine-safe [concurrency-async-blocking]
+  std::shared_mutex sm;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type std::shared_mutex may sleep and is not coroutine-safe [concurrency-async-blocking]
+  std::recursive_mutex rm;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type std::recursive_mutex may sleep and is not coroutine-safe [concurrency-async-blocking]
+  std::recursive_timed_mutex rtm;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type std::recursive_timed_mutex may sleep and is not coroutine-safe [concurrency-async-blocking]
+  my::mutex mym;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type my::mutex may sleep and is not coroutine-safe [concurrency-async-blocking]
+
+  std::mutex_suffix m1;
+  std::prefix_mutex m2;
+  ns::mutex m3;
+  mutex m4;
+  my::non_mutex myn;
+
+  m.lock();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method lock may sleep and is not coroutine-safe [concurrency-async-blocking]
+  mns.lock();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method lock may sleep and is not coroutine-safe [concurrency-async-blocking]
+  mym.lock();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: method lock may sleep and is not coroutine-safe [concurrency-async-blocking]
+  myn.lock();
+
+  m.lock_suffix();
+  m.prefix_lock();
+
+  std::unique_lock lock(m);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: type std::unique_lock may sleep and is not coroutine-safe [concurrency-async-blocking]
+
+  std::unique_lock l1(m1);
+  std::unique_lock l2(m2);
+  std::unique_lock l3(m3);
+  std::unique_lock l4(m4);
+
+  nonlock nonlock;
+}
+
+void sleep(int);
+void nanosleep(int);
+void usleep(int);
+void xsleep(int);
+void sleepx(int);
+void system(const char *);
+int wait(int *);
+int waitpid(int, int *, int);
+int waitid(int idtype, int id, int *infop, int options);
+
+struct rusage {};
+using pid_t = int;
+pid_t wait3(int *status, int options,
+struct rusage *rusage);
+
+pid_t 

[PATCH] D93940: Add a check for blocking types and functions.

2020-12-30 Thread Vasily Kulikov via Phabricator via cfe-commits
segoon updated this revision to Diff 314092.
segoon added a comment.

up


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93940

Files:
  clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp


Index: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
===
--- clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
+++ clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
@@ -314,12 +314,6 @@
 }
   }
 
-  const auto *L = Result.Nodes.getNodeAs("lock");
-  if (L) {
-diag(L->getBeginLoc(), "type may sleep and is not coroutine-safe")
-<< SourceRange(L->getBeginLoc(), L->getEndLoc());
-  }
-
   const auto *Atomic = Result.Nodes.getNodeAs(kAtomic);
   if (Atomic) {
 const auto *Lockfree = Result.Nodes.getNodeAs(kLockfree);


Index: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
===
--- clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
+++ clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
@@ -314,12 +314,6 @@
 }
   }
 
-  const auto *L = Result.Nodes.getNodeAs("lock");
-  if (L) {
-diag(L->getBeginLoc(), "type may sleep and is not coroutine-safe")
-<< SourceRange(L->getBeginLoc(), L->getEndLoc());
-  }
-
   const auto *Atomic = Result.Nodes.getNodeAs(kAtomic);
   if (Atomic) {
 const auto *Lockfree = Result.Nodes.getNodeAs(kLockfree);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93940: Add a check for blocking types and functions.

2020-12-30 Thread Vasily Kulikov via Phabricator via cfe-commits
segoon created this revision.
Herald added a subscriber: jfb.
segoon requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The preemptive functions/types can be separated into the following categories:

- explicit sleep(3)-like functions
- sleeping/waiting synchronization primitives

The check searches for:

- C++ synchronization primitives
- C11 synchronization primitives
- POSIX synchronization primitives
- some POSIX blocking functions
- some blocking Linux syscalls
- some Boost.Thread synchronization primitives

There are AST matchers for both sync primitives creation and blocking methods 
calls - we want
the former for user-created mutexes and the latter for mutex usage passed from 
outside (e.g. via
library global variable or function parameter).

Atomic code is WIP, will be done before the merge. TODOs in tests are marked 
with CHECKT-MESSAGES.

The check doesn't include the following:

- Io and filesystem operations. It will be included in a separate checker 
concurrency-async-fs as a user might have a different policy (e.g. no FS thread 
pool, so nothing can be done).
- Creation of new threads. Same here, will be implemented in 
concurrency-async-no-new-threads, it is OK for some projects and must be 
changed to async code in others.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93940

Files:
  clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp


Index: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
===
--- clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
+++ clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
@@ -314,12 +314,6 @@
 }
   }
 
-  const auto *L = Result.Nodes.getNodeAs("lock");
-  if (L) {
-diag(L->getBeginLoc(), "type may sleep and is not coroutine-safe")
-<< SourceRange(L->getBeginLoc(), L->getEndLoc());
-  }
-
   const auto *Atomic = Result.Nodes.getNodeAs(kAtomic);
   if (Atomic) {
 const auto *Lockfree = Result.Nodes.getNodeAs(kLockfree);


Index: clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
===
--- clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
+++ clang-tools-extra/clang-tidy/concurrency/AsyncBlockingCheck.cpp
@@ -314,12 +314,6 @@
 }
   }
 
-  const auto *L = Result.Nodes.getNodeAs("lock");
-  if (L) {
-diag(L->getBeginLoc(), "type may sleep and is not coroutine-safe")
-<< SourceRange(L->getBeginLoc(), L->getEndLoc());
-  }
-
   const auto *Atomic = Result.Nodes.getNodeAs(kAtomic);
   if (Atomic) {
 const auto *Lockfree = Result.Nodes.getNodeAs(kLockfree);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93839: [clang-format] PR48594 BraceWrapping: SplitEmptyRecord ignored for templates

2020-12-30 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius accepted this revision.
curdeius added a comment.
This revision is now accepted and ready to land.

LGTM. Thank you!


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

https://reviews.llvm.org/D93839

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


[PATCH] D93839: [clang-format] PR48594 BraceWrapping: SplitEmptyRecord ignored for templates

2020-12-30 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay updated this revision to Diff 314089.
MyDeveloperDay marked 5 inline comments as done.
MyDeveloperDay added a comment.

Address review comments


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

https://reviews.llvm.org/D93839

Files:
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/unittests/Format/FormatTest.cpp
  clang/unittests/Format/FormatTestCSharp.cpp

Index: clang/unittests/Format/FormatTestCSharp.cpp
===
--- clang/unittests/Format/FormatTestCSharp.cpp
+++ clang/unittests/Format/FormatTestCSharp.cpp
@@ -835,25 +835,27 @@
 TEST_F(FormatTestCSharp, CSharpGenericTypeConstraints) {
   FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp);
 
-  verifyFormat(R"(//
-class ItemFactory
-where T : new() {})",
+  EXPECT_TRUE(Style.BraceWrapping.SplitEmptyRecord);
+
+  verifyFormat("class ItemFactory\n"
+   "where T : new() {\n"
+   "}",
Style);
 
-  verifyFormat(R"(//
-class Dictionary
-where TKey : IComparable
-where TVal : IMyInterface {
-  public void MyMethod(T t)
-  where T : IMyInterface {
-doThing();
-  }
-})",
+  verifyFormat("class Dictionary\n"
+   "where TKey : IComparable\n"
+   "where TVal : IMyInterface {\n"
+   "  public void MyMethod(T t)\n"
+   "  where T : IMyInterface {\n"
+   "doThing();\n"
+   "  }\n"
+   "}",
Style);
 
-  verifyFormat(R"(//
-class ItemFactory
-where T : new(), IAnInterface, IAnotherInterface, IAnotherInterfaceStill {})",
+  verifyFormat("class ItemFactory\n"
+   "where T : new(), IAnInterface, IAnotherInterface, "
+   "IAnotherInterfaceStill {\n"
+   "}",
Style);
 
   Style.ColumnLimit = 50; // Force lines to be wrapped.
@@ -862,7 +864,8 @@
 where T : new(),
   IAnInterface,
   IAnotherInterface,
-  IAnotherInterfaceStill {})",
+  IAnotherInterfaceStill {
+})",
Style);
 
   // In other languages `where` can be used as a normal identifier.
Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -9891,6 +9891,71 @@
"{\n"
"} Foo_t;",
Style);
+
+  Style.BraceWrapping.SplitEmptyRecord = true;
+  Style.BraceWrapping.AfterStruct = true;
+  verifyFormat("class rep\n"
+   "{\n"
+   "};",
+   Style);
+  verifyFormat("struct rep\n"
+   "{\n"
+   "};",
+   Style);
+  verifyFormat("template  class rep\n"
+   "{\n"
+   "};",
+   Style);
+  verifyFormat("template  struct rep\n"
+   "{\n"
+   "};",
+   Style);
+  verifyFormat("class rep\n"
+   "{\n"
+   "  int x;\n"
+   "};",
+   Style);
+  verifyFormat("struct rep\n"
+   "{\n"
+   "  int x;\n"
+   "};",
+   Style);
+  verifyFormat("template  class rep\n"
+   "{\n"
+   "  int x;\n"
+   "};",
+   Style);
+  verifyFormat("template  struct rep\n"
+   "{\n"
+   "  int x;\n"
+   "};",
+   Style);
+  verifyFormat("template  class rep // Foo\n"
+   "{\n"
+   "  int x;\n"
+   "};",
+   Style);
+  verifyFormat("template  struct rep // Bar\n"
+   "{\n"
+   "  int x;\n"
+   "};",
+   Style);
+
+  verifyFormat("template  class rep\n"
+   "{\n"
+   "  int x;\n"
+   "};",
+   Style);
+
+  verifyFormat("template  class rep>\n"
+   "{\n"
+   "  int x;\n"
+   "};",
+   Style);
+  verifyFormat("template  class rep>\n"
+   "{\n"
+   "};",
+   Style);
 }
 
 TEST_F(FormatTest, SplitEmptyStruct) {
Index: clang/lib/Format/UnwrappedLineFormatter.cpp
===
--- clang/lib/Format/UnwrappedLineFormatter.cpp
+++ clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -248,6 +248,11 @@
 return !Style.BraceWrapping.SplitEmptyRecord && EmptyBlock
? tryMergeSimpleBlock(I, E, Limit)
: 0;
+
+  if (Tok && Tok->is(tok::kw_template) &&
+  Style.BraceWrapping.SplitEmptyRecord && EmptyBlock) {
+return 0;
+  }
 }
 
 // FIXME: TheLine->Level != 0 might or might not be the right check to do.
@@ -355,6 +360,30 @@
 if (TheLine->First->is(tok::l_brace) && I != AnnotatedLines.begin() &&
 

[PATCH] D93938: [clang-format] Fixed AfterEnum handling

2020-12-30 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius requested changes to this revision.
curdeius added a comment.
This revision now requires changes to proceed.

Please add and fix tests.




Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2485
 
-  if (!Style.AllowShortEnumsOnASingleLine)
-addUnwrappedLine();

Why is this removed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

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


[PATCH] D93846: [clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

2020-12-30 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments.



Comment at: clang/include/clang/Format/Format.h:1351
 
+  /// If true, the empty line is inserted before access modifiers
+  /// \code

The full stop will go here then regenerate.


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

https://reviews.llvm.org/D93846

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


[PATCH] D93938: Fixed AfterEnum handling

2020-12-30 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

You should add tests to prove what you are doing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93938

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


[PATCH] D92837: [X86] Support tilezero intrinsic and c interface for AMX.

2020-12-30 Thread LuoYuanke via Phabricator via cfe-commits
LuoYuanke updated this revision to Diff 314087.
LuoYuanke added a comment.

Rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92837

Files:
  clang/include/clang/Basic/BuiltinsX86_64.def
  clang/lib/Headers/amxintrin.h
  clang/test/CodeGen/X86/amx_api.c
  llvm/include/llvm/IR/IntrinsicsX86.td
  llvm/lib/Target/X86/X86ExpandPseudo.cpp
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
  llvm/lib/Target/X86/X86InstrAMX.td
  llvm/lib/Target/X86/X86PreTileConfig.cpp
  llvm/lib/Target/X86/X86RegisterInfo.cpp
  llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll

Index: llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll
===
--- /dev/null
+++ llvm/test/CodeGen/X86/AMX/amx-tile-basic.ll
@@ -0,0 +1,35 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+amx-tile -verify-machineinstrs | FileCheck %s
+
+define void @test_amx(i8* %pointer, i8* %base, i64 %stride) {
+; CHECK-LABEL: test_amx:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:movb $1, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movb $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:ldtilecfg -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:movw $8, %ax
+; CHECK-NEXT:tilezero %tmm0
+; CHECK-NEXT:tileloadd (%rsi,%rdx), %tmm1
+; CHECK-NEXT:tileloadd (%rsi,%rdx), %tmm2
+; CHECK-NEXT:tdpbssd %tmm2, %tmm1, %tmm0
+; CHECK-NEXT:tilestored %tmm0, (%rdi,%rdx)
+; CHECK-NEXT:tilerelease
+; CHECK-NEXT:retq
+  %c = call x86_amx @llvm.x86.tilezero.internal(i16 8, i16 8)
+  %a = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
+  %b = call x86_amx @llvm.x86.tileloadd64.internal(i16 8, i16 8, i8* %base, i64 %stride)
+  %d = call x86_amx @llvm.x86.tdpbssd.internal(i16 8, i16 8, i16 8, x86_amx %c, x86_amx %a, x86_amx %b)
+  call void @llvm.x86.tilestored64.internal(i16 8, i16 8, i8* %pointer, i64 %stride, x86_amx %d)
+
+  ret void
+}
+
+declare x86_amx @llvm.x86.tilezero.internal(i16, i16)
+declare x86_amx @llvm.x86.tileloadd64.internal(i16, i16, i8*, i64)
+declare x86_amx @llvm.x86.tdpbssd.internal(i16, i16, i16, x86_amx, x86_amx, x86_amx)
+declare void @llvm.x86.tilestored64.internal(i16, i16, i8*, i64, x86_amx)
Index: llvm/lib/Target/X86/X86RegisterInfo.cpp
===
--- llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -873,6 +873,7 @@
   // We only collect the tile shape that is defined.
   case X86::PTILELOADDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 MachineOperand  = MI->getOperand(1);
 MachineOperand  = MI->getOperand(2);
 ShapeT Shape(, , MRI);
Index: llvm/lib/Target/X86/X86PreTileConfig.cpp
===
--- llvm/lib/Target/X86/X86PreTileConfig.cpp
+++ llvm/lib/Target/X86/X86PreTileConfig.cpp
@@ -132,6 +132,7 @@
 llvm_unreachable("Unexpected machine instruction on tile");
   case X86::PTILELOADDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 MachineOperand  = const_cast(MI.getOperand(1));
 MachineOperand  = const_cast(MI.getOperand(2));
 ShapeT Shape(, , MRI);
@@ -230,6 +231,7 @@
   case X86::PTILELOADDV:
   case X86::PTILESTOREDV:
   case X86::PTDPBSSDV:
+  case X86::PTILEZEROV:
 unsigned NumOperands = MI.getNumOperands();
 MI.RemoveOperand(NumOperands - 1);
 MI.addOperand(MF, MachineOperand::CreateReg(CFG, false));
Index: llvm/lib/Target/X86/X86InstrAMX.td
===
--- llvm/lib/Target/X86/X86InstrAMX.td
+++ llvm/lib/Target/X86/X86InstrAMX.td
@@ -62,6 +62,9 @@
 def PTILESTOREDV : PseudoI<(outs), (ins GR16:$src1,
 GR16:$src2, opaquemem:$src3,
 TILE:$src4, TILECFG:$cfg), []>;
+def PTILEZEROV : PseudoI<(outs TILE: $dst), (ins GR16:$src1,
+ GR16:$src2,
+ TILECFG:$cfg), []>;
 
 let usesCustomInserter = 1 in {
   // Pseudo instructions, using immediates instead of tile registers.
Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
===
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -4641,6 +4641,18 @@
   ReplaceNode(Node, CNode);
   return;
 }
+case Intrinsic::x86_tilezero_internal: {
+  if (!Subtarget->hasAMXTILE())
+break;
+  unsigned Opc = X86::PTILEZEROV;
+  SDValue Chain = 

[PATCH] D86671: [clang-tidy] Add new case type to check variables with Hungarian notation

2020-12-30 Thread Douglas Chen via Phabricator via cfe-commits
dougpuob added a comment.

Addressed comments by @njames93. Including adding warning message for 
unsupported options in config file, refining code in getFileStyleFromOptions(), 
and for consistent reason to use llvm::yaml::parseBool() function instead of 
checking On/Off string.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86671

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


[PATCH] D93938: Fixed AfterEnum handling

2020-12-30 Thread Ally Tiritoglu via Phabricator via cfe-commits
atirit created this revision.
atirit requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93938

Files:
  clang/lib/Format/UnwrappedLineParser.cpp


Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -694,6 +694,8 @@
 return Style.BraceWrapping.AfterUnion;
   if (InitialToken.is(tok::kw_struct))
 return Style.BraceWrapping.AfterStruct;
+  if (InitialToken.is(tok::kw_enum))
+return Style.BraceWrapping.AfterEnum;
   return false;
 }
 
@@ -1299,7 +1301,7 @@
   if (!parseEnum())
 break;
   // This only applies for C++.
-  if (!Style.isCpp()) {
+  if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) {
 addUnwrappedLine();
 return;
   }
@@ -2482,8 +2484,6 @@
 return true;
   }
 
-  if (!Style.AllowShortEnumsOnASingleLine)
-addUnwrappedLine();
   // Parse enum body.
   nextToken();
   if (!Style.AllowShortEnumsOnASingleLine) {


Index: clang/lib/Format/UnwrappedLineParser.cpp
===
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -694,6 +694,8 @@
 return Style.BraceWrapping.AfterUnion;
   if (InitialToken.is(tok::kw_struct))
 return Style.BraceWrapping.AfterStruct;
+  if (InitialToken.is(tok::kw_enum))
+return Style.BraceWrapping.AfterEnum;
   return false;
 }
 
@@ -1299,7 +1301,7 @@
   if (!parseEnum())
 break;
   // This only applies for C++.
-  if (!Style.isCpp()) {
+  if (!Style.isCpp() && Style.BraceWrapping.AfterEnum) {
 addUnwrappedLine();
 return;
   }
@@ -2482,8 +2484,6 @@
 return true;
   }
 
-  if (!Style.AllowShortEnumsOnASingleLine)
-addUnwrappedLine();
   // Parse enum body.
   nextToken();
   if (!Style.AllowShortEnumsOnASingleLine) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits