[llvm-branch-commits] [llvm] 3437c7f - [WinEH] Fix the wrong alignment orientation during calculating EH frame.

2019-11-17 Thread via llvm-branch-commits

Author: Wang, Pengfei
Date: 2019-11-18T09:03:17+08:00
New Revision: 3437c7fc4470afa42c4e727e13585c861ae1f116

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

LOG: [WinEH] Fix the wrong alignment orientation during calculating EH frame.

Summary: This is a bug fix for further issues in PR43585.

Reviewers: rnk, RKSimon, craig.topper, andrew.w.kaylor

Subscribers: hiraditya, llvm-commits, annita.zhang

Tags: #llvm

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

(cherry picked from commit 8723b95cefa4f2a891c2b496dca79f1734cf1d1c)

Added: 


Modified: 
llvm/lib/Target/X86/X86FrameLowering.cpp
llvm/test/CodeGen/X86/win64-funclet-savexmm.ll

Removed: 




diff  --git a/llvm/lib/Target/X86/X86FrameLowering.cpp 
b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 854156b2bc8e..75cd92b3adc1 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -1869,7 +1869,7 @@ int X86FrameLowering::getWin64EHFrameIndexRef(const 
MachineFunction ,
 return getFrameIndexReference(MF, FI, FrameReg);
 
   FrameReg = TRI->getStackRegister();
-  return alignTo(MFI.getMaxCallFrameSize(), getStackAlignment()) + it->second;
+  return alignDown(MFI.getMaxCallFrameSize(), getStackAlignment()) + 
it->second;
 }
 
 int X86FrameLowering::getFrameIndexReferenceSP(const MachineFunction ,

diff  --git a/llvm/test/CodeGen/X86/win64-funclet-savexmm.ll 
b/llvm/test/CodeGen/X86/win64-funclet-savexmm.ll
index 62ddebb9a5a0..4c0979e9ec23 100644
--- a/llvm/test/CodeGen/X86/win64-funclet-savexmm.ll
+++ b/llvm/test/CodeGen/X86/win64-funclet-savexmm.ll
@@ -85,17 +85,17 @@ try.cont: ; preds = 
%catchret.dest, %inv
 ; CHECK: subq$88, %rsp
 ; CHECK: .seh_stackalloc 88
 ; CHECK: leaq112(%rdx), %rbp
-; CHECK: vmovaps %xmm8, 48(%rsp)
-; CHECK: .seh_savexmm 8, 48
-; CHECK: vmovaps %xmm7, 64(%rsp)
-; CHECK: .seh_savexmm 7, 64
-; CHECK: vmovaps %xmm6, 80(%rsp)
-; CHECK: .seh_savexmm 6, 80
+; CHECK: vmovaps %xmm8, 32(%rsp)
+; CHECK: .seh_savexmm 8, 32
+; CHECK: vmovaps %xmm7, 48(%rsp)
+; CHECK: .seh_savexmm 7, 48
+; CHECK: vmovaps %xmm6, 64(%rsp)
+; CHECK: .seh_savexmm 6, 64
 ; CHECK: .seh_endprologue
 ; CHECK: movl   -{{[0-9]+}}(%rbp), %ecx
-; CHECK: vmovaps 80(%rsp), %xmm6
-; CHECK: vmovaps 64(%rsp), %xmm7
-; CHECK: vmovaps 48(%rsp), %xmm8
+; CHECK: vmovaps 64(%rsp), %xmm6
+; CHECK: vmovaps 48(%rsp), %xmm7
+; CHECK: vmovaps 32(%rsp), %xmm8
 ; CHECK: leaq.LBB0_1(%rip), %rax
 ; CHECK: addq$88, %rsp
 ; CHECK: popq%rbx



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


[llvm-branch-commits] [llvm] 1348294 - baseline

2019-11-08 Thread via llvm-branch-commits

Author: joanlluch
Date: 2019-10-17T12:27:20+02:00
New Revision: 134829441250e27a8c41b01cdb562f27842947bc

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

LOG: baseline

Added: 
llvm/test/CodeGen/MSP430/shift-amount-threshold.ll

Modified: 


Removed: 




diff  --git a/llvm/test/CodeGen/MSP430/shift-amount-threshold.ll 
b/llvm/test/CodeGen/MSP430/shift-amount-threshold.ll
new file mode 100644
index ..19acb5f19739
--- /dev/null
+++ b/llvm/test/CodeGen/MSP430/shift-amount-threshold.ll
@@ -0,0 +1,189 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s | FileCheck %s
+target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16"
+target triple = "msp430"
+
+define dso_local i16 @test000a(i16 %a) local_unnamed_addr #0 {
+; CHECK-LABEL: test000a:
+; CHECK:   ; %bb.0: ; %entry
+; CHECK-NEXT:and #32, r12
+; CHECK-NEXT:clrc
+; CHECK-NEXT:rrc r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:ret
+entry:
+  %and = and i16 %a, 32
+  %cmp = icmp ne i16 %and, 0
+  %conv = zext i1 %cmp to i16
+  ret i16 %conv
+}
+
+define dso_local i16 @test000b(i16 %a) local_unnamed_addr #0 {
+; CHECK-LABEL: test000b:
+; CHECK:   ; %bb.0: ; %entry
+; CHECK-NEXT:and #32, r12
+; CHECK-NEXT:clrc
+; CHECK-NEXT:rrc r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:ret
+entry:
+  %and = and i16 %a, 32
+  %cmp = icmp eq i16 %and, 32
+  %conv = zext i1 %cmp to i16
+  ret i16 %conv
+}
+
+define dso_local i16 @test000(i16 %a) local_unnamed_addr #0 {
+; CHECK-LABEL: test000:
+; CHECK:   ; %bb.0: ; %entry
+; CHECK-NEXT:mov r12, r13
+; CHECK-NEXT:clr r12
+; CHECK-NEXT:bit #2048, r13
+; CHECK-NEXT:jeq .LBB2_2
+; CHECK-NEXT:  ; %bb.1: ; %entry
+; CHECK-NEXT:mov #3, r12
+; CHECK-NEXT:  .LBB2_2: ; %entry
+; CHECK-NEXT:ret
+entry:
+  %and = and i16 %a, 2048
+  %cmp = icmp eq i16 %and, 0
+  %cond = select i1 %cmp, i16 0, i16 3
+  ret i16 %cond
+}
+
+define dso_local i16 @test00(i16 %a) local_unnamed_addr #0 {
+; CHECK-LABEL: test00:
+; CHECK:   ; %bb.0: ; %entry
+; CHECK-NEXT:inv r12
+; CHECK-NEXT:swpb r12
+; CHECK-NEXT:mov.b r12, r12
+; CHECK-NEXT:clrc
+; CHECK-NEXT:rrc r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:ret
+entry:
+  %cmp = icmp sgt i16 %a, -1
+  %cond = select i1 %cmp, i16 1, i16 0
+  ret i16 %cond
+}
+
+define dso_local i16 @test0(i16 %a) local_unnamed_addr #0 {
+; CHECK-LABEL: test0:
+; CHECK:   ; %bb.0: ; %entry
+; CHECK-NEXT:swpb r12
+; CHECK-NEXT:sxt r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:ret
+entry:
+  %cmp = icmp slt i16 %a, 0
+  %cond = select i1 %cmp, i16 -1, i16 0
+  ret i16 %cond
+}
+
+define dso_local i16 @test1(i16 %a) local_unnamed_addr #0 {
+; CHECK-LABEL: test1:
+; CHECK:   ; %bb.0: ; %entry
+; CHECK-NEXT:swpb r12
+; CHECK-NEXT:mov.b r12, r12
+; CHECK-NEXT:clrc
+; CHECK-NEXT:rrc r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:ret
+entry:
+  %cmp = icmp slt i16 %a, 0
+  %cond = select i1 %cmp, i16 1, i16 0
+  ret i16 %cond
+}
+
+define dso_local i16 @test2(i16 %a) local_unnamed_addr #0 {
+; CHECK-LABEL: test2:
+; CHECK:   ; %bb.0: ; %entry
+; CHECK-NEXT:swpb r12
+; CHECK-NEXT:mov.b r12, r12
+; CHECK-NEXT:clrc
+; CHECK-NEXT:rrc r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:and #2, r12
+; CHECK-NEXT:ret
+entry:
+  %cmp = icmp slt i16 %a, 0
+  %cond = select i1 %cmp, i16 2, i16 0
+  ret i16 %cond
+}
+
+define dso_local i16 @test3(i16 %a) local_unnamed_addr #0 {
+; CHECK-LABEL: test3:
+; CHECK:   ; %bb.0: ; %entry
+; CHECK-NEXT:swpb r12
+; CHECK-NEXT:sxt r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:rra r12
+; CHECK-NEXT:and #3, r12
+; CHECK-NEXT:ret
+entry:
+  %cmp = icmp slt i16 %a, 0
+  %cond = select i1 %cmp, i16 3, i16 0
+  ret i16 %cond
+}
+
+define dso_local i16 @test4(i16 %a, i16 %b) local_unnamed_addr #0 {
+; CHECK-LABEL: test4:
+; CHECK:   ; %bb.0: ; 

[llvm-branch-commits] [lldb] 186c848 - Revert and patch "[Python] Remove readline module"

2019-11-21 Thread via llvm-branch-commits

Author: serge-sans-paille
Date: 2019-11-21T19:57:53+01:00
New Revision: 186c848d84f1a4e7cd5b217ff3ae26083e2fdedf

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

LOG: Revert and patch "[Python] Remove readline module"

Fix https://bugs.llvm.org/show_bug.cgi?id=43830 while avoiding polluting the
global Python namespace.

This both reverts r357277 to rebundle a version of Python's readline module
based on libedit.

However, this patch also provides two improvements over the previous
implementation:

1. use PyMem_RawMalloc instead of PyMem_Malloc, as expected by PyOS_Readline
   (prevents to segfault upon exit of interactive session)
2. patch the readline module upon embedded interpreter loading, instead of
   patching it globally, which should prevent any side effect on other
   modules/packages
3. only activate the patched module if libedit is actually linked in lldb

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

(cherry picked from commit 9357b5d08497326a1895cab6c1d712bf12a34519)

Added: 
lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h

Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt 
b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
index f7360d728891..915f07e2ca6a 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
@@ -14,6 +14,7 @@ endif()
 add_lldb_library(lldbPluginScriptInterpreterPython PLUGIN
   PythonDataObjects.cpp
   PythonExceptionState.cpp
+  PythonReadline.cpp
   ScriptInterpreterPython.cpp
 
   LINK_LIBS

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
new file mode 100644
index ..616522f9de90
--- /dev/null
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
@@ -0,0 +1,80 @@
+#include "PythonReadline.h"
+
+#ifdef LLDB_USE_LIBEDIT_READLINE_COMPAT_MODULE
+
+#include 
+
+#include 
+
+// Simple implementation of the Python readline module using libedit.
+// In the event that libedit is excluded from the build, this turns
+// back into a null implementation that blocks the module from pulling
+// in the GNU readline shared lib, which causes linkage confusion when
+// both readline and libedit's readline compatibility symbols collide.
+//
+// Currently it only installs a PyOS_ReadlineFunctionPointer, without
+// implementing any of the readline module methods. This is meant to
+// work around LLVM pr18841 to avoid seg faults in the stock Python
+// readline.so linked against GNU readline.
+//
+// Bug on the cpython side: https://bugs.python.org/issue38634
+
+PyDoc_STRVAR(moduleDocumentation,
+ "Simple readline module implementation based on libedit.");
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef readline_module = {
+PyModuleDef_HEAD_INIT, // m_base
+"lldb_editline",   // m_name
+moduleDocumentation,   // m_doc
+-1,// m_size
+nullptr,   // m_methods
+nullptr,   // m_reload
+nullptr,   // m_traverse
+nullptr,   // m_clear
+nullptr,   // m_free
+};
+#else
+static struct PyMethodDef moduleMethods[] = {{nullptr, nullptr, 0, nullptr}};
+#endif
+
+static char *
+#if PY_MAJOR_VERSION >= 3
+simple_readline(FILE *stdin, FILE *stdout, const char *prompt)
+#else
+simple_readline(FILE *stdin, FILE *stdout, char *prompt)
+#endif
+{
+  rl_instream = stdin;
+  rl_outstream = stdout;
+  char *line = readline(prompt);
+  if (!line) {
+char *ret = (char *)PyMem_RawMalloc(1);
+if (ret != NULL)
+  *ret = '\0';
+return ret;
+  }
+  if (*line)
+add_history(line);
+  int n = strlen(line);
+  char *ret = (char *)PyMem_RawMalloc(n + 2);
+  if (ret) {
+strncpy(ret, line, n);
+free(line);
+ret[n] = '\n';
+ret[n + 1] = '\0';
+  }
+  return ret;
+}
+
+PyMODINIT_FUNC initlldb_readline(void) {
+  PyOS_ReadlineFunctionPointer = simple_readline;
+
+#if PY_MAJOR_VERSION >= 3
+  return PyModule_Create(_module);
+#else
+  Py_InitModule4("lldb_readline", moduleMethods, moduleDocumentation,
+ static_cast(NULL), PYTHON_API_VERSION);
+#endif
+}
+#endif

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.h
new file mode 100644
index ..20242e2324d8
--- /dev/null
+++ 

[llvm-branch-commits] [lldb] 9b2d207 - [lldb] Fix readline/libedit compat patch for py2

2019-11-26 Thread via llvm-branch-commits

Author: serge-sans-paille
Date: 2019-11-26T15:46:26+01:00
New Revision: 9b2d207cf4b43cfc1a2b6940b3c06e50a1bd127f

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

LOG: [lldb] Fix readline/libedit compat patch for py2

This is a follow-up to https://reviews.llvm.org/D69793

(cherry picked from commit d590498829d8c0d4f4f673569949fa3850485c9c)

Added: 


Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
index 616522f9de90..674ec9b6140a 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
@@ -49,7 +49,11 @@ simple_readline(FILE *stdin, FILE *stdout, char *prompt)
   rl_outstream = stdout;
   char *line = readline(prompt);
   if (!line) {
+#if PY_MAJOR_VERSION >= 3
 char *ret = (char *)PyMem_RawMalloc(1);
+#else
+char *ret = (char *)PyMem_Malloc(1);
+#endif
 if (ret != NULL)
   *ret = '\0';
 return ret;
@@ -57,7 +61,11 @@ simple_readline(FILE *stdin, FILE *stdout, char *prompt)
   if (*line)
 add_history(line);
   int n = strlen(line);
+#if PY_MAJOR_VERSION >= 3
   char *ret = (char *)PyMem_RawMalloc(n + 2);
+#else
+  char *ret = (char *)PyMem_Malloc(n + 2);
+#endif
   if (ret) {
 strncpy(ret, line, n);
 free(line);
@@ -73,7 +81,7 @@ PyMODINIT_FUNC initlldb_readline(void) {
 #if PY_MAJOR_VERSION >= 3
   return PyModule_Create(_module);
 #else
-  Py_InitModule4("lldb_readline", moduleMethods, moduleDocumentation,
+  Py_InitModule4("readline", moduleMethods, moduleDocumentation,
  static_cast(NULL), PYTHON_API_VERSION);
 #endif
 }



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


[llvm-branch-commits] [clang] 7f447b4 - [docs] Add -Wmisleading-indentation to clang's release notes.

2020-02-22 Thread via llvm-branch-commits

Author: Tyker
Date: 2020-02-22T15:17:14+01:00
New Revision: 7f447b44f4eb73c35e6bc530a61bcaf30f78fc6d

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

LOG: [docs] Add -Wmisleading-indentation to clang's release notes.

Added: 


Modified: 
clang/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 18edc4ef51e3..177bf848f94c 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -75,6 +75,10 @@ Improvements to Clang's diagnostics
   warning now offers fixits. Excluding -Wrange-loop-bind-reference it is now
   part of -Wall. To reduce the number of false positives the diagnostic is
   disabled in macros and template instantiations.
+- -Wmisleading-indentation has been added. This warning is similar to the GCC
+  warning of the same name. It warns about statements that are indented as if
+  they were part of a if/else/for/while statement but are not semantically
+  part of that if/else/for/while.
 
 Non-comprehensive list of changes in this release
 -



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


[llvm-branch-commits] [llvm] 80f8132 - Format and use Small* data structures where appropriate

2020-01-15 Thread via llvm-branch-commits

Author: gbtozers
Date: 2020-01-15T12:17:41Z
New Revision: 80f81325b8e8f0bed81a28dffb8eba526002f2b3

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

LOG: Format and use Small* data structures where appropriate

Added: 


Modified: 
llvm/lib/Transforms/Scalar/DCE.cpp
llvm/lib/Transforms/Scalar/JumpThreading.cpp
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Scalar/DCE.cpp 
b/llvm/lib/Transforms/Scalar/DCE.cpp
index 716b2264eddd..615ca5e31333 100644
--- a/llvm/lib/Transforms/Scalar/DCE.cpp
+++ b/llvm/lib/Transforms/Scalar/DCE.cpp
@@ -135,7 +135,7 @@ struct PureUndefDbgInstElimination : public FunctionPass {
 AU.setPreservesCFG();
   }
 };
-}
+} // namespace
 
 char PureUndefDbgInstElimination::ID = 0;
 INITIALIZE_PASS(PureUndefDbgInstElimination, "pure-undef-dbg-inst-elim",

diff  --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp 
b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index bc769f01ca21..ce2a14de25da 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -420,12 +420,13 @@ bool JumpThreadingPass::runImpl(Function , 
TargetLibraryInfo *TLI_,
   auto *BI = dyn_cast(BB.getTerminator());
   if (BI && BI->isUnconditional()) {
 BasicBlock *Succ = BI->getSuccessor(0);
-if(
+if (
 // The terminator must be the only non-phi instruction in BB.
 BB.getFirstNonPHIOrDbg()->isTerminator() &&
 // Don't alter Loop headers and latches to ensure another pass can
 // detect and transform nested loops later.
-!LoopHeaders.count() && !LoopHeaders.count(BI->getSuccessor(0)) 
&&
+!LoopHeaders.count() &&
+!LoopHeaders.count(BI->getSuccessor(0)) &&
 TryToSimplifyUncondBranchFromEmptyBlock(, DTU)) {
   // BB is valid for cleanup here because we passed in DTU. F remains
   // BB's parent until a DTU->getDomTree() event.

diff  --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp 
b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index c9e34c39d830..5bae1e8eb7ef 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -315,37 +315,37 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, 
DomTreeUpdater *DTU,
 }
 
 bool llvm::RemovePureUndefDbgInstrs(Function ) {
-  DenseMap > VariableMap;
-  DenseSet NonUndefVariables;
+  SmallDenseMap, 8>
+  UndefVariableMap;
+  SmallDenseSet NonUndefVariables;
 
   for (auto  : F) {
 for (auto  : BB) {
   if (DbgValueInst *DVI = dyn_cast()) {
-DebugVariable Key(DVI->getVariable(),
-  DVI->getExpression(),
+DebugVariable Key(DVI->getVariable(), DVI->getExpression(),
   DVI->getDebugLoc()->getInlinedAt());
 if (NonUndefVariables.count(Key))
   continue;
 if (DVI->getValue() == UndefValue::get(DVI->getValue()->getType())) {
-  auto R = VariableMap.insert(
-{ Key, SmallVector(1, DVI) });
+  auto R = UndefVariableMap.insert(
+  {Key, SmallVector(1, DVI)});
   if (!R.second) {
 auto VMI = R.first;
 VMI->second.push_back(DVI);
   }
 } else {
   NonUndefVariables.insert(Key);
-  VariableMap.erase(Key);
+  UndefVariableMap.erase(Key);
 }
   }
 }
   }
 
-  for (auto VariableMapping : VariableMap)
-for (auto  : VariableMapping.second)
+  for (auto UndefVariableMapping : UndefVariableMap)
+for (auto  : UndefVariableMapping.second)
   Instr->eraseFromParent();
 
-  return VariableMap.size() > 0;
+  return UndefVariableMap.size() > 0;
 }
 
 /// Remove redundant instructions within sequences of consecutive dbg.value



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


[llvm-branch-commits] [llvm] 3191fa2 - Use isa where needed

2020-01-15 Thread via llvm-branch-commits

Author: gbtozers
Date: 2020-01-15T15:51:22Z
New Revision: 3191fa21be09d6e7352751f86626a2e8fb251555

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

LOG: Use isa where needed

Added: 


Modified: 
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp 
b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 5bae1e8eb7ef..9d703d2ab7db 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -326,7 +326,7 @@ bool llvm::RemovePureUndefDbgInstrs(Function ) {
   DVI->getDebugLoc()->getInlinedAt());
 if (NonUndefVariables.count(Key))
   continue;
-if (DVI->getValue() == UndefValue::get(DVI->getValue()->getType())) {
+if (isa(DVI->getValue())) {
   auto R = UndefVariableMap.insert(
   {Key, SmallVector(1, DVI)});
   if (!R.second) {



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


[llvm-branch-commits] [clang] cd4c65f - Add __warn_memset_zero_len builtin as a workaround for glibc issue

2020-01-17 Thread via llvm-branch-commits

Author: serge-sans-paille
Date: 2020-01-17T10:01:55+01:00
New Revision: cd4c65f91d5a77de28239979b772a8022dc6627a

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

LOG: Add __warn_memset_zero_len builtin as a workaround for glibc issue

Glibc issue: https://sourceware.org/bugzilla/show_bug.cgi?id=25399
The fix consist in considering the missing function as a builtin lowered to a 
nop.

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

(cherry picked from commit d293417931d3a9d46799b42795988ca3b5cfd766)

Added: 


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

Removed: 




diff  --git a/clang/include/clang/Basic/Builtins.def 
b/clang/include/clang/Basic/Builtins.def
index d388afe7fae6..1a6c85ce2dd3 100644
--- a/clang/include/clang/Basic/Builtins.def
+++ b/clang/include/clang/Basic/Builtins.def
@@ -788,6 +788,9 @@ BUILTIN(__builtin_abort, "v", "Fnr")
 BUILTIN(__builtin_index, "c*cC*i", "Fn")
 BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
 
+// ignored glibc builtin, see 
https://sourceware.org/bugzilla/show_bug.cgi?id=25399
+BUILTIN(__warn_memset_zero_len, "v", "nU")
+
 // Microsoft builtins.  These are only active with -fms-extensions.
 LANGBUILTIN(_alloca,  "v*z", "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(__annotation, "wC*.","n", ALL_MS_LANGUAGES)

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 09fd3087b494..2d20f92fbb3d 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -3222,6 +3222,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 Builder.CreateZExt(EmitSignBit(*this, EmitScalarExpr(E->getArg(0))),
ConvertType(E->getType(;
   }
+  case Builtin::BI__warn_memset_zero_len:
+return RValue::getIgnored();
   case Builtin::BI__annotation: {
 // Re-encode each wide string to UTF8 and make an MDString.
 SmallVector Strings;

diff  --git a/clang/test/CodeGen/builtins.c b/clang/test/CodeGen/builtins.c
index 591416d00cc7..9f2a74f6c873 100644
--- a/clang/test/CodeGen/builtins.c
+++ b/clang/test/CodeGen/builtins.c
@@ -453,6 +453,13 @@ void test_builtin_launder(int *p) {
   int *d = __builtin_launder(p);
 }
 
+// __warn_memset_zero_len should be NOP, see 
https://sourceware.org/bugzilla/show_bug.cgi?id=25399
+// CHECK-LABEL: define void @test___warn_memset_zero_len
+void test___warn_memset_zero_len() {
+  // CHECK-NOT: @__warn_memset_zero_len
+  __warn_memset_zero_len();
+}
+
 // Behavior of __builtin_os_log 
diff ers between platforms, so only test on X86
 #ifdef __x86_64__
 



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


[llvm-branch-commits] [clang-tools-extra] 39930d6 - Add new website to release notes.

2020-03-16 Thread via llvm-branch-commits

Author: Sam McCall
Date: 2020-03-16T11:51:51+01:00
New Revision: 39930d67fffb086cabd08bccdc26ca6ad99b3339

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

LOG: Add new website to release notes.

Added: 


Modified: 
clang-tools-extra/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index 10a48ea5f86a..fbd55e36d6fd 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -32,6 +32,8 @@ infrastructure are described first, followed by tool-specific 
sections.
 Improvements to clangd
 --
 
+- clangd documentation is now found at https://clangd.llvm.org/
+
 - Go-to-definition, hover, find-references etc use a new mechanism to identify
   what is under the cursor, which is (hopefully) more consistent and accurate.
 



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


[llvm-branch-commits] [clang] 68cd4f7 - Use FinishThunk to finish musttail thunks

2020-04-13 Thread via llvm-branch-commits

Author: Reid Kleckner
Date: 2020-04-13T10:34:45-07:00
New Revision: 68cd4f72beae67a9bdbc11c85fd745dec8fc0999

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

LOG: Use FinishThunk to finish musttail thunks

FinishThunk, and the invariant of setting and then unsetting
CurCodeDecl, was added in 7f416cc42638 (2015). The invariant didn't
exist when I added this musttail codepath in ab2090d10765 (2014).
Recently in 28328c3771, I started using this codepath on non-Windows
platforms, and users reported problems during release testing (PR44987).

The issue was already present for users of EH on i686-windows-msvc, so I
added a test for that case as well.

Reviewed By: hans

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

(cherry picked from commit ce5173c0e174870934d1b3a026f631d996136191)

Added: 
clang/test/CodeGenCXX/ms-thunks-ehspec.cpp
clang/test/CodeGenCXX/thunks-ehspec.cpp

Modified: 
clang/lib/CodeGen/CGVTables.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index 59631e802373..e97f7e41499d 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -437,7 +437,8 @@ void CodeGenFunction::EmitMustTailThunk(GlobalDecl GD,
   // Finish the function to maintain CodeGenFunction invariants.
   // FIXME: Don't emit unreachable code.
   EmitBlock(createBasicBlock());
-  FinishFunction();
+
+  FinishThunk();
 }
 
 void CodeGenFunction::generateThunk(llvm::Function *Fn,
@@ -564,7 +565,7 @@ llvm::Constant *CodeGenVTables::maybeEmitThunk(GlobalDecl 
GD,
   CGM.SetLLVMFunctionAttributesForDefinition(GD.getDecl(), ThunkFn);
 
   // Thunks for variadic methods are special because in general variadic
-  // arguments cannot be perferctly forwarded. In the general case, clang
+  // arguments cannot be perfectly forwarded. In the general case, clang
   // implements such thunks by cloning the original function body. However, for
   // thunks with no return adjustment on targets that support musttail, we can
   // use musttail to perfectly forward the variadic arguments.

diff  --git a/clang/test/CodeGenCXX/ms-thunks-ehspec.cpp 
b/clang/test/CodeGenCXX/ms-thunks-ehspec.cpp
new file mode 100644
index ..f72100d5078b
--- /dev/null
+++ b/clang/test/CodeGenCXX/ms-thunks-ehspec.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -fexceptions -fcxx-exceptions %s -triple=i686-windows-msvc 
-emit-llvm -o - | FileCheck %s
+
+// When generating thunks using musttail due to inalloca parameters, don't push
+// and pop terminate scopes. PR44987
+
+struct NonTrivial {
+  NonTrivial();
+  NonTrivial(const NonTrivial );
+  ~NonTrivial();
+  int x;
+};
+struct A {
+  virtual void f(NonTrivial o) noexcept;
+};
+struct B {
+  virtual void f(NonTrivial o) noexcept;
+};
+class C : A, B {
+  virtual void f(NonTrivial o) noexcept;
+};
+C c;
+
+// CHECK-LABEL: define linkonce_odr dso_local x86_thiscallcc void 
@"?f@C@@G3AEXUNonTrivial@@@Z"(%class.C* %this, <{ %struct.NonTrivial }>* 
inalloca %0)
+// CHECK-NOT: invoke
+// CHECK: musttail call x86_thiscallcc void 
@"?f@C@@EAEXUNonTrivial@@@Z"(%class.C* %{{.*}}, <{ %struct.NonTrivial }>* 
inalloca %0)
+// CHECK-NEXT  ret void
+

diff  --git a/clang/test/CodeGenCXX/thunks-ehspec.cpp 
b/clang/test/CodeGenCXX/thunks-ehspec.cpp
new file mode 100644
index ..30276948d3fc
--- /dev/null
+++ b/clang/test/CodeGenCXX/thunks-ehspec.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fexceptions -fcxx-exceptions %s 
-triple=x86_64-pc-linux-gnu -munwind-tables -emit-llvm -o - -O1 
-disable-llvm-passes | FileCheck %s
+
+// When generating the thunk for secondary, do not push terminate scopes for
+// either the varargs or non-varargs case. Related to PR44987.
+
+struct A {
+  virtual void primary_key();
+};
+struct B {
+  virtual void secondary();
+  virtual void secondary_vararg(int, ...);
+};
+class C : A, B {
+  virtual void primary_key();
+  void secondary() noexcept;
+  void secondary_vararg(int, ...) noexcept;
+};
+void C::primary_key() {}
+
+// CHECK-LABEL: define available_externally void 
@_ZThn8_N1C9secondaryEv(%class.C* %this)
+// CHECK-NOT: invoke
+// CHECK: tail call void @_ZN1C9secondaryEv(%class.C* %{{.*}})
+// CHECK-NOT: invoke
+// CHECK: ret void
+
+// CHECK-LABEL: define available_externally void 
@_ZThn8_N1C16secondary_varargEiz(%class.C* %this, i32 %0, ...)
+// CHECK-NOT: invoke
+// CHECK:  musttail call void (%class.C*, i32, ...) 
@_ZN1C16secondary_varargEiz(%class.C* %{{.*}}, i32 %{{.*}}, ...) #2
+// CHECK-NEXT:  ret void



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


[llvm-branch-commits] [llvm] 47e68d8 - [CodeGen] Fix sinking local values in lpads with phis

2020-04-13 Thread via llvm-branch-commits

Author: Reid Kleckner
Date: 2020-04-13T13:37:15-07:00
New Revision: 47e68d864420afd42d34fd25e97522e5c149de46

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

LOG: [CodeGen] Fix sinking local values in lpads with phis

There was already a test case for landingpads to handle this case, but I
had forgotten to consider PHI instructions preceding the EH_LABEL in the
landingpad.

PR45261

(cherry picked from commit e5bf5037d869c74bc2faf81fa1f58dfd827e8356)

Added: 


Modified: 
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/test/CodeGen/X86/sink-local-value.ll

Removed: 




diff  --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp 
b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index 8294591b7326..6ecde9b43c07 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -225,6 +225,21 @@ static bool isRegUsedByPhiNodes(unsigned DefReg,
   return false;
 }
 
+static bool isTerminatingEHLabel(MachineBasicBlock *MBB, MachineInstr ) {
+  // Ignore non-EH labels.
+  if (!MI.isEHLabel())
+return false;
+
+  // Any EH label outside a landing pad must be for an invoke. Consider it a
+  // terminator.
+  if (!MBB->isEHPad())
+return true;
+
+  // If this is a landingpad, the first non-phi instruction will be an 
EH_LABEL.
+  // Don't consider that label to be a terminator.
+  return MI.getIterator() != MBB->getFirstNonPHI();
+}
+
 /// Build a map of instruction orders. Return the first terminator and its
 /// order. Consider EH_LABEL instructions to be terminators as well, since 
local
 /// values for phis after invokes must be materialized before the call.
@@ -233,7 +248,7 @@ void FastISel::InstOrderMap::initialize(
   unsigned Order = 0;
   for (MachineInstr  : *MBB) {
 if (!FirstTerminator &&
-(I.isTerminator() || (I.isEHLabel() &&  != >front( {
+(I.isTerminator() || isTerminatingEHLabel(MBB, I))) {
   FirstTerminator = 
   FirstTerminatorOrder = Order;
 }

diff  --git a/llvm/test/CodeGen/X86/sink-local-value.ll 
b/llvm/test/CodeGen/X86/sink-local-value.ll
index b0e511ac1189..f7d861ac9b6c 100644
--- a/llvm/test/CodeGen/X86/sink-local-value.ll
+++ b/llvm/test/CodeGen/X86/sink-local-value.ll
@@ -145,6 +145,42 @@ try.cont: ; preds 
= %entry, %lpad
 ; CHECK: retl
 
 
+define i32 @lpad_phi() personality i32 (...)* @__gxx_personality_v0 {
+entry:
+  store i32 42, i32* @sink_across
+  invoke void @may_throw()
+  to label %try.cont unwind label %lpad
+
+lpad: ; preds = %entry
+  %p = phi i32 [ 11, %entry ]  ; Trivial, but -O0 keeps it
+  %0 = landingpad { i8*, i32 }
+  catch i8* null
+  store i32 %p, i32* @sink_across
+  br label %try.cont
+
+try.cont: ; preds = %entry, %lpad
+  %r.0 = phi i32 [ 13, %entry ], [ 55, %lpad ]
+  ret i32 %r.0
+}
+
+; The constant materialization should be *after* the stores to sink_across, but
+; before any EH_LABEL.
+
+; CHECK-LABEL: lpad_phi:
+; CHECK: movl$42, sink_across
+; CHECK: movl$13, %{{[a-z]*}}
+; CHECK: .Ltmp{{.*}}:
+; CHECK: calll   may_throw
+; CHECK: .Ltmp{{.*}}:
+; CHECK: jmp .LBB{{.*}}
+; CHECK: .LBB{{.*}}:# %lpad
+; CHECK-NEXT: .Ltmp{{.*}}:
+; CHECK: movl{{.*}}, sink_across
+; CHECK: movl$55, %{{[a-z]*}}
+; CHECK: .LBB{{.*}}:# %try.cont
+; CHECK: retl
+
+
 ; Function Attrs: nounwind readnone speculatable
 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
 



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


[llvm-branch-commits] [llvm] 2e59efa - Revert "base changes"

2020-08-10 Thread via llvm-branch-commits

Author: SharmaRithik
Date: 2020-08-10T22:57:07+05:30
New Revision: 2e59efac833cce636feeaaacfadc7f0e5218e5da

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

LOG: Revert "base changes"

This reverts commit 8b679fbdd28129fc31d57c75614b83ee8501b4ab.

Added: 


Modified: 
llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp

Removed: 




diff  --git a/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h 
b/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
index b313dccdde3b..630f936471f2 100644
--- a/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
@@ -16,7 +16,6 @@
 
 namespace llvm {
 
-class AAResults;
 class BasicBlock;
 class DependenceInfo;
 class DominatorTree;
@@ -41,14 +40,14 @@ bool isControlFlowEquivalent(const BasicBlock , const 
BasicBlock ,
 bool isSafeToMoveBefore(Instruction , Instruction ,
 DominatorTree ,
 const PostDominatorTree *PDT = nullptr,
-DependenceInfo *DI = nullptr, AAResults *AA = nullptr);
+DependenceInfo *DI = nullptr);
 
 /// Return true if all instructions (except the terminator) in \p BB can be
 /// safely moved before \p InsertPoint.
 bool isSafeToMoveBefore(BasicBlock , Instruction ,
 DominatorTree ,
 const PostDominatorTree *PDT = nullptr,
-DependenceInfo *DI = nullptr, AAResults *AA = nullptr);
+DependenceInfo *DI = nullptr);
 
 /// Move instructions, in an order-preserving manner, from \p FromBB to the
 /// beginning of \p ToBB when proven safe.

diff  --git a/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp 
b/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
index 1367baf8e137..08047dc0f96e 100644
--- a/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
+++ b/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
@@ -14,7 +14,6 @@
 #include "llvm/Transforms/Utils/CodeMoverUtils.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/Statistic.h"
-#include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/DependenceAnalysis.h"
 #include "llvm/Analysis/PostDominators.h"
 #include "llvm/Analysis/ValueTracking.h"
@@ -227,82 +226,6 @@ bool ControlConditions::isInverse(const Value , const 
Value ) {
   return false;
 }
 
-/// Checks data dependency between /p I and instructions in /p InstsToCheck
-/// using dependence info.
-static bool isDependenceSafe(Instruction , DependenceInfo ,
- SmallPtrSetImpl ) {
-  return llvm::none_of(InstsToCheck, [, ](Instruction *CurInst) {
-auto DepResult = DI.depends(, CurInst, true);
-return (DepResult && (DepResult->isOutput() || DepResult->isFlow() ||
-  DepResult->isAnti()));
-  });
-}
-
-/// Checks data dependency between /p I and instructions in /p InstsToCheck
-/// using alias analysis.
-static bool isDependenceSafe(Instruction , AAResults ,
- SmallPtrSetImpl ) {
-  if (!I.mayReadOrWriteMemory())
-return true;
-
-  SmallVector MemLocs;
-  if (CallInst *CI = dyn_cast()) {
-for (Value *Op : CI->arg_operands())
-  if (Op->getType()->isPointerTy()) {
-MemLocs.push_back(
-MemoryLocation(Op, LocationSize::unknown(), AAMDNodes()));
-  }
-  } else {
-MemLocs.push_back(MemoryLocation::get());
-  }
-  for (MemoryLocation MemLoc : MemLocs) {
-return llvm::none_of(InstsToCheck, [, , ](Instruction *Inst) {
-  if (!Inst->mayReadOrWriteMemory())
-return false;
-  /// Get memory location for CallInst can be none and it won't be used for
-  /// CallInst.
-  auto DestMemLoc = MemoryLocation::get(Inst);
-  ModRefInfo Result, DestResult;
-  if (CallBase *CBSrc = dyn_cast()) {
-if (CallBase *CBDest = dyn_cast(Inst)) {
-  Result = DestResult = AA.getModRefInfo(CBSrc, CBDest);
-} else {
-  Result = AA.getModRefInfo(CBSrc, DestMemLoc);
-  DestResult = AA.getModRefInfo(Inst, CBSrc);
-}
-  } else if (CallBase *CBDest = dyn_cast(Inst)) {
-Result = AA.getModRefInfo(, CBDest);
-DestResult = AA.getModRefInfo(CBDest, MemLoc);
-  } else {
-Result = AA.getModRefInfo(Inst, MemLoc);
-DestResult = AA.getModRefInfo(, DestMemLoc);
-if (AA.isNoAlias(MemLoc, DestMemLoc)) {
-  auto DestMemLoc = MemoryLocation::get(Inst);
-  if (MemLoc.Size.hasValue() && DestMemLoc.Size.hasValue() &&
-  AA.isNoAlias(MemLoc, DestMemLoc))
-return false;
-}
-  }
-  // RAR dependency is safe
-  if (isRefSet(Result) && 

[llvm-branch-commits] [llvm] 8b679fb - base changes

2020-08-10 Thread via llvm-branch-commits

Author: SharmaRithik
Date: 2020-08-10T22:43:54+05:30
New Revision: 8b679fbdd28129fc31d57c75614b83ee8501b4ab

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

LOG: base changes

Added: 


Modified: 
llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp

Removed: 




diff  --git a/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h 
b/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
index 630f936471f22..b313dccdde3bf 100644
--- a/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
@@ -16,6 +16,7 @@
 
 namespace llvm {
 
+class AAResults;
 class BasicBlock;
 class DependenceInfo;
 class DominatorTree;
@@ -40,14 +41,14 @@ bool isControlFlowEquivalent(const BasicBlock , const 
BasicBlock ,
 bool isSafeToMoveBefore(Instruction , Instruction ,
 DominatorTree ,
 const PostDominatorTree *PDT = nullptr,
-DependenceInfo *DI = nullptr);
+DependenceInfo *DI = nullptr, AAResults *AA = nullptr);
 
 /// Return true if all instructions (except the terminator) in \p BB can be
 /// safely moved before \p InsertPoint.
 bool isSafeToMoveBefore(BasicBlock , Instruction ,
 DominatorTree ,
 const PostDominatorTree *PDT = nullptr,
-DependenceInfo *DI = nullptr);
+DependenceInfo *DI = nullptr, AAResults *AA = nullptr);
 
 /// Move instructions, in an order-preserving manner, from \p FromBB to the
 /// beginning of \p ToBB when proven safe.

diff  --git a/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp 
b/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
index 08047dc0f96ee..1367baf8e1379 100644
--- a/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
+++ b/llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
@@ -14,6 +14,7 @@
 #include "llvm/Transforms/Utils/CodeMoverUtils.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/DependenceAnalysis.h"
 #include "llvm/Analysis/PostDominators.h"
 #include "llvm/Analysis/ValueTracking.h"
@@ -226,6 +227,82 @@ bool ControlConditions::isInverse(const Value , const 
Value ) {
   return false;
 }
 
+/// Checks data dependency between /p I and instructions in /p InstsToCheck
+/// using dependence info.
+static bool isDependenceSafe(Instruction , DependenceInfo ,
+ SmallPtrSetImpl ) {
+  return llvm::none_of(InstsToCheck, [, ](Instruction *CurInst) {
+auto DepResult = DI.depends(, CurInst, true);
+return (DepResult && (DepResult->isOutput() || DepResult->isFlow() ||
+  DepResult->isAnti()));
+  });
+}
+
+/// Checks data dependency between /p I and instructions in /p InstsToCheck
+/// using alias analysis.
+static bool isDependenceSafe(Instruction , AAResults ,
+ SmallPtrSetImpl ) {
+  if (!I.mayReadOrWriteMemory())
+return true;
+
+  SmallVector MemLocs;
+  if (CallInst *CI = dyn_cast()) {
+for (Value *Op : CI->arg_operands())
+  if (Op->getType()->isPointerTy()) {
+MemLocs.push_back(
+MemoryLocation(Op, LocationSize::unknown(), AAMDNodes()));
+  }
+  } else {
+MemLocs.push_back(MemoryLocation::get());
+  }
+  for (MemoryLocation MemLoc : MemLocs) {
+return llvm::none_of(InstsToCheck, [, , ](Instruction *Inst) {
+  if (!Inst->mayReadOrWriteMemory())
+return false;
+  /// Get memory location for CallInst can be none and it won't be used for
+  /// CallInst.
+  auto DestMemLoc = MemoryLocation::get(Inst);
+  ModRefInfo Result, DestResult;
+  if (CallBase *CBSrc = dyn_cast()) {
+if (CallBase *CBDest = dyn_cast(Inst)) {
+  Result = DestResult = AA.getModRefInfo(CBSrc, CBDest);
+} else {
+  Result = AA.getModRefInfo(CBSrc, DestMemLoc);
+  DestResult = AA.getModRefInfo(Inst, CBSrc);
+}
+  } else if (CallBase *CBDest = dyn_cast(Inst)) {
+Result = AA.getModRefInfo(, CBDest);
+DestResult = AA.getModRefInfo(CBDest, MemLoc);
+  } else {
+Result = AA.getModRefInfo(Inst, MemLoc);
+DestResult = AA.getModRefInfo(, DestMemLoc);
+if (AA.isNoAlias(MemLoc, DestMemLoc)) {
+  auto DestMemLoc = MemoryLocation::get(Inst);
+  if (MemLoc.Size.hasValue() && DestMemLoc.Size.hasValue() &&
+  AA.isNoAlias(MemLoc, DestMemLoc))
+return false;
+}
+  }
+  // RAR dependency is safe
+  if (isRefSet(Result) && isRefSet(DestResult))
+return false;
+  return true;
+  

[llvm-branch-commits] [flang] 47567ca - [flang][openxx][NFC] Remove duplicated function to check required clauses

2021-01-11 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2021-01-11T14:08:51-05:00
New Revision: 47567ca5faca147bcc28bcbbaa6bf448354bb5d4

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

LOG: [flang][openxx][NFC] Remove duplicated function to check required clauses

Remove duplicated function to check for required clauses on a directive. This 
was
still there from the merging of OpenACC and OpenMP common semantic checks and 
it can now be
removed so we use only one function.

Reviewed By: sameeranjoshi

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

Added: 


Modified: 
flang/lib/Semantics/check-directive-structure.h
flang/lib/Semantics/check-omp-structure.cpp
flang/test/Semantics/omp-device-constructs.f90

Removed: 




diff  --git a/flang/lib/Semantics/check-directive-structure.h 
b/flang/lib/Semantics/check-directive-structure.h
index 822cdca9b66a..062f85b63b85 100644
--- a/flang/lib/Semantics/check-directive-structure.h
+++ b/flang/lib/Semantics/check-directive-structure.h
@@ -232,8 +232,6 @@ class DirectiveStructureChecker : public virtual 
BaseChecker {
   // Check that only clauses in set are after the specific clauses.
   void CheckOnlyAllowedAfter(C clause, common::EnumSet set);
 
-  void CheckRequired(C clause);
-
   void CheckRequireAtLeastOneOf();
 
   void CheckAllowed(C clause);
@@ -326,6 +324,8 @@ DirectiveStructureChecker::ClauseSetToString(
 template 
 void DirectiveStructureChecker::CheckRequireAtLeastOneOf() {
+  if (GetContext().requiredClauses.empty())
+return;
   for (auto cl : GetContext().actualClauses) {
 if (GetContext().requiredClauses.test(cl))
   return;
@@ -447,17 +447,6 @@ void DirectiveStructureChecker::SayNotMatching(
   .Attach(beginSource, "Does not match directive"_en_US);
 }
 
-// Check that at least one of the required clauses is present on the directive.
-template 
-void DirectiveStructureChecker::CheckRequired(C c) {
-  if (!FindClause(c)) {
-context_.Say(GetContext().directiveSource,
-"At least one %s clause must appear on the %s directive"_err_en_US,
-parser::ToUpperCaseLetters(getClauseName(c).str()),
-ContextDirectiveAsFortran());
-  }
-}
-
 // Check the value of the clause is a positive parameter.
 template 
 void DirectiveStructureCheckerhttps://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [mlir] 9c0dc0b - [mlir][Linalg] Fold init_tensor -> linalg.tensor_reshape.

2021-01-11 Thread via llvm-branch-commits

Author: MaheshRavishankar
Date: 2021-01-11T09:22:35-08:00
New Revision: 9c0dc0b2c1cc973056237bdd80dbba749941ea63

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

LOG: [mlir][Linalg] Fold init_tensor -> linalg.tensor_reshape.

Reshaping an init_tensor can be folded to a init_tensor op of the
final type.

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

Added: 


Modified: 
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/test/Dialect/Linalg/canonicalize.mlir

Removed: 




diff  --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp 
b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 8a97753e1a5c..8732065bb042 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -718,9 +718,123 @@ struct ReplaceDimOfInitTensorOp : public 
OpRewritePattern {
 };
 } // namespace
 
+static Value getCollapsedInitTensor(OpBuilder ,
+TensorReshapeOp reshapeOp) {
+  Location loc = reshapeOp.getLoc();
+  SmallVector dynamicShapes;
+  SmallVector staticShapes;
+  auto reassociation = reshapeOp.getReassociationMaps();
+  Value src = reshapeOp.src();
+  RankedTensorType srcType = reshapeOp.getSrcType();
+  ArrayRef srcShape = srcType.getShape();
+  for (auto map : reassociation) {
+Value linearizedDynamicDim = nullptr;
+int64_t linearizedStaticDim = 1;
+for (unsigned i : llvm::map_range(map.getResults(), [](AffineExpr e) {
+   return e.cast().getPosition();
+ })) {
+  if (ShapedType::isDynamic(srcShape[i])) {
+Value shapeVal = builder.create(loc, src, i);
+if (linearizedDynamicDim) {
+  linearizedDynamicDim =
+  builder.create(loc, linearizedDynamicDim, shapeVal);
+} else {
+  linearizedDynamicDim = shapeVal;
+}
+  } else {
+linearizedStaticDim *= srcShape[i];
+  }
+}
+if (linearizedDynamicDim) {
+  if (linearizedStaticDim != 1) {
+linearizedDynamicDim = builder.create(
+loc, linearizedDynamicDim,
+builder.create(loc, linearizedStaticDim));
+  }
+  dynamicShapes.push_back(linearizedDynamicDim);
+  staticShapes.push_back(ShapedType::kDynamicSize);
+} else {
+  staticShapes.push_back(linearizedStaticDim);
+}
+  }
+  return builder.create(loc, dynamicShapes, staticShapes,
+  srcType.getElementType());
+}
+
+static Value getExpandedInitTensor(OpBuilder ,
+   TensorReshapeOp reshapeOp) {
+  SmallVector dynamicShapes;
+  SmallVector staticShapes;
+  auto reassociation = reshapeOp.getReassociationMaps();
+  Value src = reshapeOp.src();
+  RankedTensorType srcType = reshapeOp.getSrcType();
+  ArrayRef srcShape = srcType.getShape();
+  ArrayRef dstShape = reshapeOp.getResultType().getShape();
+  Location loc = reshapeOp.getLoc();
+  for (auto map : enumerate(reassociation)) {
+int64_t linearizedStaticDim = 1;
+bool hasDynamic = false;
+for (unsigned i :
+ llvm::map_range(map.value().getResults(), [](AffineExpr e) {
+   return e.cast().getPosition();
+ })) {
+  if (ShapedType::isDynamic(dstShape[i])) {
+// Only one of the dimensions of the expanded shape should be dynamic.
+if (hasDynamic)
+  return nullptr;
+hasDynamic = true;
+staticShapes.push_back(ShapedType::kDynamicSize);
+continue;
+  }
+  staticShapes.push_back(dstShape[i]);
+  linearizedStaticDim *= dstShape[i];
+}
+if (hasDynamic) {
+  // If the expanded dimensions has a dynamic shape, the src shape must be
+  // dynamic as well.
+  if (!ShapedType::isDynamic(srcShape[map.index()]))
+return nullptr;
+  Value dynamicDim = builder.create(loc, src, map.index());
+  if (linearizedStaticDim != 1) {
+dynamicDim = builder.create(
+loc, dynamicDim,
+builder.create(loc, linearizedStaticDim));
+  }
+  dynamicShapes.push_back(dynamicDim);
+}
+  }
+  return builder.create(loc, dynamicShapes, staticShapes,
+  srcType.getElementType());
+}
+
+namespace {
+struct FoldWithTensorReshapeOp : public OpRewritePattern {
+  using OpRewritePattern::OpRewritePattern;
+
+  LogicalResult matchAndRewrite(TensorReshapeOp reshapeOp,
+PatternRewriter ) const override {
+if (!reshapeOp.src().getDefiningOp())
+  return failure();
+RankedTensorType collapsedType = reshapeOp.getSrcType();
+RankedTensorType expandedType = reshapeOp.getResultType();
+bool isCollapsed = expandedType.getRank() < collapsedType.getRank();
+if (isCollapsed)
+  std::swap(collapsedType, expandedType);
+Value 

[llvm-branch-commits] [mlir] c4486cf - [mlir][Linalg] Fix reshape fusion to reshape the outs instead of creating new tensors.

2021-01-11 Thread via llvm-branch-commits

Author: MaheshRavishankar
Date: 2021-01-11T09:26:22-08:00
New Revision: c4486cfd556869a837911c7719fb6c36018bbd1f

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

LOG: [mlir][Linalg] Fix reshape fusion to reshape the outs instead of creating 
new tensors.

When fusing tensor_reshape ops with generic/indexed_Generic op, new
linalg.init_tensor operations were created for the `outs` of the fused
op. While correct (technically) it is better to just reshape the
original `outs` operands and rely on canonicalization of init_tensor
-> tensor_reshape to achieve the same effect.

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

Added: 


Modified: 
mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
mlir/test/Dialect/Linalg/reshape_fusion.mlir
mlir/test/Dialect/Linalg/reshape_linearization_fusion.mlir

Removed: 




diff  --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td 
b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
index a2e7d436eeb8..0ce86e403681 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
@@ -183,6 +183,14 @@ class Linalg_ReshapeLikeOp 
traits = []> :
   return llvm::to_vector<4>(llvm::map_range(reassociation(), [
   ](Attribute a) { return a.cast().getValue(); }));
 }
+SmallVector getReassociationExprs() {
+  return
+llvm::to_vector<4>(llvm::map_range(reassociation(),
+ [](Attribute a) {
+   return llvm::to_vector<2>(
+ a.cast().getValue().getResults());
+ }));
+}
   }];
   let assemblyFormat = [{
 $src $reassociation attr-dict `:` type($src) `into` type(results)

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp 
b/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
index 37062ac33e2b..833662d282b6 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
@@ -566,45 +566,6 @@ static RankedTensorType getExpandedType(RankedTensorType 
originalType,
   return RankedTensorType::get(expandedShape, originalType.getElementType());
 }
 
-/// Get the value to use for the output in the expanded operation given the
-/// `indexingMap` for the output in the original op. Creates an
-/// `linalg.init_tensor` operation to materialize the tensor that carries the
-/// shape information. This is only used when the tensor_reshape is expanding
-/// and is a consumer. In such cases, the tensor_reshape op semantics 
gaurantees
-/// that the shape of the output is computable from the shape of the input 
since
-/// at most one of the expanded dims can be dynamic.
-static Value getOutputValueForExpandedOp(OpBuilder , Location loc,
- AffineMap indexingMap, Value result,
- const ExpansionInfo ) {
-  SmallVector dynamicDims;
-  SmallVector staticDims;
-  ShapedType resultType = result.getType().cast();
-  ArrayRef origShape = resultType.getShape();
-  for (AffineExpr expr : indexingMap.getResults()) {
-unsigned origDimPos = expr.cast().getPosition();
-bool foundDynamic = false;
-int64_t linearizedShape = 1;
-for (int64_t extent : expansionInfo.getExpandedShapeOfDim(origDimPos)) {
-  if (ShapedType::isDynamic(extent)) {
-assert(!foundDynamic &&
-   "Expanded dimensions of reshape can have only one dynamic dim");
-staticDims.push_back(ShapedType::kDynamicSize);
-foundDynamic = true;
-continue;
-  }
-  staticDims.push_back(extent);
-  linearizedShape *= extent;
-}
-if (ShapedType::isDynamic(origShape[origDimPos])) {
-  Value origDim = builder.create(loc, result, origDimPos);
-  dynamicDims.push_back(builder.create(
-  loc, origDim, builder.create(loc, 
linearizedShape)));
-}
-  }
-  return builder.create(loc, dynamicDims, staticDims,
-  resultType.getElementType());
-}
-
 /// Returns the reassociation maps to use in the `linalg.tensor_reshape`
 /// operation to convert the operands of the origial operation to operands of
 /// the expanded operation. The same method is used to compute the
@@ -734,8 +695,16 @@ fuseWithReshapeByExpansion(LinalgOp linalgOp, 
TensorReshapeOp reshapeOp,
   SmallVector outputs;
   for (auto result : llvm::enumerate(linalgOp.getOutputs())) {
 AffineMap indexingMap = linalgOp.getOutputIndexingMap(result.index());
-outputs.push_back(getOutputValueForExpandedOp(
-rewriter, loc, indexingMap, result.value(), expansionInfo));
+RankedTensorType expandedOutputType =
+getExpandedType(result.value().getType().cast(),
+ 

[llvm-branch-commits] [llvm] c5be0e0 - [X86] Fix tile register spill issue.

2021-01-11 Thread via llvm-branch-commits

Author: Luo, Yuanke
Date: 2021-01-11T18:35:09+08:00
New Revision: c5be0e0cc0e2fca19a5d130b742ae16c66f99111

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

LOG: [X86] Fix tile register spill issue.

The tile register spill need 2 instructions.
%46:gr64_nosp = MOV64ri 64
TILESTORED %stack.2, 1, killed %46:gr64_nosp, 0, $noreg, %43:tile
The first instruction load the stride to a GPR, and the second
instruction store tile register to stack slot. The optimization of merge
spill instruction is done after register allocation. And spill tile
register need create a new virtual register to for stride, so we can't
hoist tile spill instruction in postOptimization() of register
allocation. We can't hoist TILESTORED alone and we can't hoist the 2
instuctions together because MOV64ri will clobber some GPR. This patch
is to disble the spill merge for any spill which need 2 instructions.

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

Added: 
llvm/test/CodeGen/X86/AMX/amx-spill-merge.ll

Modified: 
llvm/lib/CodeGen/InlineSpiller.cpp

Removed: 




diff  --git a/llvm/lib/CodeGen/InlineSpiller.cpp 
b/llvm/lib/CodeGen/InlineSpiller.cpp
index 02f7721c219a..81ab9e5ab738 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -269,6 +269,14 @@ static Register isFullCopyOf(const MachineInstr , 
Register Reg) {
   return Register();
 }
 
+static void getVDefInterval(const MachineInstr , LiveIntervals ) {
+  for (unsigned I = 0, E = MI.getNumOperands(); I != E; ++I) {
+const MachineOperand  = MI.getOperand(I);
+if (MO.isReg() && MO.isDef() && Register::isVirtualRegister(MO.getReg()))
+  LIS.getInterval(MO.getReg());
+  }
+}
+
 /// isSnippet - Identify if a live interval is a snippet that should be 
spilled.
 /// It is assumed that SnipLI is a virtual register with the same original as
 /// Edit->getReg().
@@ -410,14 +418,21 @@ bool InlineSpiller::hoistSpillInsideBB(LiveInterval 
,
 MII = DefMI;
 ++MII;
   }
+  MachineInstrSpan MIS(MII, MBB);
   // Insert spill without kill flag immediately after def.
   TII.storeRegToStackSlot(*MBB, MII, SrcReg, false, StackSlot,
   MRI.getRegClass(SrcReg), );
+  LIS.InsertMachineInstrRangeInMaps(MIS.begin(), MII);
+  for (const MachineInstr  : make_range(MIS.begin(), MII))
+getVDefInterval(MI, LIS);
   --MII; // Point to store instruction.
-  LIS.InsertMachineInstrInMaps(*MII);
   LLVM_DEBUG(dbgs() << "\thoisted: " << SrcVNI->def << '\t' << *MII);
 
-  HSpiller.addToMergeableSpills(*MII, StackSlot, Original);
+  // If there is only 1 store instruction is required for spill, add it
+  // to mergeable list. In X86 AMX, 2 intructions are required to store.
+  // We disable the merge for this case.
+  if (std::distance(MIS.begin(), MII) <= 1)
+HSpiller.addToMergeableSpills(*MII, StackSlot, Original);
   ++NumSpills;
   return true;
 }
@@ -918,7 +933,11 @@ foldMemoryOperand(ArrayRef> Ops,
 ++NumFolded;
   else if (Ops.front().second == 0) {
 ++NumSpills;
-HSpiller.addToMergeableSpills(*FoldMI, StackSlot, Original);
+// If there is only 1 store instruction is required for spill, add it
+// to mergeable list. In X86 AMX, 2 intructions are required to store.
+// We disable the merge for this case.
+if (std::distance(MIS.begin(), MIS.end()) <= 1)
+  HSpiller.addToMergeableSpills(*FoldMI, StackSlot, Original);
   } else
 ++NumReloads;
   return true;
@@ -965,6 +984,7 @@ void InlineSpiller::insertSpill(Register NewVReg, bool 
isKill,
   MachineInstrSpan MIS(MI, );
   MachineBasicBlock::iterator SpillBefore = std::next(MI);
   bool IsRealSpill = isRealSpill(*MI);
+
   if (IsRealSpill)
 TII.storeRegToStackSlot(MBB, SpillBefore, NewVReg, isKill, StackSlot,
 MRI.getRegClass(NewVReg), );
@@ -978,11 +998,16 @@ void InlineSpiller::insertSpill(Register NewVReg, bool 
isKill,
 
   MachineBasicBlock::iterator Spill = std::next(MI);
   LIS.InsertMachineInstrRangeInMaps(Spill, MIS.end());
+  for (const MachineInstr  : make_range(Spill, MIS.end()))
+getVDefInterval(MI, LIS);
 
   LLVM_DEBUG(
   dumpMachineInstrRangeWithSlotIndex(Spill, MIS.end(), LIS, "spill"));
   ++NumSpills;
-  if (IsRealSpill)
+  // If there is only 1 store instruction is required for spill, add it
+  // to mergeable list. In X86 AMX, 2 intructions are required to store.
+  // We disable the merge for this case.
+  if (IsRealSpill && std::distance(Spill, MIS.end()) <= 1)
 HSpiller.addToMergeableSpills(*Spill, StackSlot, Original);
 }
 
@@ -1529,9 +1554,12 @@ void HoistSpillHelper::hoistAllSpills() {
   MachineBasicBlock *BB = Insert.first;
   Register LiveReg = Insert.second;
   MachineBasicBlock::iterator MI = 

[llvm-branch-commits] [mlir] 0bd9a13 - [mlir][openacc] Use TableGen information for default enum

2021-01-12 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2021-01-12T09:42:42-05:00
New Revision: 0bd9a1369112f7d0a8a3b94a050fd5ed37037e9b

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

LOG: [mlir][openacc] Use TableGen information for default enum

Use TableGen and information in ACC.td for the Default enum in the OpenACC 
dialect.
This patch generalize what was done for OpenMP for directives.

Follow up patch after D93576

Reviewed By: kiranchandramohan

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

Added: 
mlir/test/mlir-tblgen/directive-common.td
mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp

Modified: 
llvm/include/llvm/Frontend/OpenACC/ACC.td
mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt
mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
mlir/tools/mlir-tblgen/CMakeLists.txt

Removed: 
mlir/test/mlir-tblgen/openmp-common.td
mlir/tools/mlir-tblgen/OpenMPCommonGen.cpp



diff  --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td 
b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index d53d3132c969..58bb73fb6402 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -80,8 +80,8 @@ def ACCC_Create : Clause<"create"> {
 }
 
 // 2.5.15
-def ACC_Default_none : ClauseVal<"none", 1, 0> { let isDefault = 1; }
-def ACC_Default_present : ClauseVal<"present", 0, 0> {}
+def ACC_Default_none : ClauseVal<"none", 1, 1> { let isDefault = 1; }
+def ACC_Default_present : ClauseVal<"present", 0, 1> {}
 
 def ACCC_Default : Clause<"default"> {
   let flangClassValue = "AccDefaultClause";

diff  --git a/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt 
b/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt
index 32b92096c71b..32b0c7f902ae 100644
--- a/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/OpenACC/CMakeLists.txt
@@ -1,3 +1,7 @@
+set(LLVM_TARGET_DEFINITIONS 
${LLVM_MAIN_INCLUDE_DIR}/llvm/Frontend/OpenACC/ACC.td)
+mlir_tablegen(AccCommon.td --gen-directive-decl)
+add_public_tablegen_target(acc_common_td)
+
 set(LLVM_TARGET_DEFINITIONS OpenACCOps.td)
 mlir_tablegen(OpenACCOpsDialect.h.inc -gen-dialect-decls -dialect=acc)
 mlir_tablegen(OpenACCOps.h.inc -gen-op-decls)
@@ -6,4 +10,4 @@ mlir_tablegen(OpenACCOpsEnums.h.inc -gen-enum-decls)
 mlir_tablegen(OpenACCOpsEnums.cpp.inc -gen-enum-defs)
 add_mlir_doc(OpenACCOps -gen-dialect-doc OpenACCDialect Dialects/)
 add_public_tablegen_target(MLIROpenACCOpsIncGen)
-
+add_dependencies(OpenACCDialectDocGen acc_common_td)

diff  --git a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td 
b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
index 6feec888ec8e..a48af00535a7 100644
--- a/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
+++ b/mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td
@@ -14,6 +14,7 @@
 #define OPENACC_OPS
 
 include "mlir/IR/OpBase.td"
+include "mlir/Dialect/OpenACC/AccCommon.td"
 
 def OpenACC_Dialect : Dialect {
   let name = "acc";
@@ -63,15 +64,6 @@ def OpenACC_ReductionOpAttr : StrEnumAttr<"ReductionOpAttr",
 // Type used in operation below.
 def IntOrIndex : AnyTypeOf<[AnyInteger, Index]>;
 
-// Parallel and data op default enumeration
-def OpenACC_DefaultNone : StrEnumAttrCase<"none">;
-def OpenACC_DefaultPresent : StrEnumAttrCase<"present">;
-def OpenACC_DefaultAttr : StrEnumAttr<"DefaultAttr",
-"default attribute values",
-[OpenACC_DefaultNone, OpenACC_DefaultPresent]> {
-  let cppNamespace = "::mlir::acc";
-}
-
 
//===--===//
 // 2.5.1 parallel Construct
 
//===--===//
@@ -118,7 +110,7 @@ def OpenACC_ParallelOp : OpenACC_Op<"parallel",
Variadic:$attachOperands,
Variadic:$gangPrivateOperands,
Variadic:$gangFirstPrivateOperands,
-   OptionalAttr:$defaultAttr);
+   OptionalAttr:$defaultAttr);
 
   let regions = (region AnyRegion:$region);
 
@@ -190,7 +182,7 @@ def OpenACC_DataOp : OpenACC_Op<"data",
Variadic:$presentOperands,
Variadic:$deviceptrOperands,
Variadic:$attachOperands,
-   OptionalAttr:$defaultAttr);
+   OptionalAttr:$defaultAttr);
 
   let regions = (region AnyRegion:$region);
 

diff  --git a/mlir/test/mlir-tblgen/openmp-common.td 
b/mlir/test/mlir-tblgen/directive-common.td
similarity index 83%
rename from mlir/test/mlir-tblgen/openmp-common.td
rename to mlir/test/mlir-tblgen/directive-common.td
index 579988beda94..96439b40e9e8 100644
--- a/mlir/test/mlir-tblgen/openmp-common.td
+++ b/mlir/test/mlir-tblgen/directive-common.td
@@ -2,6 +2,11 @@
 
 include 

[llvm-branch-commits] [clang] c7dcc4c - [clang-format] PR48569 clang-format fails to align case label with `switch` with Whitesmith Indentation

2020-12-26 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-26T15:19:03Z
New Revision: c7dcc4c72588db9ffb7ae379983450193b943f5b

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

LOG: [clang-format] PR48569 clang-format fails to align case label with 
`switch` with Whitesmith Indentation

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

This is a tentative fix which addresses a PR raise regarding Case indentation 
when working with Whitesmiths Indentation

I could not find online any reference sources as to what the case indentation 
for Whitesmith's should be (or be allowed to be)

But according to the documentation, we don't obey the rules for Whitesmith's

```
In particular, the documentation states that this option is to "indent case 
labels one level from the switch statement. When false, use the same 
indentation level as for the switch statement."
```

The behaviour we add here is actually as the TODO in the tests used to state in 
{D67627}, but when {D82016} was added and I brought these tests out from being 
TODO I realized I changed the indentation.

Reviewed By: curdeius, HazardyKnusperkeks

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

Added: 


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

Removed: 




diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index 4c2ee421d092..99b8c28dca2b 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2244,18 +2244,26 @@ void UnwrappedLineParser::parseLabel(bool 
LeftAlignLabel) {
 --Line->Level;
   if (LeftAlignLabel)
 Line->Level = 0;
+
+  bool RemoveWhitesmithsCaseIndent =
+  (!Style.IndentCaseBlocks &&
+   Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths);
+
+  if (RemoveWhitesmithsCaseIndent)
+--Line->Level;
+
   if (!Style.IndentCaseBlocks && CommentsBeforeNextToken.empty() &&
   FormatTok->Tok.is(tok::l_brace)) {
-CompoundStatementIndenter Indenter(this, Line->Level,
-   Style.BraceWrapping.AfterCaseLabel,
-   Style.BraceWrapping.IndentBraces);
+
+CompoundStatementIndenter Indenter(
+this, Line->Level, Style.BraceWrapping.AfterCaseLabel,
+Style.BraceWrapping.IndentBraces || RemoveWhitesmithsCaseIndent);
 parseBlock(/*MustBeDeclaration=*/false);
 if (FormatTok->Tok.is(tok::kw_break)) {
   if (Style.BraceWrapping.AfterControlStatement ==
   FormatStyle::BWACS_Always) {
 addUnwrappedLine();
-if (!Style.IndentCaseBlocks &&
-Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths) {
+if (RemoveWhitesmithsCaseIndent) {
   Line->Level++;
 }
   }
@@ -2276,6 +2284,7 @@ void UnwrappedLineParser::parseLabel(bool LeftAlignLabel) 
{
 
 void UnwrappedLineParser::parseCaseLabel() {
   assert(FormatTok->Tok.is(tok::kw_case) && "'case' expected");
+
   // FIXME: fix handling of complex expressions here.
   do {
 nextToken();

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index b6d9e67273ac..bdf4abb26c7e 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -13658,7 +13658,7 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) {
"  {\n"
"  switch (a)\n"
"{\n"
-   "case 2:\n"
+   "  case 2:\n"
"{\n"
"}\n"
"break;\n"
@@ -13670,18 +13670,18 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) {
"  {\n"
"  switch (a)\n"
"{\n"
-   "case 0:\n"
+   "  case 0:\n"
"break;\n"
-   "case 1:\n"
+   "  case 1:\n"
"{\n"
"foo();\n"
"break;\n"
"}\n"
-   "case 2:\n"
+   "  case 2:\n"
"{\n"
"}\n"
"break;\n"
-   "default:\n"
+   "  default:\n"
"break;\n"
"}\n"
"  }\n",
@@ -13691,12 +13691,12 @@ TEST_F(FormatTest, WhitesmithsBraceBreaking) {
"  {\n"
"  switch (a)\n"
"{\n"
-   "case 0:\n"
+   "  case 0:\n"
"{\n"
"foo(x);\n"
"}\n"
"break;\n"
-   "default:\n"
+   "  default:\n"
"{\n"
"foo(1);\n"
"

[llvm-branch-commits] [clang] 1ca5e68 - [NVPTX] Fix debugging information being added to NVPTX target if remarks are enabled

2021-01-06 Thread via llvm-branch-commits

Author: Joseph Huber
Date: 2021-01-06T13:43:22-05:00
New Revision: 1ca5e68aa07e30567c6aa2409c5641e0a2d77355

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

LOG: [NVPTX] Fix debugging information being added to NVPTX target if remarks 
are enabled
Summary:
Optimized debugging is not supported by ptxas. Debugging information is 
degraded to line information only if optimizations are enabled, but debugging 
information would be added back in by the driver if remarks were enabled. This 
solves https://bugs.llvm.org/show_bug.cgi?id=48153.

Reviewers: jdoerfert tra jholewinski serge-sans-paille

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/Cuda.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 917601836c0a..a462758bf1c2 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3940,14 +3940,14 @@ static void RenderDebugOptions(const ToolChain , 
const Driver ,
 CmdArgs.push_back("-gno-inline-line-tables");
   }
 
-  // Adjust the debug info kind for the given toolchain.
-  TC.adjustDebugInfoKind(DebugInfoKind, Args);
-
   // When emitting remarks, we need at least debug lines in the output.
   if (willEmitRemarks(Args) &&
   DebugInfoKind <= codegenoptions::DebugDirectivesOnly)
 DebugInfoKind = codegenoptions::DebugLineTablesOnly;
 
+  // Adjust the debug info kind for the given toolchain.
+  TC.adjustDebugInfoKind(DebugInfoKind, Args);
+
   RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, EffectiveDWARFVersion,
   DebuggerTuning);
 

diff  --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
index 58178d5d11bc..95fd5a1fbfee 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -384,7 +384,7 @@ static DeviceDebugInfoLevel mustEmitDebugInfo(const ArgList 
) {
 }
 return IsDebugEnabled ? EmitSameDebugInfoAsHost : DebugDirectivesOnly;
   }
-  return DisableDebugInfo;
+  return willEmitRemarks(Args) ? DebugDirectivesOnly : DisableDebugInfo;
 }
 
 void NVPTX::Assembler::ConstructJob(Compilation , const JobAction ,



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


[llvm-branch-commits] [flang] 322e98b - [flang][openacc] Add more parsing/sema tests for init and shutdown directives

2021-01-06 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2021-01-06T14:15:19-05:00
New Revision: 322e98bc279989a6fb7f181b6f6a2d9a6927dd67

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

LOG: [flang][openacc] Add more parsing/sema tests for init and shutdown 
directives

This patch adds some positive and failure tests for init and shutdown 
directives.

Reviewed By: kiranktp

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

Added: 


Modified: 
flang/test/Semantics/acc-clause-validity.f90

Removed: 




diff  --git a/flang/test/Semantics/acc-clause-validity.f90 
b/flang/test/Semantics/acc-clause-validity.f90
index d410c5b4bf85..167051d18760 100644
--- a/flang/test/Semantics/acc-clause-validity.f90
+++ b/flang/test/Semantics/acc-clause-validity.f90
@@ -16,6 +16,8 @@
 !   2.11 Kernels Loop
 !   2.11 Serial Loop
 !   2.14.3 Set
+!   2.14.1 Init
+!   2.14.2 Shutdown
 !   2.16.13 Wait
 
 program openacc_clause_validity
@@ -267,6 +269,32 @@ program openacc_clause_validity
   !$acc set device_type(i)
   !$acc set device_type(2, i, j)
   !$acc set device_num(1) default_async(2) device_type(2, i, j)
+  !ERROR: At most one IF clause can appear on the INIT directive
+  !$acc init if(.TRUE.) if(ifCondition)
+
+  !ERROR: At most one DEVICE_NUM clause can appear on the INIT directive
+  !$acc init device_num(1) device_num(i)
+
+  !ERROR: At most one DEVICE_TYPE clause can appear on the INIT directive
+  !$acc init device_type(2) device_type(i, j)
+
+  !$acc shutdown
+  !$acc shutdown if(.TRUE.)
+  !$acc shutdown if(ifCondition)
+  !$acc shutdown device_num(1)
+  !$acc shutdown device_num(i)
+  !$acc shutdown device_type(i)
+  !$acc shutdown device_type(2, i, j)
+  !$acc shutdown device_num(i) device_type(i, j) if(ifCondition)
+
+  !ERROR: At most one IF clause can appear on the SHUTDOWN directive
+  !$acc shutdown if(.TRUE.) if(ifCondition)
+
+  !ERROR: At most one DEVICE_NUM clause can appear on the SHUTDOWN directive
+  !$acc shutdown device_num(1) device_num(i)
+
+  !ERROR: At most one DEVICE_TYPE clause can appear on the SHUTDOWN directive
+  !$acc shutdown device_type(2) device_type(i, j)
 
   !ERROR: At least one of ATTACH, COPYIN, CREATE clause must appear on the 
ENTER DATA directive
   !$acc enter data



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


[llvm-branch-commits] [openmp] 2ce1681 - [OpenMP] Always print error messages in libomptarget CUDA plugin

2021-01-07 Thread via llvm-branch-commits

Author: Joseph Huber
Date: 2021-01-07T17:47:32-05:00
New Revision: 2ce16810f28379b0a56f7036895a04e18d6b4506

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

LOG: [OpenMP] Always print error messages in libomptarget CUDA plugin

Summary:
Currently error messages from the CUDA plugins are only printed to the user if 
they have debugging enabled. Change this behaviour to always print the messages 
that result in offloading failure. This improves the error messages by 
indidcating what happened when the error occurs in the plugin library, such as 
a segmentation fault on the device.

Reviewed by: jdoerfert

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

Added: 


Modified: 
openmp/libomptarget/plugins/cuda/src/rtl.cpp

Removed: 




diff  --git a/openmp/libomptarget/plugins/cuda/src/rtl.cpp 
b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
index 4fac6a76710e..a22195bae966 100644
--- a/openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -33,18 +33,29 @@
   const char *errStr = nullptr;
\
   CUresult errStr_status = cuGetErrorString(err, ); 
\
   if (errStr_status == CUDA_ERROR_INVALID_VALUE)   
\
-DP("Unrecognized CUDA error code: %d\n", err); 
\
+REPORT("Unrecognized CUDA error code: %d\n", err); 
\
   else if (errStr_status == CUDA_SUCCESS)  
\
-DP("CUDA error is: %s\n", errStr); 
\
+REPORT("CUDA error is: %s\n", errStr); 
\
   else {   
\
-DP("Unresolved CUDA error code: %d\n", err);   
\
-DP("Unsuccessful cuGetErrorString return status: %d\n",
\
-   errStr_status); 
\
+REPORT("Unresolved CUDA error code: %d\n", err);   
\
+REPORT("Unsuccessful cuGetErrorString return status: %d\n",
\
+   errStr_status); 
\
   }
\
+} else {   
\
+  const char *errStr = nullptr;
\
+  CUresult errStr_status = cuGetErrorString(err, ); 
\
+  if (errStr_status == CUDA_SUCCESS)   
\
+REPORT("%s \n", errStr);   
\
 }  
\
   } while (false)
 #else // OMPTARGET_DEBUG
-#define CUDA_ERR_STRING(err) {}
+#define CUDA_ERR_STRING(err)   
\
+  do { 
\
+const char *errStr = nullptr;  
\
+CUresult errStr_status = cuGetErrorString(err, );   
\
+if (errStr_status == CUDA_SUCCESS) 
\
+  REPORT("%s \n", errStr); 
\
+  } while (false)
 #endif // OMPTARGET_DEBUG
 
 #include "../../common/elf_common.c"
@@ -90,7 +101,7 @@ bool checkResult(CUresult Err, const char *ErrMsg) {
   if (Err == CUDA_SUCCESS)
 return true;
 
-  DP("%s", ErrMsg);
+  REPORT("%s", ErrMsg);
   CUDA_ERR_STRING(Err);
   return false;
 }
@@ -101,9 +112,9 @@ int memcpyDtoD(const void *SrcPtr, void *DstPtr, int64_t 
Size,
   cuMemcpyDtoDAsync((CUdeviceptr)DstPtr, (CUdeviceptr)SrcPtr, Size, 
Stream);
 
   if (Err != CUDA_SUCCESS) {
-DP("Error when copying data from device to device. Pointers: src "
-   "= " DPxMOD ", dst = " DPxMOD ", size = %" PRId64 "\n",
-   DPxPTR(SrcPtr), DPxPTR(DstPtr), Size);
+REPORT("Error when copying data from device to device. Pointers: src "
+   "= " DPxMOD ", dst = " DPxMOD ", size = %" PRId64 "\n",
+   DPxPTR(SrcPtr), DPxPTR(DstPtr), Size);
 CUDA_ERR_STRING(Err);
 return OFFLOAD_FAIL;
   }
@@ -501,12 +512,11 @@ class DeviceRTLTy {
   DeviceData[DeviceId].BlocksPerGrid = EnvTeamLimit;
 }
 
-if (getDebugLevel() || (getInfoLevel() & OMP_INFOTYPE_PLUGIN_KERNEL))
-  INFO(DeviceId,
-   "Device supports up to %d CUDA blocks and %d threads with a "
-   "warp size of %d\n",
-   DeviceData[DeviceId].BlocksPerGrid,
-   DeviceData[DeviceId].ThreadsPerBlock, 

[llvm-branch-commits] [flang] b73736a - [flang][openacc] Enforce delcare directive restriction

2021-01-07 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2021-01-07T09:28:55-05:00
New Revision: b73736a4048172c48b6b5c23d1321f230d442306

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

LOG: [flang][openacc] Enforce delcare directive restriction

Add semantic check for most of the restrictions for the declare directive.

Reviewed By: kiranktp

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

Added: 
flang/test/Semantics/acc-declare-validity.f90

Modified: 
flang/lib/Semantics/check-acc-structure.cpp
flang/lib/Semantics/resolve-directives.cpp
flang/test/Semantics/acc-clause-validity.f90

Removed: 




diff  --git a/flang/lib/Semantics/check-acc-structure.cpp 
b/flang/lib/Semantics/check-acc-structure.cpp
index 45499a69e604..2f3138d11f80 100644
--- a/flang/lib/Semantics/check-acc-structure.cpp
+++ b/flang/lib/Semantics/check-acc-structure.cpp
@@ -134,9 +134,30 @@ void AccStructureChecker::Enter(
 }
 
 void AccStructureChecker::Leave(
-const parser::OpenACCStandaloneDeclarativeConstruct &) {
+const parser::OpenACCStandaloneDeclarativeConstruct ) {
   // Restriction - line 2409
   CheckAtLeastOneClause();
+
+  // Restriction - line 2417-2418 - In a Fortran module declaration section,
+  // only create, copyin, device_resident, and link clauses are allowed.
+  const auto {std::get(x.t)};
+  const auto {context_.FindScope(declarativeDir.source)};
+  const Scope {GetProgramUnitContaining(scope)};
+  if (containingScope.kind() == Scope::Kind::Module) {
+for (auto cl : GetContext().actualClauses) {
+  if (cl != llvm::acc::Clause::ACCC_create &&
+  cl != llvm::acc::Clause::ACCC_copyin &&
+  cl != llvm::acc::Clause::ACCC_device_resident &&
+  cl != llvm::acc::Clause::ACCC_link)
+context_.Say(GetContext().directiveSource,
+"%s clause is not allowed on the %s directive in module "
+"declaration "
+"section"_err_en_US,
+parser::ToUpperCaseLetters(
+llvm::acc::getOpenACCClauseName(cl).str()),
+ContextDirectiveAsFortran());
+}
+  }
   dirContext_.pop_back();
 }
 

diff  --git a/flang/lib/Semantics/resolve-directives.cpp 
b/flang/lib/Semantics/resolve-directives.cpp
index e10d797d0308..81e0ee61df4a 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -124,6 +124,7 @@ class AccAttributeVisitor : 
DirectiveAttributeVisitor {
 
   bool Pre(const parser::OpenACCRoutineConstruct &);
   bool Pre(const parser::AccBindClause &);
+  void Post(const parser::OpenACCStandaloneDeclarativeConstruct &);
 
   void Post(const parser::AccBeginBlockDirective &) {
 GetContext().withinConstruct = true;
@@ -215,6 +216,7 @@ class AccAttributeVisitor : 
DirectiveAttributeVisitor {
   void CheckMultipleAppearances(
   const parser::Name &, const Symbol &, Symbol::Flag);
   void AllowOnlyArrayAndSubArray(const parser::AccObjectList );
+  void DoNotAllowAssumedSizedArray(const parser::AccObjectList );
 };
 
 // Data-sharing and Data-mapping attributes for data-refs in OpenMP construct
@@ -470,6 +472,60 @@ bool AccAttributeVisitor::Pre(const 
parser::OpenACCDeclarativeConstruct ) {
   return true;
 }
 
+static const parser::AccObjectList (
+const parser::AccClause ) {
+  if (const auto *copyClause =
+  std::get_if()) {
+return copyClause->v;
+  } else if (const auto *createClause =
+ std::get_if()) {
+const Fortran::parser::AccObjectListWithModifier  =
+createClause->v;
+const Fortran::parser::AccObjectList  =
+std::get(listWithModifier.t);
+return accObjectList;
+  } else if (const auto *copyinClause =
+ std::get_if()) {
+const Fortran::parser::AccObjectListWithModifier  =
+copyinClause->v;
+const Fortran::parser::AccObjectList  =
+std::get(listWithModifier.t);
+return accObjectList;
+  } else if (const auto *copyoutClause =
+ std::get_if()) {
+const Fortran::parser::AccObjectListWithModifier  =
+copyoutClause->v;
+const Fortran::parser::AccObjectList  =
+std::get(listWithModifier.t);
+return accObjectList;
+  } else if (const auto *presentClause =
+ std::get_if()) {
+return presentClause->v;
+  } else if (const auto *deviceptrClause =
+ std::get_if(
+ )) {
+return deviceptrClause->v;
+  } else if (const auto *deviceResidentClause =
+ std::get_if(
+ )) {
+return deviceResidentClause->v;
+  } else if (const auto *linkClause =
+ std::get_if()) {
+return linkClause->v;
+  } else {
+llvm_unreachable("Clause without object list!");
+  }
+}
+
+void AccAttributeVisitor::Post(
+

[llvm-branch-commits] [clang] 48baa7f - [clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64

2021-01-07 Thread via llvm-branch-commits

Author: clementval
Date: 2021-01-07T20:08:20-05:00
New Revision: 48baa7f5b11cbe6b00711864a19cd8b722f5940d

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

LOG: [clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64

While trying to compile clang and openmp with a freshly built clang with the 
gcc/7.4.0
toolchain on the Summit supercomputer I face some error because of the triple 
under which
the GCC toolchain is installed was not present in for PPC64LE triples.
This patch add the powerpc64le-none-linux-gnu used on system like Summit and 
Ascent.

Reviewed By: jdenny

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Gnu.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 336ee13b2df5..164cf6e7 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2161,7 +2161,8 @@ void 
Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
   static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"};
   static const char *const PPC64LETriples[] = {
   "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu",
-  "powerpc64le-suse-linux", "ppc64le-redhat-linux"};
+  "powerpc64le-none-linux-gnu", "powerpc64le-suse-linux",
+  "ppc64le-redhat-linux"};
 
   static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"};
   static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",



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


[llvm-branch-commits] [llvm] 8dcf8d1 - [msan] Fix bugs when instrument x86.avx512*_cvt* intrinsics.

2020-11-27 Thread via llvm-branch-commits

Author: Wang, Pengfei
Date: 2020-11-27T16:33:14+08:00
New Revision: 8dcf8d1da5630d1beecafe6cb1247df3f6a47022

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

LOG: [msan] Fix bugs when instrument x86.avx512*_cvt* intrinsics.

Scalar intrinsics x86.avx512*_cvt* have an extra rounding mode operand.
We can directly ignore it to reuse the SSE/AVX math.
This fix the bug https://bugs.llvm.org/show_bug.cgi?id=48298.

Reviewed By: craig.topper

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

Added: 


Modified: 
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/test/Instrumentation/MemorySanitizer/vector_cvt.ll

Removed: 




diff  --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index d4f481f7c327..1d4f279aeff4 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2734,14 +2734,16 @@ struct MemorySanitizerVisitor : public 
InstVisitor {
   // We copy the shadow of \p CopyOp[NumUsedElements:] to \p
   // Out[NumUsedElements:]. This means that intrinsics without \p CopyOp always
   // return a fully initialized value.
-  void handleVectorConvertIntrinsic(IntrinsicInst , int NumUsedElements) {
+  void handleVectorConvertIntrinsic(IntrinsicInst , int NumUsedElements,
+bool HasRoundingMode = false) {
 IRBuilder<> IRB();
 Value *CopyOp, *ConvertOp;
 
-switch (I.getNumArgOperands()) {
-case 3:
-  assert(isa(I.getArgOperand(2)) && "Invalid rounding mode");
-  LLVM_FALLTHROUGH;
+assert((!HasRoundingMode ||
+isa(I.getArgOperand(I.getNumArgOperands() - 1))) &&
+   "Invalid rounding mode");
+
+switch (I.getNumArgOperands() - HasRoundingMode) {
 case 2:
   CopyOp = I.getArgOperand(0);
   ConvertOp = I.getArgOperand(1);
@@ -3294,6 +3296,8 @@ struct MemorySanitizerVisitor : public 
InstVisitor {
 case Intrinsic::x86_avx512_cvtusi2ss:
 case Intrinsic::x86_avx512_cvtusi642sd:
 case Intrinsic::x86_avx512_cvtusi642ss:
+  handleVectorConvertIntrinsic(I, 1, true);
+  break;
 case Intrinsic::x86_sse2_cvtsd2si64:
 case Intrinsic::x86_sse2_cvtsd2si:
 case Intrinsic::x86_sse2_cvtsd2ss:

diff  --git a/llvm/test/Instrumentation/MemorySanitizer/vector_cvt.ll 
b/llvm/test/Instrumentation/MemorySanitizer/vector_cvt.ll
index bb60145709b5..096b1011e55f 100644
--- a/llvm/test/Instrumentation/MemorySanitizer/vector_cvt.ll
+++ b/llvm/test/Instrumentation/MemorySanitizer/vector_cvt.ll
@@ -9,6 +9,7 @@ target triple = "x86_64-unknown-linux-gnu"
 declare i32 @llvm.x86.sse2.cvtsd2si(<2 x double>) nounwind readnone
 declare <2 x double> @llvm.x86.sse2.cvtsi2sd(<2 x double>, i32) nounwind 
readnone
 declare x86_mmx @llvm.x86.sse.cvtps2pi(<4 x float>) nounwind readnone
+declare i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float>, i32) nounwind readnone
 
 ; Single argument vector conversion.
 
@@ -45,3 +46,20 @@ entry:
 ; CHECK: call x86_mmx @llvm.x86.sse.cvtps2pi
 ; CHECK: store i64 0, {{.*}} @__msan_retval_tls
 ; CHECK: ret x86_mmx
+
+; avx512 rounding conversion.
+
+define i32 @pr48298(<4 x float> %value) sanitize_memory {
+entry:
+  %0 = tail call i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float> %value, i32 11)
+  ret i32 %0
+}
+
+; CHECK-LABEL: @pr48298
+; CHECK: extractelement <4 x i32> {{.*}}, i32 0
+; CHECK: icmp ne i32 {{.*}}, 0
+; CHECK: br
+; CHECK: call void @__msan_warning_with_origin_noreturn
+; CHECK: call i32 @llvm.x86.avx512.vcvtss2usi32
+; CHECK: store i32 0, {{.*}} @__msan_retval_tls
+; CHECK: ret i32



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


[llvm-branch-commits] [mlir] 8b6bea9 - Use bool in place of int for boolean things in the C API

2020-11-29 Thread via llvm-branch-commits

Author: George
Date: 2020-11-29T16:40:57-08:00
New Revision: 8b6bea9bff80a80d3cdbceb6d2218e6bac819696

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

LOG: Use bool in place of int for boolean things in the C API

`bool` is pretty well supported by now in C, and using it in place of `int` is 
not only more semantically accurate, but also improves automatic bindings for 
languages like Swift.

There is more discussion here: 
https://llvm.discourse.group/t/adding-mlirbool-to-c-bindings/2280/5

Reviewed By: ftynse, mehdi_amini

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

Added: 


Modified: 
mlir/include/mlir-c/IR.h
mlir/lib/CAPI/IR/IR.cpp

Removed: 




diff  --git a/mlir/include/mlir-c/IR.h b/mlir/include/mlir-c/IR.h
index 2ca5b80b825a..902b2b988622 100644
--- a/mlir/include/mlir-c/IR.h
+++ b/mlir/include/mlir-c/IR.h
@@ -18,6 +18,7 @@
 #ifndef MLIR_C_IR_H
 #define MLIR_C_IR_H
 
+#include 
 #include 
 
 #include "mlir-c/Support.h"
@@ -82,10 +83,10 @@ typedef struct MlirNamedAttribute MlirNamedAttribute;
 MLIR_CAPI_EXPORTED MlirContext mlirContextCreate();
 
 /// Checks if two contexts are equal.
-MLIR_CAPI_EXPORTED int mlirContextEqual(MlirContext ctx1, MlirContext ctx2);
+MLIR_CAPI_EXPORTED bool mlirContextEqual(MlirContext ctx1, MlirContext ctx2);
 
 /// Checks whether a context is null.
-static inline int mlirContextIsNull(MlirContext context) {
+static inline bool mlirContextIsNull(MlirContext context) {
   return !context.ptr;
 }
 
@@ -126,14 +127,14 @@ MLIR_CAPI_EXPORTED MlirDialect 
mlirContextGetOrLoadDialect(MlirContext context,
 MLIR_CAPI_EXPORTED MlirContext mlirDialectGetContext(MlirDialect dialect);
 
 /// Checks if the dialect is null.
-static inline int mlirDialectIsNull(MlirDialect dialect) {
+static inline bool mlirDialectIsNull(MlirDialect dialect) {
   return !dialect.ptr;
 }
 
 /** Checks if two dialects that belong to the same context are equal. Dialects
  * from 
diff erent contexts will not compare equal. */
-MLIR_CAPI_EXPORTED int mlirDialectEqual(MlirDialect dialect1,
-MlirDialect dialect2);
+MLIR_CAPI_EXPORTED bool mlirDialectEqual(MlirDialect dialect1,
+ MlirDialect dialect2);
 
 /// Returns the namespace of the given dialect.
 MLIR_CAPI_EXPORTED MlirStringRef mlirDialectGetNamespace(MlirDialect dialect);
@@ -177,7 +178,7 @@ MLIR_CAPI_EXPORTED MlirContext 
mlirModuleGetContext(MlirModule module);
 MLIR_CAPI_EXPORTED MlirBlock mlirModuleGetBody(MlirModule module);
 
 /// Checks whether a module is null.
-static inline int mlirModuleIsNull(MlirModule module) { return !module.ptr; }
+static inline bool mlirModuleIsNull(MlirModule module) { return !module.ptr; }
 
 /// Takes a module owned by the caller and deletes it.
 MLIR_CAPI_EXPORTED void mlirModuleDestroy(MlirModule module);
@@ -287,12 +288,12 @@ mlirOperationCreate(const MlirOperationState *state);
 MLIR_CAPI_EXPORTED void mlirOperationDestroy(MlirOperation op);
 
 /// Checks whether the underlying operation is null.
-static inline int mlirOperationIsNull(MlirOperation op) { return !op.ptr; }
+static inline bool mlirOperationIsNull(MlirOperation op) { return !op.ptr; }
 
 /** Checks whether two operation handles point to the same operation. This does
  * not perform deep comparison. */
-MLIR_CAPI_EXPORTED int mlirOperationEqual(MlirOperation op,
-  MlirOperation other);
+MLIR_CAPI_EXPORTED bool mlirOperationEqual(MlirOperation op,
+   MlirOperation other);
 
 /// Gets the name of the operation as an identifier.
 MLIR_CAPI_EXPORTED MlirIdentifier mlirOperationGetName(MlirOperation op);
@@ -388,7 +389,7 @@ MLIR_CAPI_EXPORTED MlirRegion mlirRegionCreate();
 MLIR_CAPI_EXPORTED void mlirRegionDestroy(MlirRegion region);
 
 /// Checks whether a region is null.
-static inline int mlirRegionIsNull(MlirRegion region) { return !region.ptr; }
+static inline bool mlirRegionIsNull(MlirRegion region) { return !region.ptr; }
 
 /// Gets the first block in the region.
 MLIR_CAPI_EXPORTED MlirBlock mlirRegionGetFirstBlock(MlirRegion region);
@@ -430,11 +431,11 @@ MLIR_CAPI_EXPORTED MlirBlock mlirBlockCreate(intptr_t 
nArgs,
 MLIR_CAPI_EXPORTED void mlirBlockDestroy(MlirBlock block);
 
 /// Checks whether a block is null.
-static inline int mlirBlockIsNull(MlirBlock block) { return !block.ptr; }
+static inline bool mlirBlockIsNull(MlirBlock block) { return !block.ptr; }
 
 /** Checks whether two blocks handles point to the same block. This does not
  * perform deep comparison. */
-MLIR_CAPI_EXPORTED int mlirBlockEqual(MlirBlock block, MlirBlock other);
+MLIR_CAPI_EXPORTED bool mlirBlockEqual(MlirBlock block, MlirBlock other);
 
 /** Returns 

[llvm-branch-commits] [llvm] 8517796 - [AIX][XCOFF][NFC] Change geNumberOfVRSaved function name to getNumberOfVRSaved.

2020-11-27 Thread via llvm-branch-commits

Author: diggerlin
Date: 2020-11-27T13:37:43-05:00
New Revision: 851779652a3b5da7dff0a1ddecd6a64a7ef1eea7

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

LOG: [AIX][XCOFF][NFC] Change geNumberOfVRSaved function name to 
getNumberOfVRSaved.

SUMMARY:

  Change geNumberOfVRSaved function name to getNumberOfVRSaved of class 
TBVectorExt

Reviewers: hubert.reinterpretcast, Jason Liu
Differential Revision: https://reviews.llvm.org/D92225

Added: 


Modified: 
llvm/include/llvm/Object/XCOFFObjectFile.h
llvm/lib/Object/XCOFFObjectFile.cpp
llvm/unittests/Object/XCOFFObjectFileTest.cpp

Removed: 




diff  --git a/llvm/include/llvm/Object/XCOFFObjectFile.h 
b/llvm/include/llvm/Object/XCOFFObjectFile.h
index ba1df5e8dc0a..1ac00ed5e2c7 100644
--- a/llvm/include/llvm/Object/XCOFFObjectFile.h
+++ b/llvm/include/llvm/Object/XCOFFObjectFile.h
@@ -404,7 +404,7 @@ class TBVectorExt {
   TBVectorExt(StringRef TBvectorStrRef);
 
 public:
-  uint8_t geNumberOfVRSaved() const;
+  uint8_t getNumberOfVRSaved() const;
   bool isVRSavedOnStack() const;
   bool hasVarArgs() const;
   uint8_t getNumberOfVectorParms() const;

diff  --git a/llvm/lib/Object/XCOFFObjectFile.cpp 
b/llvm/lib/Object/XCOFFObjectFile.cpp
index 1a8afe4c95a4..e908096969aa 100644
--- a/llvm/lib/Object/XCOFFObjectFile.cpp
+++ b/llvm/lib/Object/XCOFFObjectFile.cpp
@@ -854,7 +854,7 @@ TBVectorExt::TBVectorExt(StringRef TBvectorStrRef) {
 #define GETVALUEWITHMASK(X) (Data & (TracebackTable::X))
 #define GETVALUEWITHMASKSHIFT(X, S)
\
   ((Data & (TracebackTable::X)) >> (TracebackTable::S))
-uint8_t TBVectorExt::geNumberOfVRSaved() const {
+uint8_t TBVectorExt::getNumberOfVRSaved() const {
   return GETVALUEWITHMASKSHIFT(NumberOfVRSavedMask, NumberOfVRSavedShift);
 }
 

diff  --git a/llvm/unittests/Object/XCOFFObjectFileTest.cpp 
b/llvm/unittests/Object/XCOFFObjectFileTest.cpp
index 51ba0f7f66f7..cb1cfe44e077 100644
--- a/llvm/unittests/Object/XCOFFObjectFileTest.cpp
+++ b/llvm/unittests/Object/XCOFFObjectFileTest.cpp
@@ -198,7 +198,7 @@ TEST(XCOFFObjectFileTest, 
XCOFFTracebackTableAPIHasVectorInfo) {
   ASSERT_TRUE(TT.getVectorExt());
   TBVectorExt VecExt = TT.getVectorExt().getValue();
 
-  EXPECT_EQ(VecExt.geNumberOfVRSaved(), 0);
+  EXPECT_EQ(VecExt.getNumberOfVRSaved(), 0);
   EXPECT_TRUE(VecExt.isVRSavedOnStack());
   EXPECT_FALSE(VecExt.hasVarArgs());
 
@@ -232,7 +232,7 @@ TEST(XCOFFObjectFileTest, 
XCOFFTracebackTableAPIHasVectorInfo1) {
   ASSERT_TRUE(TT.getVectorExt());
   TBVectorExt VecExt = TT.getVectorExt().getValue();
 
-  EXPECT_EQ(VecExt.geNumberOfVRSaved(), 4);
+  EXPECT_EQ(VecExt.getNumberOfVRSaved(), 4);
   EXPECT_FALSE(VecExt.isVRSavedOnStack());
   EXPECT_TRUE(VecExt.hasVarArgs());
 



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


[llvm-branch-commits] [libcxx] b294376 - [libc++] Use std::move in numeric algorithms (P0616R0).

2020-11-27 Thread via llvm-branch-commits

Author: zoecarver
Date: 2020-11-27T11:09:44-08:00
New Revision: b2943765e72ee240aa7e9f3a6b8e8a336cadc7ae

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

LOG: [libc++] Use std::move in numeric algorithms (P0616R0).

This patch updates algorithms in  to use std::move
based on p0616r0. Moving values instead of copying them
creates huge speed improvements (see the paper for details).

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

Added: 


Modified: 
libcxx/docs/Cxx2aStatusPaperStatus.csv
libcxx/include/numeric
libcxx/test/std/numerics/numeric.ops/accumulate/accumulate_op.pass.cpp

libcxx/test/std/numerics/numeric.ops/adjacent.difference/adjacent_difference_op.pass.cpp

libcxx/test/std/numerics/numeric.ops/inner.product/inner_product_comp.pass.cpp
libcxx/test/std/numerics/numeric.ops/partial.sum/partial_sum_op.pass.cpp

Removed: 




diff  --git a/libcxx/docs/Cxx2aStatusPaperStatus.csv 
b/libcxx/docs/Cxx2aStatusPaperStatus.csv
index cf476c87a130..456ac647b7a3 100644
--- a/libcxx/docs/Cxx2aStatusPaperStatus.csv
+++ b/libcxx/docs/Cxx2aStatusPaperStatus.csv
@@ -10,7 +10,7 @@
 "`P0457R2 `__","LWG","String Prefix and Suffix 
Checking","Albuquerque","|Complete|","6.0"
 "`P0550R2 `__","LWG","Transformation Trait 
``remove_cvref``\ ","Albuquerque","|Complete|","6.0"
 "`P0600R1 `__","LWG","nodiscard in the 
Library","Albuquerque","|In Progress| [#note-P0600]_","7.0"
-"`P0616R0 `__","LWG","de-pessimize legacy  
algorithms with std::move","Albuquerque","",""
+"`P0616R0 `__","LWG","de-pessimize legacy  
algorithms with std::move","Albuquerque","|Complete|","12.0"
 "`P0653R2 `__","LWG","Utility to convert a pointer 
to a raw pointer","Albuquerque","|Complete|","6.0"
 "`P0718R2 `__","LWG","Atomic 
shared_ptr","Albuquerque","",""
 "`P0767R1 `__","CWG","Deprecate 
POD","Albuquerque","|Complete|","7.0"

diff  --git a/libcxx/include/numeric b/libcxx/include/numeric
index 50070ded8fed..088bd7438d2b 100644
--- a/libcxx/include/numeric
+++ b/libcxx/include/numeric
@@ -163,7 +163,11 @@ _Tp
 accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
 {
 for (; __first != __last; ++__first)
+#if _LIBCPP_STD_VER > 17
+__init = _VSTD::move(__init) + *__first;
+#else
 __init = __init + *__first;
+#endif
 return __init;
 }
 
@@ -173,7 +177,11 @@ _Tp
 accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, 
_BinaryOperation __binary_op)
 {
 for (; __first != __last; ++__first)
+#if _LIBCPP_STD_VER > 17
+__init = __binary_op(_VSTD::move(__init), *__first);
+#else
 __init = __binary_op(__init, *__first);
+#endif
 return __init;
 }
 
@@ -212,7 +220,11 @@ _Tp
 inner_product(_InputIterator1 __first1, _InputIterator1 __last1, 
_InputIterator2 __first2, _Tp __init)
 {
 for (; __first1 != __last1; ++__first1, (void) ++__first2)
+#if _LIBCPP_STD_VER > 17
+__init = _VSTD::move(__init) + *__first1 * *__first2;
+#else
 __init = __init + *__first1 * *__first2;
+#endif
 return __init;
 }
 
@@ -223,7 +235,11 @@ inner_product(_InputIterator1 __first1, _InputIterator1 
__last1, _InputIterator2
   _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 
__binary_op2)
 {
 for (; __first1 != __last1; ++__first1, (void) ++__first2)
+#if _LIBCPP_STD_VER > 17
+__init = __binary_op1(_VSTD::move(__init), __binary_op2(*__first1, 
*__first2));
+#else
 __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
+#endif
 return __init;
 }
 
@@ -273,7 +289,11 @@ partial_sum(_InputIterator __first, _InputIterator __last, 
_OutputIterator __res
 *__result = __t;
 for (++__first, (void) ++__result; __first != __last; ++__first, 
(void) ++__result)
 {
+#if _LIBCPP_STD_VER > 17
+__t = _VSTD::move(__t) + *__first;
+#else
 __t = __t + *__first;
+#endif
 *__result = __t;
 }
 }
@@ -292,7 +312,11 @@ partial_sum(_InputIterator __first, _InputIterator __last, 
_OutputIterator __res
 *__result = __t;
 for (++__first, (void) ++__result; __first != __last; ++__first, 
(void) ++__result)
 {
+#if _LIBCPP_STD_VER > 17
+__t = __binary_op(_VSTD::move(__t), *__first);
+#else
 __t = __binary_op(__t, *__first);
+#endif
 *__result = __t;
 }
 }
@@ -417,13 +441,17 @@ adjacent_
diff erence(_InputIterator __first, _InputIterator __last, _OutputIterat
 {
 if (__first != __last)
 {
-typename 

[llvm-branch-commits] [flang] e73d8c7 - [flang][openacc] Semantic check for cache directive

2020-11-25 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-11-25T10:28:14-05:00
New Revision: e73d8c793a5028b8ba93b9b9a82d059760c3ec4d

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

LOG: [flang][openacc] Semantic check for cache directive

Add semantic check for the cache directive. According to section 2.10 from the 
specification:
A var in a cache directive must be a single array element or a simple subarray.

Reviewed By: kiranchandramohan

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

Added: 


Modified: 
flang/lib/Semantics/check-acc-structure.cpp
flang/lib/Semantics/check-acc-structure.h
flang/lib/Semantics/resolve-directives.cpp
flang/test/Semantics/acc-clause-validity.f90

Removed: 




diff  --git a/flang/lib/Semantics/check-acc-structure.cpp 
b/flang/lib/Semantics/check-acc-structure.cpp
index 8c05b585dda5..edcb41eae0c5 100644
--- a/flang/lib/Semantics/check-acc-structure.cpp
+++ b/flang/lib/Semantics/check-acc-structure.cpp
@@ -238,6 +238,15 @@ void AccStructureChecker::Leave(const 
parser::OpenACCAtomicConstruct ) {
   dirContext_.pop_back();
 }
 
+void AccStructureChecker::Enter(const parser::OpenACCCacheConstruct ) {
+  const auto  = std::get(x.t);
+  PushContextAndClauseSets(verbatim.source, llvm::acc::Directive::ACCD_cache);
+  SetContextDirectiveSource(verbatim.source);
+}
+void AccStructureChecker::Leave(const parser::OpenACCCacheConstruct ) {
+  dirContext_.pop_back();
+}
+
 // Clause checkers
 CHECK_REQ_SCALAR_INT_CONSTANT_CLAUSE(Collapse, ACCC_collapse)
 

diff  --git a/flang/lib/Semantics/check-acc-structure.h 
b/flang/lib/Semantics/check-acc-structure.h
index 04c08b14598c..e2ea3899c98b 100644
--- a/flang/lib/Semantics/check-acc-structure.h
+++ b/flang/lib/Semantics/check-acc-structure.h
@@ -59,6 +59,8 @@ class AccStructureChecker
   void Leave(const parser::OpenACCWaitConstruct &);
   void Enter(const parser::OpenACCAtomicConstruct &);
   void Leave(const parser::OpenACCAtomicConstruct &);
+  void Enter(const parser::OpenACCCacheConstruct &);
+  void Leave(const parser::OpenACCCacheConstruct &);
 
   // Clauses
   void Leave(const parser::AccClauseList &);

diff  --git a/flang/lib/Semantics/resolve-directives.cpp 
b/flang/lib/Semantics/resolve-directives.cpp
index 65606d119dc4..f34cb69beca9 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -140,6 +140,9 @@ class AccAttributeVisitor : 
DirectiveAttributeVisitor {
 GetContext().withinConstruct = true;
   }
 
+  bool Pre(const parser::OpenACCCacheConstruct &);
+  void Post(const parser::OpenACCCacheConstruct &) { PopContext(); }
+
   void Post(const parser::AccDefaultClause &);
 
   bool Pre(const parser::AccClause::Copy ) {
@@ -209,6 +212,7 @@ class AccAttributeVisitor : 
DirectiveAttributeVisitor {
   Symbol *DeclareOrMarkOtherAccessEntity(Symbol &, Symbol::Flag);
   void CheckMultipleAppearances(
   const parser::Name &, const Symbol &, Symbol::Flag);
+  void AllowOnlyArrayAndSubArray(const parser::AccObjectList );
 };
 
 // Data-sharing and Data-mapping attributes for data-refs in OpenMP construct
@@ -450,7 +454,6 @@ bool AccAttributeVisitor::Pre(const 
parser::OpenACCLoopConstruct ) {
 bool AccAttributeVisitor::Pre(const parser::OpenACCStandaloneConstruct ) {
   const auto {std::get(x.t)};
   switch (standaloneDir.v) {
-  case llvm::acc::Directive::ACCD_cache:
   case llvm::acc::Directive::ACCD_enter_data:
   case llvm::acc::Directive::ACCD_exit_data:
   case llvm::acc::Directive::ACCD_init:
@@ -483,6 +486,64 @@ bool AccAttributeVisitor::Pre(const 
parser::OpenACCCombinedConstruct ) {
   return true;
 }
 
+static bool IsLastNameArray(const parser::Designator ) {
+  const auto {GetLastName(designator)};
+  const evaluate::DataRef dataRef{*(name.symbol)};
+  return std::visit(
+  common::visitors{
+  [](const evaluate::SymbolRef ) { return ref->Rank() > 0; },
+  [](const evaluate::ArrayRef ) {
+return aref.base().IsSymbol() ||
+aref.base().GetComponent().base().Rank() == 0;
+  },
+  [](const auto &) { return false; },
+  },
+  dataRef.u);
+}
+
+void AccAttributeVisitor::AllowOnlyArrayAndSubArray(
+const parser::AccObjectList ) {
+  for (const auto  : objectList.v) {
+std::visit(
+common::visitors{
+[&](const parser::Designator ) {
+  if (!IsLastNameArray(designator))
+context_.Say(designator.source,
+"Only array element or subarray are allowed in %s 
directive"_err_en_US,
+parser::ToUpperCaseLetters(
+llvm::acc::getOpenACCDirectiveName(
+GetContext().directive)
+.str()));
+},
+  

[llvm-branch-commits] [flang] 3ee08e3 - Add Semantic check for Flang OpenMP 4.5 - 2.15.3.2 and 2.15.3.3 shared and private clause

2020-11-21 Thread via llvm-branch-commits

Author: Yashaswini
Date: 2020-11-22T12:50:17+05:30
New Revision: 3ee08e38194ac05e42f8c5a633dc1aa8e41139f4

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

LOG: Add Semantic check for Flang OpenMP 4.5 - 2.15.3.2 and 2.15.3.3 shared and 
private clause

Semantic check to restrict the appearance of a variable that is part of another 
variable
 (as an array or structure element) in a PRIVATE or SHARED clause.

Test Cases:

omp-parallel-private01.f90
omp-parallel-private02.f90
omp-parallel-private03.f90
omp-parallel-private04.f90
omp-parallel-shared01.f90
omp-parallel-shared02.f90
omp-parallel-shared03.f90
omp-parallel-shared04.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan , Valentin Clement 
@clementval

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

Added: 
flang/test/Semantics/omp-parallel-private01.f90
flang/test/Semantics/omp-parallel-private02.f90
flang/test/Semantics/omp-parallel-private03.f90
flang/test/Semantics/omp-parallel-private04.f90
flang/test/Semantics/omp-parallel-shared01.f90
flang/test/Semantics/omp-parallel-shared02.f90
flang/test/Semantics/omp-parallel-shared03.f90
flang/test/Semantics/omp-parallel-shared04.f90

Modified: 
flang/lib/Semantics/check-omp-structure.cpp
flang/lib/Semantics/check-omp-structure.h

Removed: 




diff  --git a/flang/lib/Semantics/check-omp-structure.cpp 
b/flang/lib/Semantics/check-omp-structure.cpp
index d3430d724651..636471da78d1 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -372,8 +372,6 @@ CHECK_SIMPLE_CLAUSE(Link, OMPC_link)
 CHECK_SIMPLE_CLAUSE(Mergeable, OMPC_mergeable)
 CHECK_SIMPLE_CLAUSE(Nogroup, OMPC_nogroup)
 CHECK_SIMPLE_CLAUSE(Notinbranch, OMPC_notinbranch)
-CHECK_SIMPLE_CLAUSE(Private, OMPC_private)
-CHECK_SIMPLE_CLAUSE(Shared, OMPC_shared)
 CHECK_SIMPLE_CLAUSE(To, OMPC_to)
 CHECK_SIMPLE_CLAUSE(Uniform, OMPC_uniform)
 CHECK_SIMPLE_CLAUSE(Untied, OMPC_untied)
@@ -412,6 +410,37 @@ void OmpStructureChecker::Enter(const 
parser::OmpClause::Ordered ) {
   }
 }
 
+void OmpStructureChecker::Enter(const parser::OmpClause::Shared ) {
+  CheckAllowed(llvm::omp::Clause::OMPC_shared);
+  CheckIsVarPartOfAnotherVar(x.v);
+}
+void OmpStructureChecker::Enter(const parser::OmpClause::Private ) {
+  CheckAllowed(llvm::omp::Clause::OMPC_private);
+  CheckIsVarPartOfAnotherVar(x.v);
+}
+
+void OmpStructureChecker::CheckIsVarPartOfAnotherVar(
+const parser::OmpObjectList ) {
+
+  for (const auto  : objList.v) {
+std::visit(
+common::visitors{
+[&](const parser::Designator ) {
+  if (std::get_if()) {
+if ((parser::Unwrap(ompObject)) ||
+(parser::Unwrap(ompObject))) {
+  context_.Say(GetContext().clauseSource,
+  "A variable that is part of another variable (as an "
+  "array or structure element)"
+  " cannot appear in a PRIVATE or SHARED 
clause."_err_en_US);
+}
+  }
+},
+[&](const parser::Name ) {},
+},
+ompObject.u);
+  }
+}
 // Following clauses have a seperate node in parse-tree.h.
 CHECK_SIMPLE_PARSER_CLAUSE(OmpAllocateClause, OMPC_allocate)
 CHECK_SIMPLE_PARSER_CLAUSE(OmpDefaultClause, OMPC_default)

diff  --git a/flang/lib/Semantics/check-omp-structure.h 
b/flang/lib/Semantics/check-omp-structure.h
index 8384efecb840..5539ca2566f2 100644
--- a/flang/lib/Semantics/check-omp-structure.h
+++ b/flang/lib/Semantics/check-omp-structure.h
@@ -185,6 +185,8 @@ class OmpStructureChecker
   void CheckDependList(const parser::DataRef &);
   void CheckDependArraySection(
   const common::Indirection &, const parser::Name &);
+
+  void CheckIsVarPartOfAnotherVar(const parser::OmpObjectList );
 };
 } // namespace Fortran::semantics
 #endif // FORTRAN_SEMANTICS_CHECK_OMP_STRUCTURE_H_

diff  --git a/flang/test/Semantics/omp-parallel-private01.f90 
b/flang/test/Semantics/omp-parallel-private01.f90
new file mode 100644
index ..029c36ffeeb5
--- /dev/null
+++ b/flang/test/Semantics/omp-parallel-private01.f90
@@ -0,0 +1,20 @@
+!RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+! OpenMP Version 4.5
+! 2.15.3.3 parallel private Clause
+program omp_parallel_private
+  integer :: i, j, a(10), b(10), c(10)
+  integer :: k = 10
+  type my_type
+integer :: array(10)
+  end type my_type
+
+  type(my_type) :: my_var
+
+  !ERROR: A variable that is part of another variable (as an array or 
structure element) cannot appear in a PRIVATE or SHARED clause.
+  !$omp parallel private(my_var%array)
+  do i = 1, 10
+c(i) = a(i) + b(i) + k
+my_var%array(i) = k
+  end do
+  !$omp end parallel
+end program 

[llvm-branch-commits] [llvm] 1c0941e - [PowerPC] Extend folding RLWINM + RLWINM to post-RA.

2020-11-21 Thread via llvm-branch-commits

Author: Esme-Yi
Date: 2020-11-22T07:37:24Z
New Revision: 1c0941e1524f499e3fbde48fc3bdd0e70fc8f2e4

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

LOG: [PowerPC] Extend folding RLWINM + RLWINM to post-RA.

Summary: We have the patterns to fold 2 RLWINMs before RA, while some RLWINM 
will be generated after RA, for example rGc4690b007743. If the RLWINM generated 
after RA followed by another RLWINM, we expect to perform the optimization too.

Reviewed By: shchenz

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

Added: 
llvm/test/CodeGen/PowerPC/fold-rlwinm-after-ra.mir

Modified: 
llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
llvm/lib/Target/PowerPC/PPCInstrInfo.h
llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
llvm/lib/Target/PowerPC/PPCPreEmitPeephole.cpp
llvm/test/CodeGen/PowerPC/vsx_builtins.ll

Removed: 




diff  --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp 
b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
index 2de6a7754015..45587504df56 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -3231,18 +3231,64 @@ bool PPCInstrInfo::convertToImmediateForm(MachineInstr 
,
   return false;
 }
 
-bool PPCInstrInfo::combineRLWINM(MachineInstr ,
- MachineInstr **ToErase) const {
+// This function tries to combine two RLWINMs. We not only perform such
+// optimization in SSA, but also after RA, since some RLWINM is generated after
+// RA.
+bool PPCInstrInfo::simplifyRotateAndMaskInstr(MachineInstr ,
+  MachineInstr *) const {
+  bool Is64Bit = false;
+  switch (MI.getOpcode()) {
+  case PPC::RLWINM:
+  case PPC::RLWINM_rec:
+break;
+  case PPC::RLWINM8:
+  case PPC::RLWINM8_rec:
+Is64Bit = true;
+break;
+  default:
+return false;
+  }
   MachineRegisterInfo *MRI = ()->getParent()->getRegInfo();
-  unsigned FoldingReg = MI.getOperand(1).getReg();
-  if (!Register::isVirtualRegister(FoldingReg))
+  Register FoldingReg = MI.getOperand(1).getReg();
+  MachineInstr *SrcMI = nullptr;
+  bool CanErase = false;
+  bool OtherIntermediateUse = true;
+  if (MRI->isSSA()) {
+if (!Register::isVirtualRegister(FoldingReg))
+  return false;
+SrcMI = MRI->getVRegDef(FoldingReg);
+  } else {
+SrcMI = getDefMIPostRA(FoldingReg, MI, OtherIntermediateUse);
+  }
+  if (!SrcMI)
 return false;
-  MachineInstr *SrcMI = MRI->getVRegDef(FoldingReg);
-  if (SrcMI->getOpcode() != PPC::RLWINM &&
-  SrcMI->getOpcode() != PPC::RLWINM_rec &&
-  SrcMI->getOpcode() != PPC::RLWINM8 &&
-  SrcMI->getOpcode() != PPC::RLWINM8_rec)
+  // TODO: The pairs of RLWINM8(RLWINM) or RLWINM(RLWINM8) never occur before
+  // RA, but after RA. And We can fold RLWINM8(RLWINM) -> RLWINM8, or
+  // RLWINM(RLWINM8) -> RLWINM.
+  switch (SrcMI->getOpcode()) {
+  case PPC::RLWINM:
+  case PPC::RLWINM_rec:
+if (Is64Bit)
+  return false;
+break;
+  case PPC::RLWINM8:
+  case PPC::RLWINM8_rec:
+if (!Is64Bit)
+  return false;
+break;
+  default:
 return false;
+  }
+  if (MRI->isSSA()) {
+CanErase = !SrcMI->hasImplicitDef() && MRI->hasOneNonDBGUse(FoldingReg);
+  } else {
+CanErase = !OtherIntermediateUse && MI.getOperand(1).isKill() &&
+   !SrcMI->hasImplicitDef();
+// In post-RA, if SrcMI also defines the register to be forwarded, we can
+// only do the folding if SrcMI is going to be erased.
+if (!CanErase && SrcMI->definesRegister(SrcMI->getOperand(1).getReg()))
+  return false;
+  }
   assert((MI.getOperand(2).isImm() && MI.getOperand(3).isImm() &&
   MI.getOperand(4).isImm() && SrcMI->getOperand(2).isImm() &&
   SrcMI->getOperand(3).isImm() && SrcMI->getOperand(4).isImm()) &&
@@ -3253,7 +3299,6 @@ bool PPCInstrInfo::combineRLWINM(MachineInstr ,
   uint64_t MBMI = MI.getOperand(3).getImm();
   uint64_t MESrc = SrcMI->getOperand(4).getImm();
   uint64_t MEMI = MI.getOperand(4).getImm();
-
   assert((MEMI < 32 && MESrc < 32 && MBMI < 32 && MBSrc < 32) &&
  "Invalid PPC::RLWINM Instruction!");
   // If MBMI is bigger than MEMI, we always can not get run of ones.
@@ -3297,8 +3342,6 @@ bool PPCInstrInfo::combineRLWINM(MachineInstr ,
 
   // If final mask is 0, MI result should be 0 too.
   if (FinalMask.isNullValue()) {
-bool Is64Bit =
-(MI.getOpcode() == PPC::RLWINM8 || MI.getOpcode() == PPC::RLWINM8_rec);
 Simplified = true;
 LLVM_DEBUG(dbgs() << "Replace Instr: ");
 LLVM_DEBUG(MI.dump());
@@ -3356,12 +3399,10 @@ bool PPCInstrInfo::combineRLWINM(MachineInstr ,
 LLVM_DEBUG(dbgs() << "To: ");
 LLVM_DEBUG(MI.dump());
   }
-  if (Simplified & MRI->use_nodbg_empty(FoldingReg) &&
-  !SrcMI->hasImplicitDef()) {
-// If FoldingReg has no 

[llvm-branch-commits] [openmp] 9e3e332 - [OpenMP] libomp: fix non-X86, non-AARCH64 builds

2020-11-25 Thread via llvm-branch-commits

Author: AndreyChurbanov
Date: 2020-11-25T20:40:23+03:00
New Revision: 9e3e332d273b80b5167ac35f8dcfa7178e45c5e9

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

LOG: [OpenMP] libomp: fix non-X86, non-AARCH64 builds

Commit https://reviews.llvm.org/rG7b5254223acbf2ef9cd278070c5a84ab278d7e5f
broke the build for some architectures, because macro KMP_PREFIX_UNDERSCORE
was defined only for x86, x86_64 and aarch64. This patch defines it for other
architectures (as a no-op).

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

Added: 


Modified: 
openmp/runtime/src/z_Linux_asm.S

Removed: 




diff  --git a/openmp/runtime/src/z_Linux_asm.S 
b/openmp/runtime/src/z_Linux_asm.S
index 272999ddb9af0..b4a45c1ac6f5b 100644
--- a/openmp/runtime/src/z_Linux_asm.S
+++ b/openmp/runtime/src/z_Linux_asm.S
@@ -1737,6 +1737,9 @@ __kmp_unnamed_critical_addr:
 #endif /* KMP_ARCH_ARM */
 
 #if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64
+#ifndef KMP_PREFIX_UNDERSCORE
+# define KMP_PREFIX_UNDERSCORE(x) x
+#endif
 .data
 .comm .gomp_critical_user_,32,8
 .data



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


[llvm-branch-commits] [mlir] 3024b1e - [mlir][Python] Check numpy in Python bindings configuration.

2020-12-01 Thread via llvm-branch-commits

Author: zhanghb97
Date: 2020-12-02T09:29:20+08:00
New Revision: 3024b1efde6097779d86277131e2de60086f637b

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

LOG: [mlir][Python] Check numpy in Python bindings configuration.

The test process of the ir_array_attributes.py depends on numpy. This patch 
checks numpy in Python bindings configuration.
- Add NumPy in find_package as a required component to check numpy.
- If numpy is found, print the version and include directory.

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

Added: 


Modified: 
mlir/CMakeLists.txt

Removed: 




diff  --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 1acdec218373..2cf37753ea5c 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -79,9 +79,10 @@ set(MLIR_PYTHON_BINDINGS_VERSION_LOCKED 1 CACHE BOOL
 
 if(MLIR_BINDINGS_PYTHON_ENABLED)
   include(MLIRDetectPythonEnv)
-  find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
+  find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
   message(STATUS "Found python include dirs: ${Python3_INCLUDE_DIRS}")
   message(STATUS "Found python libraries: ${Python3_LIBRARIES}")
+  message(STATUS "Found numpy v${Python3_NumPy_VERSION}: 
${Python3_NumPy_INCLUDE_DIRS}")
   mlir_detect_pybind11_install()
   find_package(pybind11 2.6 CONFIG REQUIRED)
   message(STATUS "Found pybind11 v${pybind11_VERSION}: 
${pybind11_INCLUDE_DIR}")



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


[llvm-branch-commits] [clang] a417cb0 - [NFC] Add CLangOffloadBundler documentation to Clang index

2020-12-01 Thread via llvm-branch-commits

Author: Tony
Date: 2020-12-02T02:47:44Z
New Revision: a417cb086209c2a01c2460d3e1ea64453f53c68e

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

LOG: [NFC] Add CLangOffloadBundler documentation to Clang index

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

Added: 


Modified: 
clang/docs/index.rst

Removed: 




diff  --git a/clang/docs/index.rst b/clang/docs/index.rst
index 2c7728713cab..a3a76c073b99 100644
--- a/clang/docs/index.rst
+++ b/clang/docs/index.rst
@@ -79,6 +79,7 @@ Using Clang Tools
ClangFormat
ClangFormatStyleOptions
ClangFormattedStatus
+   ClangOffloadBundler
 
 Design Documents
 



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


[llvm-branch-commits] [llvm] ac1b2ae - [NFC][AMDGPU] Fix broken link to ClangOffloadBundler in AMDGPUUsage

2020-12-01 Thread via llvm-branch-commits

Author: Tony
Date: 2020-12-02T03:04:28Z
New Revision: ac1b2ae9dc6c150aab234901baf0c2dd9a2ca0be

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

LOG: [NFC][AMDGPU] Fix broken link to ClangOffloadBundler in AMDGPUUsage

Added: 


Modified: 
llvm/docs/AMDGPUUsage.rst

Removed: 




diff  --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index f789662f6d10..ce8a5bad3939 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -503,8 +503,8 @@ Target ID
 -
 
 AMDGPU supports target IDs. See `Clang Offload Bundler
-`_ for a general description. 
The
-AMDGPU target specific information is:
+`_ for a general
+description. The AMDGPU target specific information is:
 
 **processor**
   Is a AMDGPU processor or alternative processor name specified in
@@ -529,7 +529,7 @@ Embedding Bundled Code Objects
 
 AMDGPU supports the HIP and OpenMP languages that perform code object embedding
 as described in `Clang Offload Bundler
-`_.
+`_.
 
 .. _amdgpu-address-spaces:
 



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


[llvm-branch-commits] [llvm] 2ce38b3 - [NFC] Reduce include files dependency.

2020-12-03 Thread via llvm-branch-commits

Author: dfukalov
Date: 2020-12-03T18:25:05+03:00
New Revision: 2ce38b3f038482e9d21661d1b328a42664301f03

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

LOG: [NFC] Reduce include files dependency.

1. Removed #include "...AliasAnalysis.h" in other headers and modules.
2. Cleaned up includes in AliasAnalysis.h.

Reviewed By: RKSimon

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

Added: 


Modified: 
llvm/include/llvm/Analysis/AliasAnalysis.h
llvm/include/llvm/Analysis/AliasSetTracker.h
llvm/include/llvm/Analysis/BasicAliasAnalysis.h
llvm/include/llvm/Analysis/ObjCARCAnalysisUtils.h
llvm/include/llvm/CodeGen/MachinePipeliner.h
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/include/llvm/Transforms/Scalar/JumpThreading.h
llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
llvm/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
llvm/lib/Analysis/AliasAnalysis.cpp
llvm/lib/Analysis/IVDescriptors.cpp
llvm/lib/Analysis/LoopAnalysisManager.cpp
llvm/lib/Analysis/ObjCARCAnalysisUtils.cpp
llvm/lib/CodeGen/LiveRangeEdit.cpp
llvm/lib/CodeGen/MachineFunctionPass.cpp
llvm/lib/CodeGen/MachinePipeliner.cpp
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Target/ARM/ARMParallelDSP.cpp
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp
llvm/lib/Transforms/ObjCARC/ObjCARC.h
llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
llvm/lib/Transforms/Scalar/LoopRotation.cpp
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
llvm/tools/opt/NewPMDriver.cpp
llvm/unittests/Analysis/AliasSetTrackerTest.cpp
llvm/unittests/Analysis/BasicAliasAnalysisTest.cpp
llvm/unittests/Analysis/DDGTest.cpp
llvm/unittests/Analysis/GlobalsModRefTest.cpp
llvm/unittests/Analysis/MemorySSATest.cpp
llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp
llvm/unittests/Transforms/Vectorize/VPlanSlpTest.cpp
polly/include/polly/ScopBuilder.h
polly/include/polly/ScopDetection.h
polly/include/polly/ScopInfo.h

Removed: 




diff  --git a/llvm/include/llvm/Analysis/AliasAnalysis.h 
b/llvm/include/llvm/Analysis/AliasAnalysis.h
index 736917cf327a..7a4338905129 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -42,8 +42,6 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Analysis/MemoryLocation.h"
-#include "llvm/Analysis/TargetLibraryInfo.h"
-#include "llvm/IR/Function.h"
 #include "llvm/IR/Instruction.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/PassManager.h"
@@ -59,6 +57,7 @@ class AnalysisUsage;
 class BasicAAResult;
 class BasicBlock;
 class DominatorTree;
+class Function;
 class Value;
 
 /// The possible results of an alias query.
@@ -1172,12 +1171,7 @@ class AAManager : public AnalysisInfoMixin {
 ResultGetters.push_back();
   }
 
-  Result run(Function , FunctionAnalysisManager ) {
-Result R(AM.getResult(F));
-for (auto  : ResultGetters)
-  (*Getter)(F, AM, R);
-return R;
-  }
+  Result run(Function , FunctionAnalysisManager );
 
 private:
   friend AnalysisInfoMixin;

diff  --git a/llvm/include/llvm/Analysis/AliasSetTracker.h 
b/llvm/include/llvm/Analysis/AliasSetTracker.h
index 1db657528d19..b27fd5aa92a7 100644
--- a/llvm/include/llvm/Analysis/AliasSetTracker.h
+++ b/llvm/include/llvm/Analysis/AliasSetTracker.h
@@ -20,7 +20,7 @@
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/ilist.h"
 #include "llvm/ADT/ilist_node.h"
-#include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Analysis/MemoryLocation.h"
 #include "llvm/IR/Instruction.h"
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/PassManager.h"
@@ -34,6 +34,7 @@
 
 namespace llvm {
 
+class AAResults;
 class AliasSetTracker;
 class BasicBlock;
 class LoadInst;
@@ -46,6 +47,8 @@ class StoreInst;
 class VAArgInst;
 class Value;
 
+enum AliasResult : uint8_t;
+
 class AliasSet : public ilist_node {
   friend class AliasSetTracker;
 
@@ -294,7 +297,7 @@ class AliasSet : public ilist_node {
   void addPointer(AliasSetTracker , PointerRec , LocationSize Size,
   const AAMDNodes , bool KnownMustAlias = false,
   bool SkipSizeUpdate = false);
-  void addUnknownInst(Instruction *I, AliasAnalysis );
+  void addUnknownInst(Instruction *I, AAResults );
 
   void removeUnknownInst(AliasSetTracker , Instruction *I) {
 bool WasEmpty = UnknownInsts.empty();
@@ -312,8 +315,8 @@ class AliasSet 

[llvm-branch-commits] [llvm] 28fdeea - [PowerPC] Add support for intrinsics dcbfps and dcbstps in P10.

2020-12-06 Thread via llvm-branch-commits

Author: Esme-Yi
Date: 2020-12-07T05:19:06Z
New Revision: 28fdeea9522fd2538773dc0d969dcb155b067e2e

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

LOG: [PowerPC] Add support for intrinsics dcbfps and dcbstps in P10.

Summary: This patch added support for the intrinsics llvm.ppc.dcbfps and 
llvm.ppc.dcbstps.
dcbfps and dcbstps are actually extended mnemonics of dcbf.
dcbfps RA,RB ---> dcbf RA,RB,4
dcbstps RA,RB ---> dcbf RA,RB,6

Reviewed By: amyk, steven.zhang

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

Added: 
llvm/test/CodeGen/PowerPC/dcbf-p10.ll

Modified: 
llvm/include/llvm/IR/IntrinsicsPowerPC.td
llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp
llvm/lib/Target/PowerPC/PPCInstrInfo.td

Removed: 




diff  --git a/llvm/include/llvm/IR/IntrinsicsPowerPC.td 
b/llvm/include/llvm/IR/IntrinsicsPowerPC.td
index fa5000d42482..8db5c15fe761 100644
--- a/llvm/include/llvm/IR/IntrinsicsPowerPC.td
+++ b/llvm/include/llvm/IR/IntrinsicsPowerPC.td
@@ -18,10 +18,12 @@
 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
   // dcba/dcbf/dcbi/dcbst/dcbt/dcbz/dcbzl(PPC970) instructions.
   def int_ppc_dcba  : Intrinsic<[], [llvm_ptr_ty], []>;
-  def int_ppc_dcbf  : GCCBuiltin<"__builtin_dcbf">,
-  Intrinsic<[], [llvm_ptr_ty], []>;
-  def int_ppc_dcbfl : Intrinsic<[], [llvm_ptr_ty], []>;
-  def int_ppc_dcbflp: Intrinsic<[], [llvm_ptr_ty], []>;
+  def int_ppc_dcbf : GCCBuiltin<"__builtin_dcbf">,
+  Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
+  def int_ppc_dcbfl : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
+  def int_ppc_dcbflp : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
+  def int_ppc_dcbfps : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
+  def int_ppc_dcbstps : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
   def int_ppc_dcbi  : Intrinsic<[], [llvm_ptr_ty], []>;
   def int_ppc_dcbst : Intrinsic<[], [llvm_ptr_ty], []>;
   def int_ppc_dcbt  : Intrinsic<[], [llvm_ptr_ty],

diff  --git a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp 
b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
index 748716126836..2ff87c20ab25 100644
--- a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
+++ b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
@@ -774,12 +774,18 @@ void PPCAsmParser::ProcessInstruction(MCInst ,
   }
   case PPC::DCBFx:
   case PPC::DCBFL:
-  case PPC::DCBFLP: {
+  case PPC::DCBFLP:
+  case PPC::DCBFPS:
+  case PPC::DCBSTPS: {
 int L = 0;
 if (Opcode == PPC::DCBFL)
   L = 1;
 else if (Opcode == PPC::DCBFLP)
   L = 3;
+else if (Opcode == PPC::DCBFPS)
+  L = 4;
+else if (Opcode == PPC::DCBSTPS)
+  L = 6;
 
 MCInst TmpInst;
 TmpInst.setOpcode(PPC::DCBF);

diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp 
b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp
index 1a481efbc3b5..e77d7b3d892c 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp
@@ -184,12 +184,18 @@ void PPCInstPrinter::printInst(const MCInst *MI, uint64_t 
Address,
 
   if (MI->getOpcode() == PPC::DCBF) {
 unsigned char L = MI->getOperand(0).getImm();
-if (!L || L == 1 || L == 3) {
-  O << "\tdcbf";
-  if (L == 1 || L == 3)
+if (!L || L == 1 || L == 3 || L == 4 || L == 6) {
+  O << "\tdcb";
+  if (L != 6)
+O << "f";
+  if (L == 1)
 O << "l";
   if (L == 3)
-O << "p";
+O << "lp";
+  if (L == 4)
+O << "ps";
+  if (L == 6)
+O << "stps";
   O << " ";
 
   printOperand(MI, 1, O);

diff  --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td 
b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
index 2dc575923da7..c388ae75950f 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
@@ -4609,6 +4609,16 @@ def : Pat<(int_ppc_dcbfl xoaddr:$dst),
 def : Pat<(int_ppc_dcbflp xoaddr:$dst),
   (DCBF 3, xoaddr:$dst)>;
 
+let Predicates = [IsISA3_1] in {
+  def DCBFPS  : PPCAsmPseudo<"dcbfps $dst", (ins memrr:$dst)>;
+  def DCBSTPS : PPCAsmPseudo<"dcbstps $dst", (ins memrr:$dst)>;
+
+  def : Pat<(int_ppc_dcbfps xoaddr:$dst),
+(DCBF 4, xoaddr:$dst)>;
+  def : Pat<(int_ppc_dcbstps xoaddr:$dst),
+(DCBF 6, xoaddr:$dst)>;
+}
+
 def : InstAlias<"crset $bx", (CREQV crbitrc:$bx, crbitrc:$bx, crbitrc:$bx)>;
 def : InstAlias<"crclr $bx", (CRXOR crbitrc:$bx, crbitrc:$bx, crbitrc:$bx)>;
 def : InstAlias<"crmove $bx, $by", (CROR crbitrc:$bx, crbitrc:$by, 
crbitrc:$by)>;

diff  --git a/llvm/test/CodeGen/PowerPC/dcbf-p10.ll 
b/llvm/test/CodeGen/PowerPC/dcbf-p10.ll
new file mode 100644
index 

[llvm-branch-commits] [openmp] 22558c8 - [OpenMP] libomp: Fix possible NULL dereferences

2020-12-07 Thread via llvm-branch-commits

Author: AndreyChurbanov
Date: 2020-12-07T19:09:07+03:00
New Revision: 22558c8501eaf5e7547ee13fa5a009efdec6dc90

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

LOG: [OpenMP] libomp: Fix possible NULL dereferences

Check pointer returned by strchr, as it can be NULL in case of broken
format of input string. Introduced new function __kmp_str_loc_numbers
for fast parsing of numbers only in the location string.
Also made some cleanup of __kmp_str_loc_init declaration and usage:
- changed type of init_fname parameter to bool;
- changed input from true to false in places where fname is not used.

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

Added: 


Modified: 
openmp/runtime/src/kmp_debugger.cpp
openmp/runtime/src/kmp_itt.inl
openmp/runtime/src/kmp_lock.cpp
openmp/runtime/src/kmp_str.cpp
openmp/runtime/src/kmp_str.h

Removed: 




diff  --git a/openmp/runtime/src/kmp_debugger.cpp 
b/openmp/runtime/src/kmp_debugger.cpp
index 490300f9b207..2a1f633c49c1 100644
--- a/openmp/runtime/src/kmp_debugger.cpp
+++ b/openmp/runtime/src/kmp_debugger.cpp
@@ -269,7 +269,7 @@ int __kmp_omp_num_threads(ident_t const *ident) {
   if (info->num > 0 && info->array != 0) {
 kmp_omp_nthr_item_t *items =
 (kmp_omp_nthr_item_t *)__kmp_convert_to_ptr(info->array);
-kmp_str_loc_t loc = __kmp_str_loc_init(ident->psource, 1);
+kmp_str_loc_t loc = __kmp_str_loc_init(ident->psource, true);
 int i;
 for (i = 0; i < info->num; ++i) {
   if (kmp_location_match(, [i])) {

diff  --git a/openmp/runtime/src/kmp_itt.inl b/openmp/runtime/src/kmp_itt.inl
index 6257cea4faf3..09d5480284e0 100644
--- a/openmp/runtime/src/kmp_itt.inl
+++ b/openmp/runtime/src/kmp_itt.inl
@@ -115,7 +115,8 @@ LINKAGE void __kmp_itt_region_forking(int gtid, int 
team_size, int barriers) {
 // that the tools more or less standardized on:
 //   "$omp$parallel@[file:][:]"
 char *buff = NULL;
-kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, 1);
+kmp_str_loc_t str_loc =
+__kmp_str_loc_init(loc->psource, /* init_fname */ false);
 buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d", str_loc.func,
 team_size, str_loc.file, str_loc.line,
 str_loc.col);
@@ -155,7 +156,8 @@ LINKAGE void __kmp_itt_region_forking(int gtid, int 
team_size, int barriers) {
   if ((frm < KMP_MAX_FRAME_DOMAINS) &&
   (__kmp_itt_region_team_size[frm] != team_size)) {
 char *buff = NULL;
-kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, 1);
+kmp_str_loc_t str_loc = 
+__kmp_str_loc_init(loc->psource, /* init_fname */ false);
 buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d", str_loc.func,
 team_size, str_loc.file, str_loc.line,
 str_loc.col);
@@ -212,7 +214,8 @@ LINKAGE void __kmp_itt_frame_submit(int gtid, 
__itt_timestamp begin,
 // that the tools more or less standardized on:
 //   "$omp$parallel:team_size@[file:][:]"
 char *buff = NULL;
-kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, 1);
+kmp_str_loc_t str_loc = 
+__kmp_str_loc_init(loc->psource, /* init_fname */ false);
 buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d", str_loc.func,
 team_size, str_loc.file, str_loc.line,
 str_loc.col);
@@ -234,7 +237,8 @@ LINKAGE void __kmp_itt_frame_submit(int gtid, 
__itt_timestamp begin,
 return; // something's gone wrong, returning
   if (__kmp_itt_region_team_size[frm] != team_size) {
 char *buff = NULL;
-kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, 1);
+kmp_str_loc_t str_loc = 
+__kmp_str_loc_init(loc->psource, /* init_fname */ false);
 buff = __kmp_str_format("%s$omp$parallel:%d@%s:%d:%d", str_loc.func,
 team_size, str_loc.file, str_loc.line,
 str_loc.col);
@@ -273,7 +277,8 @@ LINKAGE void __kmp_itt_frame_submit(int gtid, 
__itt_timestamp begin,
   // Transform compiler-generated region location into the format
   // that the tools more or less standardized on:
   //   "$omp$frame@[file:][:]"
-  kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, 1);
+  kmp_str_loc_t str_loc = 
+  __kmp_str_loc_init(loc->psource, /* init_fname */ false);
   if (imbalance) {
 char *buff_imb = NULL;
 buff_imb = __kmp_str_format("%s$omp$barrier-imbalance:%d@%s:%d",
@@ -365,25 +370,12 @@ LINKAGE void __kmp_itt_metadata_loop(ident_t 

[llvm-branch-commits] [openmp] fff1abc - [OpenMP] NFC: comment adjusted

2020-12-07 Thread via llvm-branch-commits

Author: AndreyChurbanov
Date: 2020-12-07T19:50:14+03:00
New Revision: fff1abc406d56401f37a1ef4431583f2e75b5039

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

LOG: [OpenMP] NFC: comment adjusted

Added: 


Modified: 
openmp/runtime/src/kmp_str.cpp

Removed: 




diff  --git a/openmp/runtime/src/kmp_str.cpp b/openmp/runtime/src/kmp_str.cpp
index 24526e587412..2231a59342d9 100644
--- a/openmp/runtime/src/kmp_str.cpp
+++ b/openmp/runtime/src/kmp_str.cpp
@@ -334,7 +334,7 @@ void __kmp_str_loc_numbers(char const *Psource, int 
*LineBeg,
 *LineBeg = 0;
   }
   if (Str) {
-// Read end line number.
+// Read end line or column number.
 *LineEndOrCol = atoi(Str + 1);
   } else {
 // Broken format of input string, cannot read the number.



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


[llvm-branch-commits] [llvm] 875b4fd - [flang][openacc] Add clause validity tests for the kernels directive

2020-12-07 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-07T14:27:18-05:00
New Revision: 875b4fd5ee95bedd6ec2bcf8423c159ccecd8443

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

LOG: [flang][openacc] Add clause validity tests for the kernels directive

Add some clause validity tests for the kernels directive

Reviewed By: sameeranjoshi

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

Added: 


Modified: 
flang/test/Semantics/acc-clause-validity.f90
llvm/include/llvm/Frontend/OpenACC/ACC.td

Removed: 




diff  --git a/flang/test/Semantics/acc-clause-validity.f90 
b/flang/test/Semantics/acc-clause-validity.f90
index 64e6ca887b6c..717b5cd30418 100644
--- a/flang/test/Semantics/acc-clause-validity.f90
+++ b/flang/test/Semantics/acc-clause-validity.f90
@@ -506,26 +506,6 @@ program openacc_clause_validity
   end do
   !$acc end parallel loop
 
-  !$acc kernels device_type(*) async
-  do i = 1, N
-a(i) = 3.14
-  end do
-  !$acc end kernels
-
-  !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS 
directive
-  !$acc kernels device_type(*) if(.TRUE.)
-  do i = 1, N
-a(i) = 3.14
-  end do
-  !$acc end kernels
-
-  !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS 
LOOP directive
-  !$acc kernels loop device_type(*) if(.TRUE.)
-  do i = 1, N
-a(i) = 3.14
-  end do
-  !$acc end kernels loop
-
   !$acc serial device_type(*) async
   do i = 1, N
 a(i) = 3.14
@@ -622,18 +602,128 @@ program openacc_clause_validity
 reduction_l = d(i) .neqv. e(i)
   end do
 
+  !$acc kernels async
+  !$acc end kernels
+
+  !$acc kernels async(1)
+  !$acc end kernels
+
+  !$acc kernels async(async1)
+  !$acc end kernels
+
+  !$acc kernels wait(wait1)
+  !$acc end kernels
+
+  !$acc kernels wait(wait1, wait2)
+  !$acc end kernels
+
   !$acc kernels wait(1, 2) async(3)
   !$acc end kernels
 
   !$acc kernels wait(queues: 1, 2) async(3)
   !$acc end kernels
 
+  !$acc kernels wait(1) wait(2) async(3)
+  !$acc end kernels
+
   !$acc kernels wait(devnum: 1: 1, 2) async(3)
   !$acc end kernels
 
   !$acc kernels wait(devnum: 1: queues: 1, 2) async(3)
   !$acc end kernels
 
+  !$acc kernels num_gangs(8)
+  !$acc end kernels
+
+  !$acc kernels num_workers(8)
+  !$acc end kernels
+
+  !$acc kernels vector_length(128)
+  !$acc end kernels
+
+  !$acc kernels if(.true.)
+  !$acc end kernels
+
+  !$acc kernels if(ifCondition)
+  !$acc end kernels
+
+  !ERROR: At most one IF clause can appear on the KERNELS directive
+  !$acc kernels if(.true.) if(ifCondition)
+  !$acc end kernels
+
+  !$acc kernels self
+  !$acc end kernels
+
+  !$acc kernels self(.true.)
+  !$acc end kernels
+
+  !$acc kernels self(ifCondition)
+  !$acc end kernels
+
+  !$acc kernels copy(aa) copyin(bb) copyout(cc)
+  !$acc end kernels
+
+  !$acc kernels copy(aa, bb) copyout(zero: cc)
+  !$acc end kernels
+
+  !$acc kernels present(aa, bb) create(cc)
+  !$acc end kernels
+
+  !$acc kernels copyin(readonly: aa, bb) create(zero: cc)
+  !$acc end kernels
+
+  !$acc kernels deviceptr(aa, bb) no_create(cc)
+  !$acc end kernels
+
+  !$acc kernels attach(aa, bb, cc)
+  !$acc end kernels
+
+  !ERROR: PRIVATE clause is not allowed on the KERNELS directive
+  !$acc kernels private(aa, bb, cc)
+  !$acc end kernels
+
+  !$acc kernels default(none)
+  !$acc end kernels
+
+  !$acc kernels default(present)
+  !$acc end kernels
+
+  !ERROR: At most one DEFAULT clause can appear on the KERNELS directive
+  !$acc kernels default(none) default(present)
+  !$acc end kernels
+
+  !$acc kernels device_type(*)
+  !$acc end kernels
+
+  !$acc kernels device_type(1)
+  !$acc end kernels
+
+  !$acc kernels device_type(1, 3)
+  !$acc end kernels
+
+  !$acc kernels device_type(*) async wait num_gangs(8) num_workers(8) 
vector_length(128)
+  !$acc end kernels
+
+  !$acc kernels device_type(*) async
+  do i = 1, N
+a(i) = 3.14
+  end do
+  !$acc end kernels
+
+  !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS 
directive
+  !$acc kernels device_type(*) if(.TRUE.)
+  do i = 1, N
+a(i) = 3.14
+  end do
+  !$acc end kernels
+
+  !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the KERNELS 
LOOP directive
+  !$acc kernels loop device_type(*) if(.TRUE.)
+  do i = 1, N
+a(i) = 3.14
+  end do
+  !$acc end kernels loop
+
   !$acc wait
 
   !$acc wait async

diff  --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td 
b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index eaca44f6b158..206f82adb1e5 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -298,7 +298,8 @@ def ACC_Kernels : Directive<"kernels"> {
 VersionedClause,
 VersionedClause,
 VersionedClause,
-VersionedClause
+VersionedClause,
+VersionedClause
   ];
   

[llvm-branch-commits] [llvm] 9501419 - Speedup some unicode rendering

2020-12-03 Thread via llvm-branch-commits

Author: serge-sans-paille
Date: 2020-12-03T20:11:11+01:00
New Revision: 9501419e879e56273f504beda3b13bf6bf82ae2b

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

LOG: Speedup some unicode rendering

Use a fast path for column width computation for ascii characters. Especially
relevant for llvm-objdump.

before:

% time ./bin/llvm-objdump -D  -j .text /lib/libc.so.6 >/dev/null
./bin/llvm-objdump -D -j .text /lib/libc.so.6 > /dev/null  0.75s user 0.01s 
system 99% cpu 0.757 total

after:

% time ./bin/llvm-objdump -D  -j .text /lib/libc.so.6 >/dev/null
./bin/llvm-objdump -D -j .text /lib/libc.so.6 > /dev/null  0.37s user 0.01s 
system 99% cpu 0.378 total

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

Added: 


Modified: 
llvm/lib/Support/Unicode.cpp
llvm/unittests/Support/UnicodeTest.cpp

Removed: 




diff  --git a/llvm/lib/Support/Unicode.cpp b/llvm/lib/Support/Unicode.cpp
index 4d195069682b..bb6e7b4c 100644
--- a/llvm/lib/Support/Unicode.cpp
+++ b/llvm/lib/Support/Unicode.cpp
@@ -339,11 +339,22 @@ static inline int charWidth(int UCS)
   return 1;
 }
 
+static bool isprintableascii(char c) { return c > 31 && c < 127; }
+
 int columnWidthUTF8(StringRef Text) {
   unsigned ColumnWidth = 0;
   unsigned Length;
   for (size_t i = 0, e = Text.size(); i < e; i += Length) {
 Length = getNumBytesForUTF8(Text[i]);
+
+// fast path for ASCII characters
+if (Length == 1) {
+  if (!isprintableascii(Text[i]))
+return ErrorNonPrintableCharacter;
+  ColumnWidth += 1;
+  continue;
+}
+
 if (Length <= 0 || i + Length > Text.size())
   return ErrorInvalidUTF8;
 UTF32 buf[1];

diff  --git a/llvm/unittests/Support/UnicodeTest.cpp 
b/llvm/unittests/Support/UnicodeTest.cpp
index 376fbee4ae66..6ce323dc8f38 100644
--- a/llvm/unittests/Support/UnicodeTest.cpp
+++ b/llvm/unittests/Support/UnicodeTest.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "llvm/Support/Unicode.h"
+#include "llvm/Support/ConvertUTF.h"
 #include "gtest/gtest.h"
 
 namespace llvm {
@@ -23,6 +24,7 @@ TEST(Unicode, columnWidthUTF8) {
   EXPECT_EQ(6, columnWidthUTF8("abcdef"));
 
   EXPECT_EQ(-1, columnWidthUTF8("\x01"));
+  EXPECT_EQ(-1, columnWidthUTF8("\t"));
   EXPECT_EQ(-1, columnWidthUTF8("aa\x01"));
   EXPECT_EQ(-1, columnWidthUTF8("\342\200\213")); // 200B ZERO WIDTH SPACE
 
@@ -84,6 +86,19 @@ TEST(Unicode, isPrintable) {
   EXPECT_TRUE(isPrintable(0x2));  // CJK UNIFIED IDEOGRAPH-2
 
   EXPECT_FALSE(isPrintable(0x10)); // noncharacter
+
+  // test the validity of a fast path in columnWidthUTF8
+  for (unsigned char c = 0; c < 128; ++c) {
+const UTF8 buf8[2] = {c, 0};
+const UTF8 *Target8 = [0];
+UTF32 buf32[1];
+UTF32 *Target32 = [0];
+auto status = ConvertUTF8toUTF32(, Target8 + 1, ,
+ Target32 + 1, strictConversion);
+EXPECT_TRUE(status == conversionOK);
+EXPECT_TRUE((columnWidthUTF8(reinterpret_cast(buf8)) == 1) ==
+(bool)isPrintable(buf32[0]));
+  }
 }
 
 } // namespace



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


[llvm-branch-commits] [clang] 840e651 - [clang-format] Improve clang-formats handling of concepts

2020-12-04 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-04T17:45:50Z
New Revision: 840e651dc6d7fe652667eb8b4d04ef4daf4769df

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

LOG: [clang-format] Improve clang-formats handling of concepts

This is a starting point to improve the handling of concepts in clang-format. 
There is currently no real formatting of concepts and this can lead to some odd 
formatting, e.g.

Reviewed By: mitchell-stellar, miscco, curdeius

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

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/FormatToken.h
clang/lib/Format/TokenAnnotator.cpp
clang/lib/Format/UnwrappedLineParser.cpp
clang/lib/Format/UnwrappedLineParser.h
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 6c5556a94391..d6d437a0a05e 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -1382,6 +1382,18 @@ the configuration (without a prefix: ``Auto``).
 
 
 
+**BreakBeforeConceptDeclarations** (``bool``)
+  If ``true``, concept will be placed on a new line.
+
+  .. code-block:: c++
+
+true:
+ template
+ concept ...
+
+false:
+ template concept ...
+
 **BreakBeforeTernaryOperators** (``bool``)
   If ``true``, ternary operators will be placed after line breaks.
 
@@ -1901,6 +1913,25 @@ the configuration (without a prefix: ``Auto``).
 
 
 
+**IndentRequires** (``bool``)
+  Indent the requires clause in a template
+
+  .. code-block:: c++
+
+ true:
+ template 
+   requires Iterator
+ void sort(It begin, It end) {
+   //
+ }
+
+ false:
+ template 
+ requires Iterator
+ void sort(It begin, It end) {
+   //
+ }
+
 **IndentWidth** (``unsigned``)
   The number of columns to use for indentation.
 

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index d62c62dad3d2..d90d059e0659 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -271,6 +271,14 @@ clang-format
 };
 
 
+- Experimental Support in clang-format for concepts has been improved, to 
+  aid this the follow options have been added
+
+- Option ``IndentRequires`` has been added to indent the ``requires`` keyword
+  in templates.
+- Option ``BreakBeforeConceptDeclarations`` has been added to aid the 
formatting of concepts.
+
+
 libclang
 
 

diff  --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index dab4cbbbdfe1..6e304630fbdc 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -1160,6 +1160,17 @@ struct FormatStyle {
   /// \endcode
   BraceWrappingFlags BraceWrapping;
 
+  /// If ``true``, concept will be placed on a new line.
+  /// \code
+  ///   true:
+  ///template
+  ///concept ...
+  ///
+  ///   false:
+  ///template concept ...
+  /// \endcode
+  bool BreakBeforeConceptDeclarations;
+
   /// If ``true``, ternary operators will be placed after line breaks.
   /// \code
   ///true:
@@ -1590,6 +1601,24 @@ struct FormatStyle {
   /// IndentExternBlockStyle is the type of indenting of extern blocks.
   IndentExternBlockStyle IndentExternBlock;
 
+  /// Indent the requires clause in a template
+  /// \code
+  ///true:
+  ///template 
+  ///  requires Iterator
+  ///void sort(It begin, It end) {
+  ///  //
+  ///}
+  ///
+  ///false:
+  ///template 
+  ///requires Iterator
+  ///void sort(It begin, It end) {
+  ///  //
+  ///}
+  /// \endcode
+  bool IndentRequires;
+
   /// The number of columns to use for indentation.
   /// \code
   ///IndentWidth: 3
@@ -2435,6 +2464,7 @@ struct FormatStyle {
BinPackParameters == R.BinPackParameters &&
BreakBeforeBinaryOperators == R.BreakBeforeBinaryOperators &&
BreakBeforeBraces == R.BreakBeforeBraces &&
+   BreakBeforeConceptDeclarations == R.BreakBeforeConceptDeclarations 
&&
BreakBeforeTernaryOperators == R.BreakBeforeTernaryOperators &&
BreakConstructorInitializers == R.BreakConstructorInitializers &&
CompactNamespaces == R.CompactNamespaces &&
@@ -2466,7 +2496,8 @@ struct FormatStyle {
IndentGotoLabels == R.IndentGotoLabels &&
IndentPPDirectives == R.IndentPPDirectives &&
IndentExternBlock == R.IndentExternBlock &&
-   IndentWidth == R.IndentWidth && Language == R.Language &&
+   IndentRequires == R.IndentRequires && IndentWidth == R.IndentWidth 
&&
+  

[llvm-branch-commits] [flang] e460654 - [flang][openacc] Add clause validity tests for the update directive

2020-12-04 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-04T14:38:49-05:00
New Revision: e46065433466eec50903fec6f40a09cf26fa801e

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

LOG: [flang][openacc] Add clause validity tests for the update directive

Add couple of clause validity tests for the update directive and check for
the restriction where at least self, host or device clause must appear on the 
directive.

Reviewed By: sameeranjoshi

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

Added: 


Modified: 
flang/lib/Semantics/check-acc-structure.cpp
flang/test/Semantics/acc-clause-validity.f90

Removed: 




diff  --git a/flang/lib/Semantics/check-acc-structure.cpp 
b/flang/lib/Semantics/check-acc-structure.cpp
index edcb41eae0c5..74b608f9ca6d 100644
--- a/flang/lib/Semantics/check-acc-structure.cpp
+++ b/flang/lib/Semantics/check-acc-structure.cpp
@@ -201,6 +201,8 @@ void AccStructureChecker::Leave(const 
parser::OpenACCStandaloneConstruct ) {
 CheckRequireAtLeastOneOf();
 break;
   case llvm::acc::Directive::ACCD_update:
+// Restriction - line 2636
+CheckRequireAtLeastOneOf();
 // Restriction - 2301
 CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
 updateOnlyAllowedAfterDeviceTypeClauses);

diff  --git a/flang/test/Semantics/acc-clause-validity.f90 
b/flang/test/Semantics/acc-clause-validity.f90
index b2fb57796f3f..7508aab5eedf 100644
--- a/flang/test/Semantics/acc-clause-validity.f90
+++ b/flang/test/Semantics/acc-clause-validity.f90
@@ -138,9 +138,37 @@ program openacc_clause_validity
   !ERROR: Unmatched PARALLEL directive
   !$acc end parallel
 
+  !ERROR: At least one of DEVICE, HOST, SELF clause must appear on the UPDATE 
directive
+  !$acc update
+
   !$acc update self(a, f) host(g) device(h)
 
-  !$acc update device(i) device_type(*) async
+  !$acc update host(aa) async(1)
+
+  !$acc update device(bb) async(async1)
+
+  !ERROR: At most one ASYNC clause can appear on the UPDATE directive
+  !$acc update host(aa, bb) async(1) async(2)
+
+  !$acc update self(bb, cc(:)) wait(1)
+
+  !$acc update device(aa, bb, cc) wait(wait1)
+
+  !$acc update host(aa) host(bb) device(cc) wait(1,2)
+
+  !$acc update device(aa, cc) wait(wait1, wait2)
+
+  !$acc update device(aa) device_type(*) async
+
+  !$acc update host(bb) device_type(*) wait
+
+  !$acc update self(cc) device_type(1,2) async device_type(3) wait
+
+  !ERROR: At most one IF clause can appear on the UPDATE directive
+  !$acc update device(aa) if(.true.) if(ifCondition)
+
+  !ERROR: At most one IF_PRESENT clause can appear on the UPDATE directive
+  !$acc update device(bb) if_present if_present
 
   !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the UPDATE 
directive
   !$acc update device(i) device_type(*) if(.TRUE.)



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


[llvm-branch-commits] [llvm] cc8df90 - [LLVMFrontend][openacc] Add basic unit tests for functions in LLVMFrontendOpenACC

2020-12-03 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-03T11:27:18-05:00
New Revision: cc8df90b03752e01cb437b2e2c5a68029adf74ac

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

LOG: [LLVMFrontend][openacc] Add basic unit tests for functions in 
LLVMFrontendOpenACC

Add unit tests for functions in LLVMFrontendOpenACC. As notice in D91470 these 
functions were not tested
as well as the ones for OpenMP (D91643). This patch add tests for the OpenACC 
part.

Reviewed By: Meinersbur

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

Added: 
llvm/unittests/Frontend/OpenACCTest.cpp

Modified: 
llvm/unittests/Frontend/CMakeLists.txt

Removed: 




diff  --git a/llvm/unittests/Frontend/CMakeLists.txt 
b/llvm/unittests/Frontend/CMakeLists.txt
index e7002344a36d..5e307c60ac72 100644
--- a/llvm/unittests/Frontend/CMakeLists.txt
+++ b/llvm/unittests/Frontend/CMakeLists.txt
@@ -9,11 +9,13 @@ set(LLVM_LINK_COMPONENTS
   )
 
 add_llvm_unittest(LLVMFrontendTests
+  OpenACCTest.cpp
   OpenMPContextTest.cpp
   OpenMPIRBuilderTest.cpp
   OpenMPParsingTest.cpp
 
   DEPENDS
+  acc_gen
   omp_gen
   )
 

diff  --git a/llvm/unittests/Frontend/OpenACCTest.cpp 
b/llvm/unittests/Frontend/OpenACCTest.cpp
new file mode 100644
index ..1929a6338bbc
--- /dev/null
+++ b/llvm/unittests/Frontend/OpenACCTest.cpp
@@ -0,0 +1,332 @@
+//===- llvm/unittest/Frontend/OpenACCTest.cpp - OpenACC Frontend tests 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Frontend/OpenACC/ACC.h.inc"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+using namespace acc;
+
+namespace {
+
+static const Clause AllClauses[] = {ACCC_unknown,
+ACCC_async,
+ACCC_attach,
+ACCC_auto,
+ACCC_bind,
+ACCC_capture,
+ACCC_collapse,
+ACCC_copy,
+ACCC_copyin,
+ACCC_copyout,
+ACCC_create,
+ACCC_default,
+ACCC_default_async,
+ACCC_delete,
+ACCC_detach,
+ACCC_device,
+ACCC_device_num,
+ACCC_deviceptr,
+ACCC_device_resident,
+ACCC_device_type,
+ACCC_finalize,
+ACCC_firstprivate,
+ACCC_gang,
+ACCC_host,
+ACCC_if,
+ACCC_if_present,
+ACCC_independent,
+ACCC_link,
+ACCC_no_create,
+ACCC_nohost,
+ACCC_num_gangs,
+ACCC_num_workers,
+ACCC_present,
+ACCC_private,
+ACCC_read,
+ACCC_reduction,
+ACCC_self,
+ACCC_seq,
+ACCC_tile,
+ACCC_unknown,
+ACCC_use_device,
+ACCC_vector,
+ACCC_vector_length,
+ACCC_wait,
+ACCC_worker,
+ACCC_write};
+
+TEST(OpenACCTest, DirectiveHelpers) {
+  EXPECT_EQ(getOpenACCDirectiveKind(""), ACCD_unknown);
+  EXPECT_EQ(getOpenACCDirectiveKind("dummy"), ACCD_unknown);
+  EXPECT_EQ(getOpenACCDirectiveKind("atomic"), ACCD_atomic);
+  EXPECT_EQ(getOpenACCDirectiveKind("cache"), ACCD_cache);
+  EXPECT_EQ(getOpenACCDirectiveKind("data"), ACCD_data);
+  EXPECT_EQ(getOpenACCDirectiveKind("declare"), ACCD_declare);
+  EXPECT_EQ(getOpenACCDirectiveKind("enter data"), ACCD_enter_data);
+  

[llvm-branch-commits] [llvm] 1860331 - [MemCpyOpt] Correctly merge alias scopes during call slot optimization

2020-12-03 Thread via llvm-branch-commits

Author: modimo
Date: 2020-12-03T09:23:37-08:00
New Revision: 18603319321a6c1b158800bcc60035ee01549516

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

LOG: [MemCpyOpt] Correctly merge alias scopes during call slot optimization

When MemCpyOpt performs call slot optimization it will concatenate the 
`alias.scope` metadata between the function call and the memcpy. However, 
scoped AA relies on the domains in metadata to be maintained in a caller-callee 
relationship. Naive concatenation breaks this assumption leading to bad AA 
results.

The fix is to take the intersection of domains then union the scopes within 
those domains.

The original bug came from a case of rust bad codegen which uses this bad 
aliasing to perform additional memcpy optimizations. As show in the added test 
case `%src` got forwarded past its lifetime leading to a dereference of garbage 
data.

Testing
ninja check-llvm

Reviewed By: jeroen.dobbelaere

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

Added: 
llvm/test/Analysis/ScopedNoAliasAA/alias-scope-merging.ll
llvm/test/Transforms/MemCpyOpt/callslot_badaa.ll

Modified: 
llvm/include/llvm/Analysis/ScopedNoAliasAA.h
llvm/lib/Analysis/ScopedNoAliasAA.cpp
llvm/lib/IR/Metadata.cpp
llvm/test/Transforms/GVN/noalias.ll
llvm/test/Transforms/InstCombine/fold-phi-load-metadata.ll
llvm/test/Transforms/NewGVN/noalias.ll

Removed: 




diff  --git a/llvm/include/llvm/Analysis/ScopedNoAliasAA.h 
b/llvm/include/llvm/Analysis/ScopedNoAliasAA.h
index c55228eace4b..562640647918 100644
--- a/llvm/include/llvm/Analysis/ScopedNoAliasAA.h
+++ b/llvm/include/llvm/Analysis/ScopedNoAliasAA.h
@@ -25,6 +25,27 @@ class Function;
 class MDNode;
 class MemoryLocation;
 
+/// This is a simple wrapper around an MDNode which provides a higher-level
+/// interface by hiding the details of how alias analysis information is 
encoded
+/// in its operands.
+class AliasScopeNode {
+  const MDNode *Node = nullptr;
+
+public:
+  AliasScopeNode() = default;
+  explicit AliasScopeNode(const MDNode *N) : Node(N) {}
+
+  /// Get the MDNode for this AliasScopeNode.
+  const MDNode *getNode() const { return Node; }
+
+  /// Get the MDNode for this AliasScopeNode's domain.
+  const MDNode *getDomain() const {
+if (Node->getNumOperands() < 2)
+  return nullptr;
+return dyn_cast_or_null(Node->getOperand(1));
+  }
+};
+
 /// A simple AA result which uses scoped-noalias metadata to answer queries.
 class ScopedNoAliasAAResult : public AAResultBase {
   friend AAResultBase;

diff  --git a/llvm/lib/Analysis/ScopedNoAliasAA.cpp 
b/llvm/lib/Analysis/ScopedNoAliasAA.cpp
index 5e2aaab050af..dca18033e8fd 100644
--- a/llvm/lib/Analysis/ScopedNoAliasAA.cpp
+++ b/llvm/lib/Analysis/ScopedNoAliasAA.cpp
@@ -50,31 +50,6 @@ using namespace llvm;
 static cl::opt EnableScopedNoAlias("enable-scoped-noalias",
  cl::init(true), cl::Hidden);
 
-namespace {
-
-/// This is a simple wrapper around an MDNode which provides a higher-level
-/// interface by hiding the details of how alias analysis information is 
encoded
-/// in its operands.
-class AliasScopeNode {
-  const MDNode *Node = nullptr;
-
-public:
-  AliasScopeNode() = default;
-  explicit AliasScopeNode(const MDNode *N) : Node(N) {}
-
-  /// Get the MDNode for this AliasScopeNode.
-  const MDNode *getNode() const { return Node; }
-
-  /// Get the MDNode for this AliasScopeNode's domain.
-  const MDNode *getDomain() const {
-if (Node->getNumOperands() < 2)
-  return nullptr;
-return dyn_cast_or_null(Node->getOperand(1));
-  }
-};
-
-} // end anonymous namespace
-
 AliasResult ScopedNoAliasAAResult::alias(const MemoryLocation ,
  const MemoryLocation ,
  AAQueryInfo ) {

diff  --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index a32d8f420eae..1787899d16a6 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -27,6 +27,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/Analysis/ScopedNoAliasAA.h"
 #include "llvm/IR/Argument.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Constant.h"
@@ -926,7 +927,32 @@ MDNode *MDNode::getMostGenericAliasScope(MDNode *A, MDNode 
*B) {
   if (!A || !B)
 return nullptr;
 
-  return concatenate(A, B);
+  // Take the intersection of domains then union the scopes
+  // within those domains
+  SmallPtrSet ADomains;
+  SmallPtrSet IntersectDomains;
+  SmallSetVector MDs;
+  for (const MDOperand  : A->operands())
+if (const MDNode *NAMD = dyn_cast(MDOp))
+  if (const MDNode *Domain = AliasScopeNode(NAMD).getDomain())
+ADomains.insert(Domain);
+
+  for 

[llvm-branch-commits] [clang] 0e226d0 - [clang-format] [NFC] keep clang-format tests clang-format clean

2020-12-05 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-05T10:15:52Z
New Revision: 0e226d00d21cdefe82ef4d6531e4e73d3b5c0494

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

LOG: [clang-format] [NFC] keep clang-format tests clang-format clean

I use several of the clang-format clean directories as a test suite, this one 
had got slightly out of wack in a prior commit

Reviewed By: HazardyKnusperkeks

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

Added: 


Modified: 
clang/unittests/Format/MacroExpanderTest.cpp

Removed: 




diff  --git a/clang/unittests/Format/MacroExpanderTest.cpp 
b/clang/unittests/Format/MacroExpanderTest.cpp
index b2cd5112b820..7ec98a5e82b7 100644
--- a/clang/unittests/Format/MacroExpanderTest.cpp
+++ b/clang/unittests/Format/MacroExpanderTest.cpp
@@ -65,6 +65,7 @@ class MacroExpanderTest : public ::testing::Test {
   << Context << " in " << text(Tokens) << " at " << File << ":" << 
Line;
 }
   }
+
 protected:
   llvm::SpecificBumpPtrAllocator Allocator;
   std::vector> Buffers;



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


[llvm-branch-commits] [llvm] 3242eae - [NFC][AMDGPU] AMDGPUUsage updates

2020-12-04 Thread via llvm-branch-commits

Author: Tony
Date: 2020-12-05T02:13:17Z
New Revision: 3242eaef27196c717227331bed6a5af31a92b074

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

LOG: [NFC][AMDGPU] AMDGPUUsage updates

- Document code object V2 gfx800.
- Document amdpal is supported by Linux Pro.

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

Added: 


Modified: 
llvm/docs/AMDGPUUsage.rst

Removed: 




diff  --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index ce8a5bad3939..bcb960dd75fb 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -77,7 +77,7 @@ to specify the target triple:
 - AMD's PAL runtime using the *amdhsa* loader on Windows.
 
  ``amdpal`` Graphic shaders and compute kernels executed on AMD's PAL
-runtime using the *amdpal* loader on Windows.
+runtime using the *amdpal* loader on Windows and Linux Pro.
  ``mesa3d`` Graphic shaders and compute kernels executed on Mesa 3D
 runtime.
  == 

@@ -1324,6 +1324,7 @@ are deprecated and should not be used.
  ``AMD:AMDGPU:7:0:3`` ``gfx703``
  ``AMD:AMDGPU:7:0:4`` ``gfx704``
  ``AMD:AMDGPU:7:0:5`` ``gfx705``
+ ``AMD:AMDGPU:8:0:0`` ``gfx801:xnack-``
  ``AMD:AMDGPU:8:0:1`` ``gfx801:xnack+``
  ``AMD:AMDGPU:8:0:2`` ``gfx802``
  ``AMD:AMDGPU:8:0:3`` ``gfx803``



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


[llvm-branch-commits] [mlir] 5f65c4a - Use MlirStringRef in StandardAttributes.h

2020-12-03 Thread via llvm-branch-commits

Author: George
Date: 2020-12-03T16:12:01-08:00
New Revision: 5f65c4a8e6a9fbcbf45ff4cdf0b4815795dd4845

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

LOG: Use MlirStringRef in StandardAttributes.h

Added: 


Modified: 
mlir/include/mlir-c/StandardAttributes.h
mlir/lib/CAPI/IR/StandardAttributes.cpp
mlir/test/CAPI/ir.c

Removed: 




diff  --git a/mlir/include/mlir-c/StandardAttributes.h 
b/mlir/include/mlir-c/StandardAttributes.h
index 20382c3a78cd..39879d8e31ed 100644
--- a/mlir/include/mlir-c/StandardAttributes.h
+++ b/mlir/include/mlir-c/StandardAttributes.h
@@ -79,7 +79,7 @@ mlirDictionaryAttrGetElement(MlirAttribute attr, intptr_t 
pos);
 /** Returns the dictionary attribute element with the given name or NULL if the
  * given name does not exist in the dictionary. */
 MLIR_CAPI_EXPORTED MlirAttribute
-mlirDictionaryAttrGetElementByName(MlirAttribute attr, const char *name);
+mlirDictionaryAttrGetElementByName(MlirAttribute attr, MlirStringRef name);
 
 
//===--===//
 // Floating point attribute.
@@ -155,15 +155,13 @@ MLIR_CAPI_EXPORTED bool 
mlirAttributeIsAOpaque(MlirAttribute attr);
 /** Creates an opaque attribute in the given context associated with the 
dialect
  * identified by its namespace. The attribute contains opaque byte data of the
  * specified length (data need not be null-terminated). */
-MLIR_CAPI_EXPORTED MlirAttribute mlirOpaqueAttrGet(MlirContext ctx,
-   const char 
*dialectNamespace,
-   intptr_t dataLength,
-   const char *data,
-   MlirType type);
+MLIR_CAPI_EXPORTED MlirAttribute
+mlirOpaqueAttrGet(MlirContext ctx, MlirStringRef dialectNamespace,
+  intptr_t dataLength, const char *data, MlirType type);
 
 /** Returns the namespace of the dialect with which the given opaque attribute
  * is associated. The namespace string is owned by the context. */
-MLIR_CAPI_EXPORTED const char *
+MLIR_CAPI_EXPORTED MlirStringRef
 mlirOpaqueAttrGetDialectNamespace(MlirAttribute attr);
 
 /** Returns the raw data as a string reference. The data remains live as long 
as
@@ -178,17 +176,14 @@ MLIR_CAPI_EXPORTED MlirStringRef 
mlirOpaqueAttrGetData(MlirAttribute attr);
 MLIR_CAPI_EXPORTED bool mlirAttributeIsAString(MlirAttribute attr);
 
 /** Creates a string attribute in the given context containing the given 
string.
- * The string need not be null-terminated and its length must be specified. */
+ */
 MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrGet(MlirContext ctx,
-   intptr_t length,
-   const char *data);
+   MlirStringRef str);
 
 /** Creates a string attribute in the given context containing the given 
string.
- * The string need not be null-terminated and its length must be specified.
  * Additionally, the attribute has the given type. */
 MLIR_CAPI_EXPORTED MlirAttribute mlirStringAttrTypedGet(MlirType type,
-intptr_t length,
-const char *data);
+MlirStringRef str);
 
 /** Returns the attribute values as a string reference. The data remains live 
as
  * long as the context in which the attribute lives. */
@@ -203,10 +198,9 @@ MLIR_CAPI_EXPORTED bool 
mlirAttributeIsASymbolRef(MlirAttribute attr);
 
 /** Creates a symbol reference attribute in the given context referencing a
  * symbol identified by the given string inside a list of nested references.
- * Each of the references in the list must not be nested. The string need not 
be
- * null-terminated and its length must be specified. */
+ * Each of the references in the list must not be nested. */
 MLIR_CAPI_EXPORTED MlirAttribute
-mlirSymbolRefAttrGet(MlirContext ctx, intptr_t length, const char *symbol,
+mlirSymbolRefAttrGet(MlirContext ctx, MlirStringRef symbol,
  intptr_t numReferences, MlirAttribute const *references);
 
 /** Returns the string reference to the root referenced symbol. The data 
remains
@@ -236,11 +230,9 @@ mlirSymbolRefAttrGetNestedReference(MlirAttribute attr, 
intptr_t pos);
 MLIR_CAPI_EXPORTED bool mlirAttributeIsAFlatSymbolRef(MlirAttribute attr);
 
 /** Creates a flat symbol reference attribute in the given context referencing 
a
- * symbol identified by the given string. The string need not be 
null-terminated
- * and its length must be specified. */
+ * symbol 

[llvm-branch-commits] [flang] f99e90f - Revert "[flang][openacc] Add clause validity tests for the update directive"

2020-12-04 Thread via llvm-branch-commits

Author: clementval
Date: 2020-12-04T15:06:22-05:00
New Revision: f99e90f2c38bbee679a64dcfc0a892cd549d0a61

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

LOG: Revert "[flang][openacc] Add clause validity tests for the update 
directive"

This reverts commit e46065433466eec50903fec6f40a09cf26fa801e.

Added: 


Modified: 
flang/lib/Semantics/check-acc-structure.cpp
flang/test/Semantics/acc-clause-validity.f90

Removed: 




diff  --git a/flang/lib/Semantics/check-acc-structure.cpp 
b/flang/lib/Semantics/check-acc-structure.cpp
index 74b608f9ca6d..edcb41eae0c5 100644
--- a/flang/lib/Semantics/check-acc-structure.cpp
+++ b/flang/lib/Semantics/check-acc-structure.cpp
@@ -201,8 +201,6 @@ void AccStructureChecker::Leave(const 
parser::OpenACCStandaloneConstruct ) {
 CheckRequireAtLeastOneOf();
 break;
   case llvm::acc::Directive::ACCD_update:
-// Restriction - line 2636
-CheckRequireAtLeastOneOf();
 // Restriction - 2301
 CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
 updateOnlyAllowedAfterDeviceTypeClauses);

diff  --git a/flang/test/Semantics/acc-clause-validity.f90 
b/flang/test/Semantics/acc-clause-validity.f90
index 7508aab5eedf..b2fb57796f3f 100644
--- a/flang/test/Semantics/acc-clause-validity.f90
+++ b/flang/test/Semantics/acc-clause-validity.f90
@@ -138,37 +138,9 @@ program openacc_clause_validity
   !ERROR: Unmatched PARALLEL directive
   !$acc end parallel
 
-  !ERROR: At least one of DEVICE, HOST, SELF clause must appear on the UPDATE 
directive
-  !$acc update
-
   !$acc update self(a, f) host(g) device(h)
 
-  !$acc update host(aa) async(1)
-
-  !$acc update device(bb) async(async1)
-
-  !ERROR: At most one ASYNC clause can appear on the UPDATE directive
-  !$acc update host(aa, bb) async(1) async(2)
-
-  !$acc update self(bb, cc(:)) wait(1)
-
-  !$acc update device(aa, bb, cc) wait(wait1)
-
-  !$acc update host(aa) host(bb) device(cc) wait(1,2)
-
-  !$acc update device(aa, cc) wait(wait1, wait2)
-
-  !$acc update device(aa) device_type(*) async
-
-  !$acc update host(bb) device_type(*) wait
-
-  !$acc update self(cc) device_type(1,2) async device_type(3) wait
-
-  !ERROR: At most one IF clause can appear on the UPDATE directive
-  !$acc update device(aa) if(.true.) if(ifCondition)
-
-  !ERROR: At most one IF_PRESENT clause can appear on the UPDATE directive
-  !$acc update device(bb) if_present if_present
+  !$acc update device(i) device_type(*) async
 
   !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the UPDATE 
directive
   !$acc update device(i) device_type(*) if(.TRUE.)



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


[llvm-branch-commits] [clang] 88c21f8 - [clang-format] NFC update in the overall clang-formatted status

2020-12-04 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-04T20:10:10Z
New Revision: 88c21f8488646b6809d46c197077cfb40b5ac15b

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

LOG: [clang-format] NFC  update in the overall clang-formatted status

The current state of the clang-formatted-ness of the LLVM project hasn't been 
updated since June bring it upto date

Added: 


Modified: 
clang/docs/ClangFormattedStatus.rst

Removed: 




diff  --git a/clang/docs/ClangFormattedStatus.rst 
b/clang/docs/ClangFormattedStatus.rst
index 3e348eadd4ff..108351c16931 100644
--- a/clang/docs/ClangFormattedStatus.rst
+++ b/clang/docs/ClangFormattedStatus.rst
@@ -17,7 +17,7 @@ Clang Formatted Status
 ==
 
 :doc:`ClangFormattedStatus` describes the state of LLVM source
-tree in terms of conformance to :doc:`ClangFormat` as of: June 27, 2020 
11:36:24 (`eb50838ba08 
`_).
+tree in terms of conformance to :doc:`ClangFormat` as of: December 04, 2020 
17:56:14 (`840e651dc6d 
`_).
 
 
 .. list-table:: LLVM Clang-Format Status
@@ -49,6 +49,11 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 27, 2020 11:36:24
  - `0`
  - `1`
  - :none:`0%`
+   * - clang/examples/CallSuperAttribute
+ - `1`
+ - `1`
+ - `0`
+ - :good:`100%`
* - clang/examples/clang-interpreter
  - `1`
  - `0`
@@ -60,10 +65,10 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 27, 2020 11:36:24
  - `1`
  - :none:`0%`
* - clang/include/clang/Analysis
- - `14`
- - `3`
+ - `15`
+ - `4`
  - `11`
- - :part:`21%`
+ - :part:`26%`
* - clang/include/clang/Analysis/Analyses
  - `14`
  - `2`
@@ -84,30 +89,35 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 27, 2020 11:36:24
  - `0`
  - `1`
  - :none:`0%`
+   * - clang/include/clang/APINotes
+ - `2`
+ - `2`
+ - `0`
+ - :good:`100%`
* - clang/include/clang/ARCMigrate
  - `3`
  - `0`
  - `3`
  - :none:`0%`
* - clang/include/clang/AST
- - `113`
- - `20`
+ - `114`
+ - `21`
  - `93`
- - :part:`17%`
+ - :part:`18%`
* - clang/include/clang/ASTMatchers
  - `5`
- - `1`
- - `4`
- - :part:`20%`
+ - `0`
+ - `5`
+ - :none:`0%`
* - clang/include/clang/ASTMatchers/Dynamic
  - `4`
  - `1`
  - `3`
  - :part:`25%`
* - clang/include/clang/Basic
- - `76`
- - `26`
- - `50`
+ - `78`
+ - `27`
+ - `51`
  - :part:`34%`
* - clang/include/clang/CodeGen
  - `9`
@@ -126,9 +136,9 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 27, 2020 11:36:24
  - :good:`100%`
* - clang/include/clang/Driver
  - `17`
- - `4`
- - `13`
- - :part:`23%`
+ - `5`
+ - `12`
+ - :part:`29%`
* - clang/include/clang/Edit
  - `5`
  - `1`
@@ -154,6 +164,11 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 27, 2020 11:36:24
  - `2`
  - `5`
  - :part:`28%`
+   * - clang/include/clang/IndexSerialization
+ - `1`
+ - `1`
+ - `0`
+ - :good:`100%`
* - clang/include/clang/Lex
  - `29`
  - `4`
@@ -201,17 +216,17 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 27, 2020 11:36:24
  - :part:`25%`
* - clang/include/clang/StaticAnalyzer/Core/PathSensitive
  - `36`
- - `9`
- - `27`
- - :part:`25%`
+ - `10`
+ - `26`
+ - :part:`27%`
* - clang/include/clang/StaticAnalyzer/Frontend
  - `5`
- - `3`
  - `2`
- - :part:`60%`
+ - `3`
+ - :part:`40%`
* - clang/include/clang/Testing
- - `1`
- - `1`
+ - `2`
+ - `2`
  - `0`
  - :good:`100%`
* - clang/include/clang/Tooling
@@ -225,10 +240,10 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 27, 2020 11:36:24
  - `0`
  - :good:`100%`
* - clang/include/clang/Tooling/Core
- - `3`
- - `1`
  - `2`
- - :part:`33%`
+ - `0`
+ - `2`
+ - :none:`0%`
* - clang/include/clang/Tooling/DependencyScanning
  - `5`
  - `4`
@@ -240,10 +255,10 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 27, 2020 11:36:24
  - `2`
  - :none:`0%`
* - clang/include/clang/Tooling/Refactoring
- - `14`
- - `12`
+ - `15`
+ - `13`
  - `2`
- - :part:`85%`
+ - :part:`86%`
* - clang/include/clang/Tooling/Refactoring/Extract
  - `2`
  - `1`
@@ -265,20 +280,20 @@ tree in terms of conformance to :doc:`ClangFormat` as of: 
June 27, 2020 11:36:24
  - `1`
  - :part:`87%`
* - 

[llvm-branch-commits] [clang] 6333871 - Add diagnostic for for-range-declaration being specificed with thread_local

2020-12-04 Thread via llvm-branch-commits

Author: shafik
Date: 2020-12-04T15:06:35-08:00
New Revision: 6333871f85403d07abc62fdb6182f288ff60ccd8

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

LOG: Add diagnostic for for-range-declaration being specificed with thread_local

Currently we have a diagnostic that catches the other storage class specifies 
for the range based for loop declaration but we miss the thread_local case. 
This changes adds a diagnostic for that case as well.

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

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDecl.cpp
clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 23f374987c92..f51ef849b932 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2448,7 +2448,7 @@ def err_for_range_decl_must_be_var : Error<
   "for range declaration must declare a variable">;
 def err_for_range_storage_class : Error<
   "loop variable %0 may not be declared %select{'extern'|'static'|"
-  "'__private_extern__'|'auto'|'register'|'constexpr'}1">;
+  "'__private_extern__'|'auto'|'register'|'constexpr'|'thread_local'}1">;
 def err_type_defined_in_for_range : Error<
   "types may not be defined in a for range declaration">;
 def err_for_range_deduction_failure : Error<

diff  --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index dc11dacb2491..0031f874c05a 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -12782,6 +12782,18 @@ void Sema::ActOnCXXForRangeDecl(Decl *D) {
 Error = 4;
 break;
   }
+
+  // for-range-declaration cannot be given a storage class specifier con't.
+  switch (VD->getTSCSpec()) {
+  case TSCS_thread_local:
+Error = 6;
+break;
+  case TSCS___thread:
+  case TSCS__Thread_local:
+  case TSCS_unspecified:
+break;
+  }
+
   if (Error != -1) {
 Diag(VD->getOuterLocStart(), diag::err_for_range_storage_class)
 << VD << Error;

diff  --git a/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp 
b/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
index 7c95a3ca88eb..1c6aeeefe006 100644
--- a/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
+++ b/clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
@@ -151,6 +151,7 @@ void g() {
 
   for (extern int a : A()) {} // expected-error {{loop variable 'a' may not be 
declared 'extern'}}
   for (static int a : A()) {} // expected-error {{loop variable 'a' may not be 
declared 'static'}}
+  for (thread_local int a : A()) {} // expected-error {{loop variable 'a' may 
not be declared 'thread_local'}}
   for (register int a : A()) {} // expected-error {{loop variable 'a' may not 
be declared 'register'}} expected-warning 0-1{{register}} expected-error 
0-1{{register}}
   for (constexpr int a : X::C()) {} // OK per CWG issue #1204.
 



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


[llvm-branch-commits] [llvm] a366188 - [flang][openacc] Add clause validaty tests for data construct + fix default restriction

2020-12-04 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-04T15:12:15-05:00
New Revision: a366188d801ccefb4ef3f9d89415e97accc77443

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

LOG: [flang][openacc] Add clause validaty tests for data construct + fix 
default restriction

Add clause validity tests for the data construct. The default clause can appear 
only once
and this was not enforce in the ACC.td.

Reviewed By: sameeranjoshi

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

Added: 


Modified: 
flang/test/Semantics/acc-clause-validity.f90
llvm/include/llvm/Frontend/OpenACC/ACC.td

Removed: 




diff  --git a/flang/test/Semantics/acc-clause-validity.f90 
b/flang/test/Semantics/acc-clause-validity.f90
index b2fb57796f3f..64e6ca887b6c 100644
--- a/flang/test/Semantics/acc-clause-validity.f90
+++ b/flang/test/Semantics/acc-clause-validity.f90
@@ -131,7 +131,42 @@ program openacc_clause_validity
   !$acc data
   !$acc end data
 
-  !$acc data copyin(i)
+  !$acc data copy(aa) if(.true.)
+  !$acc end data
+
+  !$acc data copy(aa) if(ifCondition)
+  !$acc end data
+
+  !$acc data copy(aa, bb, cc)
+  !$acc end data
+
+  !$acc data copyin(aa) copyin(readonly: bb) copyout(cc)
+  !$acc end data
+
+  !$acc data copyin(readonly: aa, bb) copyout(zero: cc)
+  !$acc end data
+
+  !$acc data create(aa, bb(:,:)) create(zero: cc(:,:))
+  !$acc end data
+
+  !$acc data no_create(aa) present(bb, cc)
+  !$acc end data
+
+  !$acc data deviceptr(aa) attach(bb, cc)
+  !$acc end data
+
+  !$acc data copy(aa, bb) default(none)
+  !$acc end data
+
+  !$acc data copy(aa, bb) default(present)
+  !$acc end data
+
+  !ERROR: At most one DEFAULT clause can appear on the DATA directive
+  !$acc data copy(aa, bb) default(none) default(present)
+  !$acc end data
+
+  !ERROR: At most one IF clause can appear on the DATA directive
+  !$acc data copy(aa) if(.true.) if(ifCondition)
   !$acc end data
 
   !$acc data copyin(i)

diff  --git a/llvm/include/llvm/Frontend/OpenACC/ACC.td 
b/llvm/include/llvm/Frontend/OpenACC/ACC.td
index 10fe344e0ea0..eaca44f6b158 100644
--- a/llvm/include/llvm/Frontend/OpenACC/ACC.td
+++ b/llvm/include/llvm/Frontend/OpenACC/ACC.td
@@ -257,7 +257,8 @@ def ACC_Atomic : Directive<"atomic"> {}
 // 2.6.5
 def ACC_Data : Directive<"data"> {
   let allowedOnceClauses = [
-VersionedClause
+VersionedClause,
+VersionedClause
   ];
   let requiredClauses = [
 VersionedClause,



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


[llvm-branch-commits] [clang] 8668eae - [clang-format] Add option for case sensitive regexes for sorted includes

2020-12-05 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-05T16:33:21Z
New Revision: 8668eae2adf23209e3f8d19477725eb7e73ba93c

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

LOG: [clang-format] Add option for case sensitive regexes for sorted includes

I think the title says everything.

Reviewed By: MyDeveloperDay

Patch By:  HazardyKnusperkeks

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

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Tooling/Inclusions/IncludeStyle.h
clang/lib/Format/Format.cpp
clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
clang/lib/Tooling/Inclusions/IncludeStyle.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/SortIncludesTest.cpp

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index d6d437a0a05e..55d706fe 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -1719,6 +1719,9 @@ the configuration (without a prefix: ``Auto``).
   priority for order.``SortPriority`` is set to the value of ``Priority``
   as default if it is not assigned.
 
+  Each regular expression can be marked as case sensitive with the field
+  ``CaseSensitive``, per default it is not.
+
   To configure this in the .clang-format file, use:
 
   .. code-block:: yaml
@@ -1727,6 +1730,7 @@ the configuration (without a prefix: ``Auto``).
   - Regex:   '^"(llvm|llvm-c|clang|clang-c)/'
 Priority:2
 SortPriority:2
+CaseSensitive:   true
   - Regex:   '^(<|"(gtest|gmock|isl|json)/)'
 Priority:3
   - Regex:   '<[[:alnum:].]+>'

diff  --git a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h 
b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
index 2648297724e1..89b0d4635251 100644
--- a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
+++ b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
@@ -60,8 +60,11 @@ struct IncludeStyle {
 int Priority;
 /// The custom priority to sort before grouping.
 int SortPriority;
+/// If the regular expression is case sensitive.
+bool RegexIsCaseSensitive;
 bool operator==(const IncludeCategory ) const {
-  return Regex == Other.Regex && Priority == Other.Priority;
+  return Regex == Other.Regex && Priority == Other.Priority &&
+ RegexIsCaseSensitive == Other.RegexIsCaseSensitive;
 }
   };
 
@@ -84,20 +87,25 @@ struct IncludeStyle {
   /// (https://llvm.org/docs/CodingStandards.html#include-style). However, you
   /// can also assign negative priorities if you have certain headers that
   /// always need to be first.
-  /// 
+  ///
   /// There is a third and optional field ``SortPriority`` which can used while
-  /// ``IncludeBloks = IBS_Regroup`` to define the priority in which 
``#includes``
-  /// should be ordered, and value of ``Priority`` defines the order of
+  /// ``IncludeBloks = IBS_Regroup`` to define the priority in which
+  /// ``#includes`` should be ordered, and value of ``Priority`` defines the
+  /// order of
   /// ``#include blocks`` and also enables to group ``#includes`` of 
diff erent
   /// priority for order.``SortPriority`` is set to the value of ``Priority``
   /// as default if it is not assigned.
   ///
+  /// Each regular expression can be marked as case sensitive with the field
+  /// ``CaseSensitive``, per default it is not.
+  ///
   /// To configure this in the .clang-format file, use:
   /// \code{.yaml}
   ///   IncludeCategories:
   /// - Regex:   '^"(llvm|llvm-c|clang|clang-c)/'
   ///   Priority:2
   ///   SortPriority:2
+  ///   CaseSensitive:   true
   /// - Regex:   '^(<|"(gtest|gmock|isl|json)/)'
   ///   Priority:3
   /// - Regex:   '<[[:alnum:].]+>'

diff  --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index f5ae35131ace..a3f740ff8692 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -916,9 +916,9 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.ForEachMacros.push_back("Q_FOREACH");
   LLVMStyle.ForEachMacros.push_back("BOOST_FOREACH");
   LLVMStyle.IncludeStyle.IncludeCategories = {
-  {"^\"(llvm|llvm-c|clang|clang-c)/", 2, 0},
-  {"^(<|\"(gtest|gmock|isl|json)/)", 3, 0},
-  {".*", 1, 0}};
+  {"^\"(llvm|llvm-c|clang|clang-c)/", 2, 0, false},
+  {"^(<|\"(gtest|gmock|isl|json)/)", 3, 0, false},
+  {".*", 1, 0, false}};
   LLVMStyle.IncludeStyle.IncludeIsMainRegex = "(Test)?$";
   LLVMStyle.IncludeStyle.IncludeBlocks = tooling::IncludeStyle::IBS_Preserve;
   LLVMStyle.IndentCaseLabels = false;
@@ -1016,10 +1016,10 @@ 

[llvm-branch-commits] [llvm] 9737c12 - [llvmbuildectomy] removed vestigial LLVMBuild.txt files

2020-12-05 Thread via llvm-branch-commits

Author: Chris Sears
Date: 2020-12-05T22:00:22+01:00
New Revision: 9737c128f14d60f73b1d198453801a05b37c6b28

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

LOG: [llvmbuildectomy] removed vestigial LLVMBuild.txt files

LLVMBuild has been removed from the build system. However, three LLVMBuild.txt
files remain in the tree. This patch simply removes them.

llvm/lib/ExecutionEngine/Orc/TargetProcess/LLVMBuild.txt
llvm/tools/llvm-jitlink/llvm-jitlink-executor/LLVMBuild.txt
llvm/tools/llvm-profgen/LLVMBuild.txt

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

Added: 


Modified: 


Removed: 
llvm/lib/ExecutionEngine/Orc/TargetProcess/LLVMBuild.txt
llvm/tools/llvm-jitlink/llvm-jitlink-executor/LLVMBuild.txt
llvm/tools/llvm-profgen/LLVMBuild.txt



diff  --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/LLVMBuild.txt 
b/llvm/lib/ExecutionEngine/Orc/TargetProcess/LLVMBuild.txt
deleted file mode 100644
index 781e6188a702..
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/LLVMBuild.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-;===- ./lib/ExecutionEngine/OrcTargetProcess/LLVMBuild.txt -*- Conf 
-*--===;
-;
-; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-; See https://llvm.org/LICENSE.txt for license information.
-; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-;
-;======;
-;
-; This is an LLVMBuild description file for the components in this 
subdirectory.
-;
-; For more information on the LLVMBuild system, please see:
-;
-;   http://llvm.org/docs/LLVMBuild.html
-;
-;======;
-
-[component_0]
-type = Library
-name = OrcTargetProcess
-parent = OrcJIT
-required_libraries = OrcShared Support

diff  --git a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/LLVMBuild.txt 
b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/LLVMBuild.txt
deleted file mode 100644
index 0d96143673dd..
--- a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/LLVMBuild.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-;===- ./tools/llvm-jitlink/llvm-jitlink-executor/LLVMBuild.txt -*- Conf 
-*--===;
-;
-; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-; See https://llvm.org/LICENSE.txt for license information.
-; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-;
-;======;
-;
-; This is an LLVMBuild description file for the components in this 
subdirectory.
-;
-; For more information on the LLVMBuild system, please see:
-;
-;   http://llvm.org/docs/LLVMBuild.html
-;
-;======;
-
-[component_0]
-type = Tool
-name = llvm-jitlink-executor
-parent = llvm-jitlink
-required_libraries = OrcTargetProcess Support

diff  --git a/llvm/tools/llvm-profgen/LLVMBuild.txt 
b/llvm/tools/llvm-profgen/LLVMBuild.txt
deleted file mode 100644
index 70b2c3109872..
--- a/llvm/tools/llvm-profgen/LLVMBuild.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-;===- ./tools/llvm-profgen/LLVMBuild.txt --*- Conf -*--===;
-;
-; Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-; See https://llvm.org/LICENSE.txt for license information.
-; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-;
-;======;
-;
-; This is an LLVMBuild description file for the components in this 
subdirectory.
-;
-; For more information on the LLVMBuild system, please see:
-;
-;   http://llvm.org/docs/LLVMBuild.html
-;
-;======;
-
-[component_0]
-type = Tool
-name = llvm-profgen
-parent = Tools
-required_libraries = DebugInfoDWARF MC MCDisassembler MCParser Object 
all-targets Demangle Support



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


[llvm-branch-commits] [llvm] 1f05b1a - [CSSPGO][llvm-profgen] Context-sensitive profile data generation

2020-12-07 Thread via llvm-branch-commits

Author: wlei
Date: 2020-12-07T13:48:58-08:00
New Revision: 1f05b1a9f527e19fb1d7cf17689c41b7951af056

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

LOG: [CSSPGO][llvm-profgen] Context-sensitive profile data generation

This stack of changes introduces `llvm-profgen` utility which generates a 
profile data file from given perf script data files for sample-based PGO. It’s 
part of(not only) the CSSPGO work. Specifically to support context-sensitive 
with/without pseudo probe profile, it implements a series of functionalities 
including perf trace parsing, instruction symbolization, LBR stack/call frame 
stack unwinding, pseudo probe decoding, etc. Also high throughput is achieved 
by multiple levels of sample aggregation and compatible format with one stop is 
generated at the end. Please refer to: 
https://groups.google.com/g/llvm-dev/c/1p1rdYbL93s for the CSSPGO RFC.

This change supports context-sensitive profile data generation into 
llvm-profgen. With simultaneous sampling for LBR and call stack, we can 
identify leaf of LBR sample with calling context from stack sample . During the 
process of deriving fall through path from LBR entries, we unwind LBR by 
replaying all the calls and returns (including implicit calls/returns due to 
inlining) backwards on top of the sampled call stack. Then the state of call 
stack as we unwind through LBR always represents the calling context of current 
fall through path.

we have two types of virtual unwinding 1) LBR unwinding and 2) linear range 
unwinding.
Specifically, for each LBR entry which can be classified into call, return, 
regular branch, LBR unwinding will replay the operation by pushing, popping or 
switching leaf frame towards the call stack and since the initial call stack is 
most recently sampled, the replay should be in anti-execution order, i.e. for 
the regular case, pop the call stack when LBR is call, push frame on call stack 
when LBR is return. After each LBR processed, it also needs to align with the 
next LBR by going through instructions from previous LBR's target to current 
LBR's source, which we named linear unwinding. As instruction from linear range 
can come from different function by inlining, linear unwinding will do the 
range splitting and record counters through the range with same inline context.

With each fall through path from LBR unwinding, we aggregate each sample into 
counters by the calling context and eventually generate full context sensitive 
profile (without relying on inlining) to driver compiler's PGO/FDO.

A breakdown of noteworthy changes:
- Added `HybridSample` class as the abstraction perf sample including LBR stack 
and call stack
* Extended `PerfReader` to implement auto-detect whether input perf script 
output contains CS profile, then do the parsing. Multiple `HybridSample` are 
extracted
* Speed up by aggregating  `HybridSample` into `AggregatedSamples`
* Added VirtualUnwinder that consumes aggregated  `HybridSample` and implements 
unwinding of calls, returns, and linear path that contains implicit call/return 
from inlining. Ranges and branches counters are aggregated by the calling 
context.
 Here calling context is string type, each context is a pair of 
function name and callsite location info, the whole context is like `main:1 @ 
foo:2 @ bar`.
* Added PorfileGenerater that accumulates counters by ranges unfolding or 
branch target mapping, then generates context-sensitive function profile 
including function body, inferring callee's head sample, callsite target 
samples, eventually records into ProfileMap.

* Leveraged LLVM build-in(`SampleProfWriter`) writer to support different 
serialization format with no stop
- `getCanonicalFnName` for callee name and name from ELF section
- Added regression test for both unwinding and profile generation

Test Plan:
ninja & ninja check-llvm

Reviewed By: hoy, wenlei, wmi

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

Added: 
llvm/test/tools/llvm-profgen/Inputs/inline-cs-noprobe.perfbin
llvm/test/tools/llvm-profgen/Inputs/inline-cs-noprobe.perfscript
llvm/test/tools/llvm-profgen/Inputs/noinline-cs-noprobe.perfbin
llvm/test/tools/llvm-profgen/Inputs/noinline-cs-noprobe.perfscript
llvm/test/tools/llvm-profgen/inline-cs-noprobe.test
llvm/test/tools/llvm-profgen/noinline-cs-noprobe.test
llvm/tools/llvm-profgen/ProfileGenerator.cpp
llvm/tools/llvm-profgen/ProfileGenerator.h

Modified: 
llvm/docs/CommandGuide/llvm-profgen.rst
llvm/include/llvm/ProfileData/SampleProf.h
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/tools/llvm-profgen/CMakeLists.txt
llvm/tools/llvm-profgen/PerfReader.cpp
llvm/tools/llvm-profgen/PerfReader.h
llvm/tools/llvm-profgen/ProfiledBinary.cpp
llvm/tools/llvm-profgen/ProfiledBinary.h
llvm/tools/llvm-profgen/llvm-profgen.cpp


[llvm-branch-commits] [llvm] 7af8029 - [CodeGen] Add text section prefix for COFF object file

2020-12-08 Thread via llvm-branch-commits

Author: Pan, Tao
Date: 2020-12-08T18:56:21+08:00
New Revision: 7af802994eb0521e1b00eda95303f21e874d9f22

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

LOG: [CodeGen] Add text section prefix for COFF object file

Text section prefix is created in CodeGenPrepare, it's file format independent 
implementation,  text section name is written into object file in 
TargetLoweringObjectFile, it's file format dependent implementation, port code 
of adding text section prefix to text section name from ELF to COFF.
Different with ELF that use '.' as concatenation character, COFF use '$' as 
concatenation character. That is, concatenation character is variable, so split 
concatenation character from text section prefix.
Text section prefix is existing feature of ELF, it can help to reduce icache 
and itlb misses, it's also make possible aggregate other compilers e.g. v8 
created same prefix sections. Furthermore, the recent feature Machine Function 
Splitter (basic block level text prefix section) is based on text section 
prefix.

Reviewed By: pengfei, rnk

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

Added: 
llvm/test/CodeGen/X86/text-section-prefix.ll

Modified: 
llvm/include/llvm/ProfileData/ProfileCommon.h
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/CodeGen/MachineFunctionSplitter.cpp
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/test/CodeGen/X86/machine-function-splitter.ll
llvm/test/CodeGen/X86/mingw-comdats.ll
llvm/test/Transforms/CodeGenPrepare/X86/section-samplepgo.ll
llvm/test/Transforms/CodeGenPrepare/X86/section.ll
llvm/test/Transforms/HotColdSplit/coldentrycount.ll
llvm/test/Transforms/SampleProfile/section-accurate-samplepgo.ll

Removed: 




diff  --git a/llvm/include/llvm/ProfileData/ProfileCommon.h 
b/llvm/include/llvm/ProfileData/ProfileCommon.h
index 14c305b3d0c0..6bb5825339ae 100644
--- a/llvm/include/llvm/ProfileData/ProfileCommon.h
+++ b/llvm/include/llvm/ProfileData/ProfileCommon.h
@@ -33,8 +33,8 @@ class FunctionSamples;
 
 } // end namespace sampleprof
 
-inline const char *getHotSectionPrefix() { return ".hot"; }
-inline const char *getUnlikelySectionPrefix() { return ".unlikely"; }
+inline const char *getHotSectionPrefix() { return "hot"; }
+inline const char *getUnlikelySectionPrefix() { return "unlikely"; }
 
 class ProfileSummaryBuilder {
 private:

diff  --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp 
b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 40e92b9e0a4a..9b44b30e7a1b 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -473,12 +473,12 @@ bool CodeGenPrepare::runOnFunction(Function ) {
   OptSize = F.hasOptSize();
   if (ProfileGuidedSectionPrefix) {
 if (PSI->isFunctionHotInCallGraph(, *BFI))
-  F.setSectionPrefix(".hot");
+  F.setSectionPrefix("hot");
 else if (PSI->isFunctionColdInCallGraph(, *BFI))
-  F.setSectionPrefix(".unlikely");
+  F.setSectionPrefix("unlikely");
 else if (ProfileUnknownInSpecialSection && PSI->hasPartialSampleProfile() 
&&
  PSI->isFunctionHotnessUnknown(F))
-  F.setSectionPrefix(".unknown");
+  F.setSectionPrefix("unknown");
   }
 
   /// This optimization identifies DIV instructions that can be

diff  --git a/llvm/lib/CodeGen/MachineFunctionSplitter.cpp 
b/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
index b2f474afea99..483809a8ed96 100644
--- a/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
+++ b/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
@@ -107,8 +107,8 @@ bool 
MachineFunctionSplitter::runOnMachineFunction(MachineFunction ) {
   // or functions of unknown hotness. Lukewarm functions have no prefix.
   Optional SectionPrefix = MF.getFunction().getSectionPrefix();
   if (SectionPrefix.hasValue() &&
-  (SectionPrefix.getValue().equals(".unlikely") ||
-   SectionPrefix.getValue().equals(".unknown"))) {
+  (SectionPrefix.getValue().equals("unlikely") ||
+   SectionPrefix.getValue().equals("unknown"))) {
 return false;
   }
 

diff  --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp 
b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 4c8caa0497e4..2e32eabba53d 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -621,7 +621,7 @@ getELFSectionNameForGlobal(const GlobalObject *GO, 
SectionKind Kind,
   bool HasPrefix = false;
   if (const auto *F = dyn_cast(GO)) {
 if (Optional Prefix = F->getSectionPrefix()) {
-  Name += *Prefix;
+  raw_svector_ostream(Name) << '.' << *Prefix;
   HasPrefix = true;
 }
   }
@@ -1573,6 +1573,10 @@ MCSection 
*TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
   MCSymbol *Sym = TM.getSymbol(ComdatGV);
   StringRef 

[llvm-branch-commits] [llvm] eea67ba - [llvm-profgen][NFC] Fix test failure by making unwinder's output deterministic

2020-12-07 Thread via llvm-branch-commits

Author: wlei
Date: 2020-12-07T22:36:25-08:00
New Revision: eea67baf8706d82268d26e908cf5415c5af114ff

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

LOG: [llvm-profgen][NFC] Fix test failure by making unwinder's output 
deterministic

Don't know why under Sanitizer build(asan/msan/ubsan), the 
`std::unordered_map`'s output order is reversed, make the 
regression test failed.

This change creates a workaround by using sorted container to make the output 
deterministic.

Reviewed By: hoy, wenlei

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

Added: 


Modified: 
llvm/test/tools/llvm-profgen/inline-cs-noprobe.test
llvm/tools/llvm-profgen/PerfReader.cpp

Removed: 




diff  --git a/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test 
b/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test
index 649e27e2a131..98767a9b29b7 100644
--- a/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test
+++ b/llvm/test/tools/llvm-profgen/inline-cs-noprobe.test
@@ -10,13 +10,14 @@
 ; CHECK: 1: 14
 
 ; CHECK-UNWINDER: Binary(inline-cs-noprobe.perfbin)'s Range Counter:
-; CHECK-UNWINDER: main:1 @ foo:3.2 @ bar
-; CHECK-UNWINDER:   (6af, 6bb): 14
 ; CHECK-UNWINDER: main:1 @ foo
 ; CHECK-UNWINDER:   (670, 6ad): 1
 ; CHECK-UNWINDER:   (67e, 69b): 1
 ; CHECK-UNWINDER:   (67e, 6ad): 13
 ; CHECK-UNWINDER:   (6bd, 6c8): 14
+; CHECK-UNWINDER: main:1 @ foo:3.2 @ bar
+; CHECK-UNWINDER:   (6af, 6bb): 14
+
 
 ; CHECK-UNWINDER: Binary(inline-cs-noprobe.perfbin)'s Branch Counter:
 ; CHECK-UNWINDER: main:1 @ foo

diff  --git a/llvm/tools/llvm-profgen/PerfReader.cpp 
b/llvm/tools/llvm-profgen/PerfReader.cpp
index e6625d11fd5f..6a0d54e2de87 100644
--- a/llvm/tools/llvm-profgen/PerfReader.cpp
+++ b/llvm/tools/llvm-profgen/PerfReader.cpp
@@ -199,7 +199,10 @@ ProfiledBinary *PerfReader::getBinary(uint64_t Address) {
 }
 
 static void printSampleCounter(ContextRangeCounter ) {
-  for (auto Range : Counter) {
+  // Use ordered map to make the output deterministic
+  std::map OrderedCounter(Counter.begin(),
+Counter.end());
+  for (auto Range : OrderedCounter) {
 outs() << Range.first << "\n";
 for (auto I : Range.second) {
   outs() << "  (" << format("%" PRIx64, I.first.first) << ", "



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


[llvm-branch-commits] [flang] 1dd24e6 - [flang][openacc] Add clause validity tests for the update directive

2020-12-08 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-08T10:47:06-05:00
New Revision: 1dd24e6ab7a70242edfa4139441bfe7753892b4e

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

LOG: [flang][openacc] Add clause validity tests for the update directive

Add couple of clause validity tests for the update directive and check for
the restriction where at least self, host or device clause must appear on the 
directive.

Reviewed By: sameeranjoshi

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

Added: 


Modified: 
flang/include/flang/Parser/dump-parse-tree.h
flang/include/flang/Parser/parse-tree.h
flang/lib/Lower/OpenACC.cpp
flang/lib/Parser/openacc-parsers.cpp
flang/lib/Semantics/check-acc-structure.cpp
flang/test/Semantics/acc-clause-validity.f90
llvm/include/llvm/Frontend/OpenACC/ACC.td

Removed: 




diff  --git a/flang/include/flang/Parser/dump-parse-tree.h 
b/flang/include/flang/Parser/dump-parse-tree.h
index 61c5bddc0afb..c86c2ec6e66b 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -85,6 +85,7 @@ class ParseTreeDumper {
   NODE_ENUM(parser::AccReductionOperator, Operator)
   NODE(parser, AccSizeExpr)
   NODE(parser, AccSizeExprList)
+  NODE(parser, AccSelfClause)
   NODE(parser, AccStandaloneDirective)
   NODE(parser, AccTileExpr)
   NODE(parser, AccTileExprList)

diff  --git a/flang/include/flang/Parser/parse-tree.h 
b/flang/include/flang/Parser/parse-tree.h
index 2dcb92b4a725..c990ddd5c915 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3873,6 +3873,12 @@ struct AccSizeExprList {
   WRAPPER_CLASS_BOILERPLATE(AccSizeExprList, std::list);
 };
 
+struct AccSelfClause {
+  UNION_CLASS_BOILERPLATE(AccSelfClause);
+  std::variant, AccObjectList> u;
+  CharBlock source;
+};
+
 struct AccGangArgument {
   TUPLE_CLASS_BOILERPLATE(AccGangArgument);
   std::tuple, std::optional> t;

diff  --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index f9a60ca77174..6f45bb623d7d 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -335,13 +335,18 @@ genACCParallelOp(Fortran::lower::AbstractConverter 
,
   firOpBuilder.getI1Type(), cond);
 } else if (const auto *selfClause =
std::get_if()) {
-  if (selfClause->v) {
-Value cond = fir::getBase(converter.genExprValue(
-*Fortran::semantics::GetExpr(*(selfClause->v;
-selfCond = firOpBuilder.createConvert(currentLocation,
-  firOpBuilder.getI1Type(), cond);
-  } else {
-addSelfAttr = true;
+  const Fortran::parser::AccSelfClause  = selfClause->v;
+  if (const auto *optCondition =
+  std::get_if>(
+  )) {
+if (*optCondition) {
+  Value cond = fir::getBase(converter.genExprValue(
+  *Fortran::semantics::GetExpr(*optCondition)));
+  selfCond = firOpBuilder.createConvert(currentLocation,
+firOpBuilder.getI1Type(), 
cond);
+} else {
+  addSelfAttr = true;
+}
   }
 } else if (const auto *copyClause =
std::get_if()) {

diff  --git a/flang/lib/Parser/openacc-parsers.cpp 
b/flang/lib/Parser/openacc-parsers.cpp
index 510b80277138..bba886f2fbfd 100644
--- a/flang/lib/Parser/openacc-parsers.cpp
+++ b/flang/lib/Parser/openacc-parsers.cpp
@@ -98,13 +98,8 @@ TYPE_PARSER("AUTO" >> 
construct(construct()) ||
parenthesized(construct(
Parser{} / ":",
Parser{} ||
-// SELF clause is either a simple optional condition for compute construct
-// or a synonym of the HOST clause for the update directive 2.14.4 holding
-// an object list.
-"SELF" >> construct(construct(
-  maybe(parenthesized(scalarLogicalExpr ||
-construct(
-construct(parenthesized(Parser{}))) ||
+"SELF" >> construct(
+  construct(Parser{})) ||
 "SEQ" >> construct(construct()) ||
 "TILE" >> construct(construct(
   parenthesized(Parser{}))) ||
@@ -176,6 +171,12 @@ TYPE_PARSER(construct(
 parenthesized(first("NONE" >> pure(AccDefaultClause::Arg::None),
 "PRESENT" >> pure(AccDefaultClause::Arg::Present)
 
+// SELF clause is either a simple optional condition for compute construct
+// or a synonym of the HOST clause for the update directive 2.14.4 holding
+// an object list.
+TYPE_PARSER(construct(parenthesized(Parser{})) ||
+construct(maybe(parenthesized(scalarLogicalExpr
+
 // Modifier for copyin, copyout, cache and 

[llvm-branch-commits] [flang] c823d74 - [flang][openacc] Add missing loop construct restriction and validity tests

2020-12-08 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-08T14:12:12-05:00
New Revision: c823d74914a287e056eb311ce293e7d4a521eb25

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

LOG: [flang][openacc] Add missing loop construct restriction and validity tests

Add restriction on loop construct associated with DO CONCURRENT. Add couple of 
tests to ensure
clause validity checks.

Reviewed By: sameeranjoshi

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

Added: 


Modified: 
flang/lib/Semantics/canonicalize-acc.cpp
flang/test/Semantics/acc-canonicalization-validity.f90
flang/test/Semantics/acc-clause-validity.f90

Removed: 




diff  --git a/flang/lib/Semantics/canonicalize-acc.cpp 
b/flang/lib/Semantics/canonicalize-acc.cpp
index 4916f2269ceb..0241508543ba 100644
--- a/flang/lib/Semantics/canonicalize-acc.cpp
+++ b/flang/lib/Semantics/canonicalize-acc.cpp
@@ -64,6 +64,8 @@ class CanonicalizationOfAcc {
 std::size_t tileArgNb = listTileExpr.size();
 
 const auto {std::get>(x.t)};
+if (outer->IsDoConcurrent())
+  return; // Tile is not allowed on DO CONURRENT
 for (const parser::DoConstruct *loop{&*outer}; loop && tileArgNb > 0;
  --tileArgNb) {
   const auto {std::get(loop->t)};
@@ -82,6 +84,27 @@ class CanonicalizationOfAcc {
 }
   }
 
+  // Check constraint on line 1835 in Section 2.9
+  // A tile and collapse clause may not appear on loop that is associated with
+  // do concurrent.
+  template 
+  void CheckDoConcurrentClauseRestriction(const C ) {
+const auto {std::get>(x.t)};
+if (!doCons->IsDoConcurrent())
+  return;
+const auto  = std::get(x.t);
+const auto  =
+std::get(beginLoopDirective.t);
+for (const auto  : accClauseList.v) {
+  if (std::holds_alternative(clause.u) ||
+  std::holds_alternative(clause.u)) {
+messages_.Say(beginLoopDirective.source,
+"TILE and COLLAPSE clause may not appear on loop construct "
+"associated with DO CONCURRENT"_err_en_US);
+  }
+}
+  }
+
   void RewriteOpenACCLoopConstruct(parser::OpenACCLoopConstruct ,
   parser::Block , parser::Block::iterator it) {
 // Check the sequence of DoConstruct in the same iteration
@@ -112,8 +135,12 @@ class CanonicalizationOfAcc {
   "DO loop after the %s directive must have loop 
control"_err_en_US,
   parser::ToUpperCaseLetters(dir.source.ToString()));
 }
+
+CheckDoConcurrentClauseRestriction(x);
 CheckTileClauseRestriction(x);
+
 return; // found do-loop
   }
 }
@@ -163,8 +190,12 @@ class CanonicalizationOfAcc {
   "DO loop after the %s directive must have loop 
control"_err_en_US,
   parser::ToUpperCaseLetters(dir.source.ToString()));
 }
+
+CheckDoConcurrentClauseRestriction(x);
 CheckTileClauseRestriction(x);
+
 return; // found do-loop
   }
 }

diff  --git a/flang/test/Semantics/acc-canonicalization-validity.f90 
b/flang/test/Semantics/acc-canonicalization-validity.f90
index 350f6315867c..bb7afaf463f1 100644
--- a/flang/test/Semantics/acc-canonicalization-validity.f90
+++ b/flang/test/Semantics/acc-canonicalization-validity.f90
@@ -13,6 +13,7 @@ program openacc_clause_validity
   integer :: i, j
   integer :: N = 256
   real(8) :: a(256)
+  real(8) :: aa(256, 256)
 
   !ERROR: A DO loop must follow the LOOP directive
   !$acc loop
@@ -106,4 +107,20 @@ program openacc_clause_validity
 a(i) = 3.14
   end do
 
+  !$acc parallel
+  !ERROR: TILE and COLLAPSE clause may not appear on loop construct associated 
with DO CONCURRENT
+  !$acc loop collapse(2)
+  do concurrent (i = 1:N, j = 1:N)
+aa(i, j) = 3.14
+  end do
+  !$acc end parallel
+
+  !$acc parallel
+  !ERROR: TILE and COLLAPSE clause may not appear on loop construct associated 
with DO CONCURRENT
+  !$acc loop tile(2, 2)
+  do concurrent (i = 1:N, j = 1:N)
+aa(i, j) = 3.14
+  end do
+  !$acc end parallel
+
 end program openacc_clause_validity

diff  --git a/flang/test/Semantics/acc-clause-validity.f90 
b/flang/test/Semantics/acc-clause-validity.f90
index 22b332841df4..993119871add 100644
--- a/flang/test/Semantics/acc-clause-validity.f90
+++ b/flang/test/Semantics/acc-clause-validity.f90
@@ -219,6 +219,14 @@ program openacc_clause_validity
   end do
   !$acc end parallel
 
+  !$acc parallel
+  !ERROR: SEQ and AUTO clauses are mutually exclusive and may not appear on 
the same LOOP directive
+  !$acc loop auto seq
+  do i = 1, N
+a(i) = 3.14
+  end do
+  !$acc end parallel
+
   !$acc parallel
   !$acc loop tile(2)
   do i = 1, N
@@ -287,6 +295,14 @@ program openacc_clause_validity
   end do
   !$acc end parallel
 
+  !$acc parallel
+  !ERROR: At most one 

[llvm-branch-commits] [flang] d553243 - [flang][openacc] Update reference to OpenACC 3.1 specification

2020-12-08 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-08T14:36:38-05:00
New Revision: d553243fe4b5e1992c07aff7b54b16160a4d5e97

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

LOG: [flang][openacc] Update reference to OpenACC 3.1 specification

Update all reference from the specification to the new OpenACC 3.1
document.

Reviewed By: SouraVX

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

Added: 


Modified: 
flang/include/flang/Parser/parse-tree.h
flang/lib/Parser/openacc-parsers.cpp
flang/lib/Semantics/check-acc-structure.cpp
flang/lib/Semantics/check-acc-structure.h
flang/tools/f18/f18.cpp
llvm/include/llvm/Frontend/OpenACC/ACC.td
mlir/include/mlir/Dialect/OpenACC/OpenACC.h
mlir/include/mlir/Dialect/OpenACC/OpenACCOps.td

Removed: 




diff  --git a/flang/include/flang/Parser/parse-tree.h 
b/flang/include/flang/Parser/parse-tree.h
index c990ddd5c915..6bed37c2b871 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3781,7 +3781,7 @@ struct OpenMPConstruct {
   u;
 };
 
-// Parse tree nodes for OpenACC 3.0 directives and clauses
+// Parse tree nodes for OpenACC 3.1 directives and clauses
 
 struct AccObject {
   UNION_CLASS_BOILERPLATE(AccObject);

diff  --git a/flang/lib/Parser/openacc-parsers.cpp 
b/flang/lib/Parser/openacc-parsers.cpp
index bba886f2fbfd..b4d2b285cd6c 100644
--- a/flang/lib/Parser/openacc-parsers.cpp
+++ b/flang/lib/Parser/openacc-parsers.cpp
@@ -6,7 +6,7 @@
 //
 
//===--===//
 
-// Top-level grammar specification for OpenACC 3.0.
+// Top-level grammar specification for OpenACC 3.1.
 
 #include "basic-parsers.h"
 #include "expr-parsers.h"

diff  --git a/flang/lib/Semantics/check-acc-structure.cpp 
b/flang/lib/Semantics/check-acc-structure.cpp
index d6be718aa2c1..c88e7f8eaaa3 100644
--- a/flang/lib/Semantics/check-acc-structure.cpp
+++ b/flang/lib/Semantics/check-acc-structure.cpp
@@ -23,14 +23,11 @@
 namespace Fortran::semantics {
 
 static constexpr inline AccClauseSet
-parallelAndKernelsOnlyAllowedAfterDeviceTypeClauses{
+computeConstructOnlyAllowedAfterDeviceTypeClauses{
 llvm::acc::Clause::ACCC_async, llvm::acc::Clause::ACCC_wait,
 llvm::acc::Clause::ACCC_num_gangs, llvm::acc::Clause::ACCC_num_workers,
 llvm::acc::Clause::ACCC_vector_length};
 
-static constexpr inline AccClauseSet serialOnlyAllowedAfterDeviceTypeClauses{
-llvm::acc::Clause::ACCC_async, llvm::acc::Clause::ACCC_wait};
-
 static constexpr inline AccClauseSet loopOnlyAllowedAfterDeviceTypeClauses{
 llvm::acc::Clause::ACCC_auto, llvm::acc::Clause::ACCC_collapse,
 llvm::acc::Clause::ACCC_independent, llvm::acc::Clause::ACCC_gang,
@@ -80,27 +77,19 @@ void AccStructureChecker::Leave(const 
parser::OpenACCBlockConstruct ) {
   switch (blockDir.v) {
   case llvm::acc::Directive::ACCD_kernels:
   case llvm::acc::Directive::ACCD_parallel:
-// Restriction - 880-881 (KERNELS)
-// Restriction - 843-844 (PARALLEL)
-CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
-parallelAndKernelsOnlyAllowedAfterDeviceTypeClauses);
-// Restriction - 877 (KERNELS)
-// Restriction - 840 (PARALLEL)
-CheckNoBranching(block, GetContext().directive, blockDir.source);
-break;
   case llvm::acc::Directive::ACCD_serial:
-// Restriction - 919
+// Restriction - line 1004-1005
 CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
-serialOnlyAllowedAfterDeviceTypeClauses);
-// Restriction - 916
-CheckNoBranching(block, llvm::acc::Directive::ACCD_serial, 
blockDir.source);
+computeConstructOnlyAllowedAfterDeviceTypeClauses);
+// Restriction - line 1001
+CheckNoBranching(block, GetContext().directive, blockDir.source);
 break;
   case llvm::acc::Directive::ACCD_data:
-// Restriction - 1117-1118
+// Restriction - line 1249-1250
 CheckRequireAtLeastOneOf();
 break;
   case llvm::acc::Directive::ACCD_host_data:
-// Restriction - 1578
+// Restriction - line 1746
 CheckRequireAtLeastOneOf();
 break;
   default:
@@ -117,7 +106,7 @@ void AccStructureChecker::Enter(
 
 void AccStructureChecker::Leave(
 const parser::OpenACCStandaloneDeclarativeConstruct &) {
-  // Restriction - 2075
+  // Restriction - line 2409
   CheckAtLeastOneClause();
   dirContext_.pop_back();
 }
@@ -144,18 +133,10 @@ void AccStructureChecker::Leave(const 
parser::OpenACCCombinedConstruct ) {
   switch (combinedDir.v) {
   case llvm::acc::Directive::ACCD_kernels_loop:
   case llvm::acc::Directive::ACCD_parallel_loop:
-// Restriction - 1962 -> (880-881) (KERNELS LOOP)
-// Restriction - 1962 -> (843-844) (PARALLEL LOOP)
-

[llvm-branch-commits] [flang] b53115b - [flang][openacc] Avoid use of init, shutdown and set in compute construct

2020-12-08 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-08T15:14:44-05:00
New Revision: b53115b6c8aa9a107bb80e704b077b253037514f

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

LOG: [flang][openacc] Avoid use of init, shutdown and set in compute construct

init, shutdown and set directive are not allowed in compute construct.

Reviewed By: SouraVX

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

Added: 


Modified: 
flang/lib/Semantics/check-acc-structure.cpp
flang/lib/Semantics/check-acc-structure.h
flang/test/Semantics/acc-clause-validity.f90

Removed: 




diff  --git a/flang/lib/Semantics/check-acc-structure.cpp 
b/flang/lib/Semantics/check-acc-structure.cpp
index c88e7f8eaaa31..c120f9a591e6c 100644
--- a/flang/lib/Semantics/check-acc-structure.cpp
+++ b/flang/lib/Semantics/check-acc-structure.cpp
@@ -54,6 +54,35 @@ bool 
AccStructureChecker::CheckAllowedModifier(llvm::acc::Clause clause) {
   return false;
 }
 
+bool AccStructureChecker::IsComputeConstruct(
+llvm::acc::Directive directive) const {
+  return directive == llvm::acc::ACCD_parallel ||
+  directive == llvm::acc::ACCD_parallel_loop ||
+  directive == llvm::acc::ACCD_serial ||
+  directive == llvm::acc::ACCD_serial_loop ||
+  directive == llvm::acc::ACCD_kernels ||
+  directive == llvm::acc::ACCD_kernels_loop;
+}
+
+bool AccStructureChecker::IsInsideComputeConstruct() const {
+  if (dirContext_.size() <= 1)
+return false;
+
+  // Check all nested context skipping the first one.
+  for (std::size_t i = dirContext_.size() - 1; i > 0; --i) {
+if (IsComputeConstruct(dirContext_[i - 1].directive))
+  return true;
+  }
+  return false;
+}
+
+void AccStructureChecker::CheckNotInComputeConstruct() {
+  if (IsInsideComputeConstruct())
+context_.Say(GetContext().directiveSource,
+"Directive %s may not be called within a compute region"_err_en_US,
+ContextDirectiveAsFortran());
+}
+
 void AccStructureChecker::Enter(const parser::AccClause ) {
   SetContextClause(x);
 }
@@ -175,12 +204,16 @@ void AccStructureChecker::Leave(const 
parser::OpenACCStandaloneConstruct ) {
   switch (standaloneDir.v) {
   case llvm::acc::Directive::ACCD_enter_data:
   case llvm::acc::Directive::ACCD_exit_data:
-  case llvm::acc::Directive::ACCD_set:
 // Restriction - line 1310-1311 (ENTER DATA)
 // Restriction - line 1312-1313 (EXIT DATA)
-// Restriction - line 2610 (SET)
 CheckRequireAtLeastOneOf();
 break;
+  case llvm::acc::Directive::ACCD_set:
+// Restriction - line 2610
+CheckRequireAtLeastOneOf();
+// Restriction - line 2602
+CheckNotInComputeConstruct();
+break;
   case llvm::acc::Directive::ACCD_update:
 // Restriction - line 2636
 CheckRequireAtLeastOneOf();
@@ -188,6 +221,12 @@ void AccStructureChecker::Leave(const 
parser::OpenACCStandaloneConstruct ) {
 CheckOnlyAllowedAfter(llvm::acc::Clause::ACCC_device_type,
 updateOnlyAllowedAfterDeviceTypeClauses);
 break;
+  case llvm::acc::Directive::ACCD_init:
+  case llvm::acc::Directive::ACCD_shutdown:
+// Restriction - line 2525 (INIT)
+// Restriction - line 2561 (SHUTDOWN)
+CheckNotInComputeConstruct();
+break;
   default:
 break;
   }

diff  --git a/flang/lib/Semantics/check-acc-structure.h 
b/flang/lib/Semantics/check-acc-structure.h
index 85f01ba8271d9..29d40b9cbe67f 100644
--- a/flang/lib/Semantics/check-acc-structure.h
+++ b/flang/lib/Semantics/check-acc-structure.h
@@ -114,6 +114,9 @@ class AccStructureChecker
 private:
 
   bool CheckAllowedModifier(llvm::acc::Clause clause);
+  bool IsComputeConstruct(llvm::acc::Directive directive) const;
+  bool IsInsideComputeConstruct() const;
+  void CheckNotInComputeConstruct();
   llvm::StringRef getClauseName(llvm::acc::Clause clause) override;
   llvm::StringRef getDirectiveName(llvm::acc::Directive directive) override;
 };

diff  --git a/flang/test/Semantics/acc-clause-validity.f90 
b/flang/test/Semantics/acc-clause-validity.f90
index 993119871adda..1f98d0f2559ff 100644
--- a/flang/test/Semantics/acc-clause-validity.f90
+++ b/flang/test/Semantics/acc-clause-validity.f90
@@ -53,6 +53,195 @@ program openacc_clause_validity
   !$acc init device_type(2, i, j)
   !$acc init device_num(i) device_type(i, j) if(ifCondition)
 
+  !$acc parallel
+  !ERROR: Directive INIT may not be called within a compute region
+  !$acc init
+  !$acc end parallel
+
+  !$acc serial
+  !ERROR: Directive INIT may not be called within a compute region
+  !$acc init
+  !$acc end serial
+
+  !$acc kernels
+  !ERROR: Directive INIT may not be called within a compute region
+  !$acc init
+  !$acc end kernels
+
+  !$acc parallel
+  !$acc loop
+  do i = 1, N
+!ERROR: Directive INIT may not be called within a compute region
+

[llvm-branch-commits] [llvm] 0ef0de6 - Fix typo in llvm/lib/Target/README.txt

2020-12-09 Thread via llvm-branch-commits

Author: Siddhesh Poyarekar
Date: 2020-12-09T10:12:26+01:00
New Revision: 0ef0de65f14ea63a1800c56cbc2faad5b10e828f

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

LOG: Fix typo in llvm/lib/Target/README.txt

Trivial typo, replace __builtin_objectsize with __builtin_object_size.

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

Added: 


Modified: 
llvm/lib/Target/README.txt

Removed: 




diff  --git a/llvm/lib/Target/README.txt b/llvm/lib/Target/README.txt
index a4876f715c64..e172abbbd855 100644
--- a/llvm/lib/Target/README.txt
+++ b/llvm/lib/Target/README.txt
@@ -1840,7 +1840,7 @@ current definition always folds to a constant. We also 
should make sure that
 we remove checking in code like
 
   char *p = malloc(strlen(s)+1);
-  __strcpy_chk(p, s, __builtin_objectsize(p, 0));
+  __strcpy_chk(p, s, __builtin_object_size(p, 0));
 
 //===-===//
 



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


[llvm-branch-commits] [mlir] 0c5cff3 - Add userData to the diagnostic handler C API

2020-11-23 Thread via llvm-branch-commits

Author: George
Date: 2020-11-23T09:52:45-08:00
New Revision: 0c5cff300ffa1d5cc55f2b11e4546f18b3389aa6

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

LOG: Add userData to the diagnostic handler C API

Previously, there was no way to add context to the diagnostic engine via the C 
API. Adding this ability makes it much easier to reason about memory ownership, 
particularly in reference-counted languages such as Swift. There are more 
details in the review comments.

Reviewed By: ftynse, mehdi_amini

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

Added: 


Modified: 
mlir/include/mlir-c/Diagnostics.h
mlir/lib/CAPI/IR/Diagnostics.cpp
mlir/test/CAPI/ir.c

Removed: 




diff  --git a/mlir/include/mlir-c/Diagnostics.h 
b/mlir/include/mlir-c/Diagnostics.h
index cc6d15be6061..14206b8454e7 100644
--- a/mlir/include/mlir-c/Diagnostics.h
+++ b/mlir/include/mlir-c/Diagnostics.h
@@ -40,12 +40,14 @@ typedef enum MlirDiagnosticSeverity MlirDiagnosticSeverity;
 /// Opaque identifier of a diagnostic handler, useful to detach a handler.
 typedef uint64_t MlirDiagnosticHandlerID;
 
-/** Diagnostic handler type. Acceps a reference to a diagnostic, which is only
- * guaranteed to be live during the call. If the handler processed the
- * diagnostic completely, it is expected to return success. Otherwise, it is
- * expected to return failure to indicate that other handlers should attempt to
- * process the diagnostic. */
-typedef MlirLogicalResult (*MlirDiagnosticHandler)(MlirDiagnostic);
+/** Diagnostic handler type. Accepts a reference to a diagnostic, which is only
+ * guaranteed to be live during the call. The handler is passed the `userData`
+ * that was provided when the handler was attached to a context. If the handler
+ * processed the diagnostic completely, it is expected to return success.
+ * Otherwise, it is expected to return failure to indicate that other handlers
+ * should attempt to process the diagnostic. */
+typedef MlirLogicalResult (*MlirDiagnosticHandler)(MlirDiagnostic,
+   void *userData);
 
 /// Prints a diagnostic using the provided callback.
 MLIR_CAPI_EXPORTED void mlirDiagnosticPrint(MlirDiagnostic diagnostic,
@@ -71,9 +73,15 @@ mlirDiagnosticGetNote(MlirDiagnostic diagnostic, intptr_t 
pos);
 
 /** Attaches the diagnostic handler to the context. Handlers are invoked in the
  * reverse order of attachment until one of them processes the diagnostic
- * completely. Returns an identifier that can be used to detach the handler. */
+ * completely. When a handler is invoked it is passed the `userData` that was
+ * provided when it was attached. If non-NULL, `deleteUserData` is called once
+ * the system no longer needs to call the handler (for instance after the
+ * handler is detached or the context is destroyed). Returns an identifier that
+ * can be used to detach the handler.
+ */
 MLIR_CAPI_EXPORTED MlirDiagnosticHandlerID mlirContextAttachDiagnosticHandler(
-MlirContext context, MlirDiagnosticHandler handler);
+MlirContext context, MlirDiagnosticHandler handler, void *userData,
+void (*deleteUserData)(void *));
 
 /** Detaches an attached diagnostic handler from the context given its
  * identifier. */

diff  --git a/mlir/lib/CAPI/IR/Diagnostics.cpp 
b/mlir/lib/CAPI/IR/Diagnostics.cpp
index 9cf422bb1b4f..2ed05a5a06e6 100644
--- a/mlir/lib/CAPI/IR/Diagnostics.cpp
+++ b/mlir/lib/CAPI/IR/Diagnostics.cpp
@@ -51,14 +51,19 @@ MlirDiagnostic mlirDiagnosticGetNote(MlirDiagnostic 
diagnostic, intptr_t pos) {
   return wrap(*std::next(unwrap(diagnostic).getNotes().begin(), pos));
 }
 
-MlirDiagnosticHandlerID
-mlirContextAttachDiagnosticHandler(MlirContext context,
-   MlirDiagnosticHandler handler) {
+static void deleteUserDataNoop(void *userData) {}
+
+MlirDiagnosticHandlerID mlirContextAttachDiagnosticHandler(
+MlirContext context, MlirDiagnosticHandler handler, void *userData,
+void (*deleteUserData)(void *)) {
   assert(handler && "unexpected null diagnostic handler");
+  if (deleteUserData == NULL)
+deleteUserData = deleteUserDataNoop;
+  std::shared_ptr sharedUserData(userData, deleteUserData);
   DiagnosticEngine::HandlerID id =
   unwrap(context)->getDiagEngine().registerHandler(
-  [handler](Diagnostic ) {
-return unwrap(handler(wrap(diagnostic)));
+  [handler, sharedUserData](Diagnostic ) {
+return unwrap(handler(wrap(diagnostic), sharedUserData.get()));
   });
   return static_cast(id);
 }

diff  --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c
index 83d66555dba7..821ead52c166 100644
--- a/mlir/test/CAPI/ir.c
+++ b/mlir/test/CAPI/ir.c
@@ -1248,31 +1248,37 @@ int registerOnlyStd() {
 }
 
 // Wraps 

[llvm-branch-commits] [mlir] 11ea2e2 - [mlir][Linalg] NFC: Expose some utility functions used for promotion.

2020-11-23 Thread via llvm-branch-commits

Author: MaheshRavishankar
Date: 2020-11-23T10:35:42-08:00
New Revision: 11ea2e2448a5f071a04463f94b7bccfe0a32d264

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

LOG: [mlir][Linalg] NFC: Expose some utility functions used for promotion.

Exposing some utility functions from Linalg to allow for promotion of
fused views outside of the core tile+fuse logic.
This is an alternative to patch D91322 which adds the promotion logic
to the tileAndFuse method. Downside with that approach is that it is
not easily customizable based on needs.

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

Added: 


Modified: 
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp

Removed: 




diff  --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h 
b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index d2d6cef1954d..d67e81ceab87 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -234,6 +234,20 @@ struct LinalgPromotionOptions {
   }
 };
 
+/// Creates a new buffer using the `allocationFn` provided. The size of this
+/// buffer is the smallest constant bounding size along each dimension that can
+/// be computed for the size of the result of `subView`. Returns the allocated
+/// buffer as `fullLocalView` and the view that matches the size of the result
+/// of subview operation as `partialLocalView`.
+struct PromotionInfo {
+  Value fullLocalView;
+  Value partialLocalView;
+};
+Optional
+promoteSubviewAsNewBuffer(OpBuilder , Location loc, SubViewOp subView,
+  AllocBufferCallbackFn allocationFn,
+  OperationFolder *folder = nullptr);
+
 /// Promotes the `subViews` into a new buffer allocated at the insertion point
 /// `b`. Promotion occurs in 3 steps:
 ///   1. Create a new buffer for a full tile (i.e. not clipped at the 
boundary).

diff  --git a/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h 
b/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
index a6b8afdce9d3..fb916d3962e3 100644
--- a/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
+++ b/mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
@@ -17,6 +17,7 @@
 #include "mlir/Dialect/StandardOps/EDSC/Intrinsics.h"
 #include "mlir/Dialect/StandardOps/IR/Ops.h"
 
+#include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/SetVector.h"
 
 using mlir::edsc::intrinsics::AffineIndexedValue;
@@ -82,6 +83,13 @@ bool isProducerLastWriteOfView(const LinalgDependenceGraph 
,
 bool isFusableInto(const LinalgDependenceGraph , LinalgOp consumer,
Value consumedView, LinalgOp producer);
 
+using FusableOpDependencesTy = llvm::MapVector<
+Operation *,
+SmallVector>;
+FusableOpDependencesTy
+findAllFusableDependences(ArrayRef ops,
+  const LinalgDependenceGraph );
+
 /// Fuses producer into consumer if the producer is structurally feasible and
 /// the fusion would not violate dependencies.
 /// Implements the fusion part of the "tileAndFuse on buffers"

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp 
b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
index 8ec71eec75b8..3160e8f8be0b 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
@@ -542,10 +542,6 @@ static AffineMap 
pruneReductionDimsFromMap(ArrayRef iteratorTypes,
   return getProjectedMap(map, projectedDims);
 }
 
-using FusableOpDependencesTy = llvm::MapVector<
-Operation *,
-SmallVector>;
-
 /// Returns the mapping from iterations in the consumer that write to the same
 /// location as the iterations in the producer. To do so use
 /// - indexing map of the fused view in the consumer : consumerIndexMap
@@ -729,10 +725,9 @@ collectFusableLoops(ArrayRef ops,
   return fusableLoops;
 }
 
-/// Find all dependences that are to be fusable.
-static FusableOpDependencesTy
-findAllFusableDependences(ArrayRef ops,
-  const LinalgDependenceGraph ) {
+/// Find all dependences that are fusable.
+FusableOpDependencesTy mlir::linalg::findAllFusableDependences(
+ArrayRef ops, const LinalgDependenceGraph ) {
   FusableOpDependencesTy fusableDependences;
   // TODO: Currently fusion would not be legal if the fusable dependence is to
   // the same producer but 
diff erent indexing map in the consumer. Fix this, but
@@ -836,6 +831,7 @@ fuseOperations(OpBuilder , LinalgOp tiledOp,
 fusedLoopsAndRanges[loop] = getRangeFromOperandShape(
 builder, tiledOp.getLoc(), shapeDim.shape, shapeDim.dimension);
   }
+
   SmallVector fusedOps(fusionCandidates.size());
   

[llvm-branch-commits] [mlir] e65a5e5 - [mlir][Linalg] Fuse sequence of Linalg operation (on buffers)

2020-11-23 Thread via llvm-branch-commits

Author: MaheshRavishankar
Date: 2020-11-23T10:30:51-08:00
New Revision: e65a5e5b00a37700a79e0a9f2fb1c1e60a2584bf

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

LOG: [mlir][Linalg] Fuse sequence of Linalg operation (on buffers)

Enhance the tile+fuse logic to allow fusing a sequence of operations.

Make sure the value used to obtain tile shape is a
SubViewOp/SubTensorOp. Current logic used to get the bounds of loop
depends on the use of `getOrCreateRange` method on `SubViewOp` and
`SubTensorOp`. Make sure that the value/dim used to compute the range
is from such ops.  This fix is a reasonable WAR, but a btter fix would
be to make `getOrCreateRange` method be a method of `ViewInterface`.

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

Added: 
mlir/test/Dialect/Linalg/fusion-sequence.mlir

Modified: 
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
mlir/test/Dialect/Linalg/fusion-pattern.mlir
mlir/test/lib/Transforms/TestLinalgFusionTransforms.cpp
mlir/tools/mlir-opt/mlir-opt.cpp

Removed: 




diff  --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h 
b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index b7cfa6f023a7..d2d6cef1954d 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -37,14 +37,6 @@ struct TiledLinalgOp {
   SmallVector tensorResults;
 };
 
-struct TiledAndFusedLinalgOps {
-  LinalgOp op;
-  SmallVector fusedProducers;
-  SmallVector originalProducers;
-  SmallVector fusedLoops;
-  SmallVector unfusedLoops;
-};
-
 /// Populates patterns for vectorization of all ConvN-D ops.
 void populateConvVectorizationPatterns(
 MLIRContext *context, SmallVectorImpl ,
@@ -73,14 +65,11 @@ void populateLinalgBufferizePatterns(MLIRContext *context,
 Optional tileLinalgOp(OpBuilder , LinalgOp op,
  const LinalgTilingOptions );
 
-/// Tile and fuse the `op` with its producers. The tile and fuse proceeds in
-/// three steps
-/// - Find tile loops that are fusable with its producer tile loops (a.k.a. 
tile
-///   + fuse loops).
-/// - Tile just these loops of the consumer (root operation) and fuse with
-///   the producer.
-/// - Tile again the tiled consumer operation produced above to do rest of
-///   the tiling specified by the `tilingOptions`.
+/// Fuse a sequence of linalg operations (`ops`) using tile-and-fuse. This
+/// proceeds as follows:
+/// - Find outer parallel loops in these ops that can be fused.
+/// - Tile fusable outer parallel loops of the last operation in the sequence.
+/// - Fuse the remaining operations with the tiled operation
 ///
 /// For example, consider the sequence of matmul below
 ///
@@ -107,36 +96,39 @@ Optional tileLinalgOp(OpBuilder , 
LinalgOp op,
 /// : memref<256x32xf32> to memref<16x32xf32, #map0>
 ///   %3 = subview %arg1[0, 0] [32, 32] [1, 1]
 /// : memref<32x32xf32> to memref<32x32xf32, #map1>
+///   %4 = subview %arg3[0, 0] [32, 32] [1, 1]
+/// : memref<32x32xf32> to memref<32x32xf32, #map1>
 ///   linalg.matmul
 /// ins(%2, %3 : memref<16x32xf32, #map0>, memref<32x32xf32, #map1>)
 /// outs(%0 : memref<16x32xf32, #map0>)
-///   scf.parallel (%arg6) = (%c0) to (%c32) step (%c8) {
-///   scf.for %arg7 = %c0 to %c32 step %c4 {
-/// %4 = subview %0[0, %arg7] [16, 4] [1, 1]
-///   : memref<16x32xf32, #map0> to memref<16x4xf32, #map0>
-/// %5 = subview %arg3[%arg7, %arg6] [4, 8] [1, 1]
-///   : memref<32x32xf32> to memref<4x8xf32, #map0>
-/// %6 = subview %1[0, %arg6] [16, 8] [1, 1]
-///   : memref<16x32xf32, #map0> to memref<16x8xf32, #map0>
-/// linalg.matmul
-///   ins(%4, %5 : memref<16x4xf32, #map0>, memref<4x8xf32, #map0>)
-///   outs(%6 : memref<16x8xf32, #map0>)
-/// }
-/// scf.yield
-///   }
-///   scf.yield
+///   linalg.matmul
+/// ins(%0, %4 : memref<16x4xf32, #map0>, memref<4x8xf32, #map0>)
+/// outs(%1 : memref<16x8xf32, #map0>)
 /// }
 ///
-/// The following tiling options are handled 
diff erently in tile+fuse (compared
-/// to tile only)
+/// `tilingOptions` are used to tile the corresponding operation in `ops` (the
+/// size of the former should be same as size of the latter. Based on how
+/// tile+fuse is implemented, the fused loops are generated based on the last
+/// operation in the sequence. For example, the tile sizes for the fused loops
+/// is obtained from `tilingOptions.back()`. The following tiling options are
+/// handled 
diff erently in tile+fuse (compared to tile only)
 /// - Interchange of the tiling loops is not supported right now.
-/// - Distribution is only 

[llvm-branch-commits] [mlir] df9ae59 - Use MlirStringRef throughout the C API

2020-11-23 Thread via llvm-branch-commits

Author: George
Date: 2020-11-23T14:07:30-08:00
New Revision: df9ae5992889560a8f3c6760b54d5051b47c7bf5

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

LOG: Use MlirStringRef throughout the C API

While this makes the unit tests a bit more verbose, this simplifies the 
creation of bindings because only the bidirectional mapping between the host 
language's string type and MlirStringRef need to be implemented.

Reviewed By: mehdi_amini

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

Added: 


Modified: 
mlir/include/mlir-c/IR.h
mlir/include/mlir-c/Support.h
mlir/include/mlir/CAPI/Utils.h
mlir/lib/CAPI/IR/IR.cpp
mlir/lib/CAPI/IR/StandardAttributes.cpp
mlir/test/CAPI/ir.c
mlir/test/CAPI/pass.c

Removed: 




diff  --git a/mlir/include/mlir-c/IR.h b/mlir/include/mlir-c/IR.h
index 6c9394c38b17..2ca5b80b825a 100644
--- a/mlir/include/mlir-c/IR.h
+++ b/mlir/include/mlir-c/IR.h
@@ -69,7 +69,7 @@ DEFINE_C_API_STRUCT(MlirValue, const void);
  * a string.
  */
 struct MlirNamedAttribute {
-  const char *name;
+  MlirStringRef name;
   MlirAttribute attribute;
 };
 typedef struct MlirNamedAttribute MlirNamedAttribute;
@@ -143,10 +143,8 @@ MLIR_CAPI_EXPORTED MlirStringRef 
mlirDialectGetNamespace(MlirDialect dialect);
 
//===--===//
 
 /// Creates an File/Line/Column location owned by the given context.
-MLIR_CAPI_EXPORTED MlirLocation mlirLocationFileLineColGet(MlirContext context,
-   const char 
*filename,
-   unsigned line,
-   unsigned col);
+MLIR_CAPI_EXPORTED MlirLocation mlirLocationFileLineColGet(
+MlirContext context, MlirStringRef filename, unsigned line, unsigned col);
 
 /// Creates a location with unknown position owned by the given context.
 MLIR_CAPI_EXPORTED MlirLocation mlirLocationUnknownGet(MlirContext context);
@@ -170,7 +168,7 @@ MLIR_CAPI_EXPORTED MlirModule 
mlirModuleCreateEmpty(MlirLocation location);
 
 /// Parses a module from the string and transfers ownership to the caller.
 MLIR_CAPI_EXPORTED MlirModule mlirModuleCreateParse(MlirContext context,
-const char *module);
+MlirStringRef module);
 
 /// Gets the context that a module was created with.
 MLIR_CAPI_EXPORTED MlirContext mlirModuleGetContext(MlirModule module);
@@ -202,7 +200,7 @@ MLIR_CAPI_EXPORTED MlirOperation 
mlirModuleGetOperation(MlirModule module);
  * mlirOperationState* functions instead.
  */
 struct MlirOperationState {
-  const char *name;
+  MlirStringRef name;
   MlirLocation location;
   intptr_t nResults;
   MlirType *results;
@@ -218,16 +216,16 @@ struct MlirOperationState {
 typedef struct MlirOperationState MlirOperationState;
 
 /// Constructs an operation state from a name and a location.
-MLIR_CAPI_EXPORTED MlirOperationState mlirOperationStateGet(const char *name,
+MLIR_CAPI_EXPORTED MlirOperationState mlirOperationStateGet(MlirStringRef name,
 MlirLocation loc);
 
 /// Adds a list of components to the operation state.
 MLIR_CAPI_EXPORTED void mlirOperationStateAddResults(MlirOperationState *state,
  intptr_t n,
  MlirType const *results);
-MLIR_CAPI_EXPORTED void mlirOperationStateAddOperands(MlirOperationState 
*state,
-  intptr_t n,
-  MlirValue const 
*operands);
+MLIR_CAPI_EXPORTED void
+mlirOperationStateAddOperands(MlirOperationState *state, intptr_t n,
+  MlirValue const *operands);
 MLIR_CAPI_EXPORTED void
 mlirOperationStateAddOwnedRegions(MlirOperationState *state, intptr_t n,
   MlirRegion const *regions);
@@ -349,18 +347,18 @@ mlirOperationGetAttribute(MlirOperation op, intptr_t pos);
 
 /// Returns an attribute attached to the operation given its name.
 MLIR_CAPI_EXPORTED MlirAttribute
-mlirOperationGetAttributeByName(MlirOperation op, const char *name);
+mlirOperationGetAttributeByName(MlirOperation op, MlirStringRef name);
 
 /** Sets an attribute by name, replacing the existing if it exists or
  * adding a new one otherwise. */
 MLIR_CAPI_EXPORTED void mlirOperationSetAttributeByName(MlirOperation op,
-const char *name,
+MlirStringRef name,
  

[llvm-branch-commits] [libcxx] 0a20660 - [libcxx] Resolve LWG 2724 protected -> private.

2020-11-23 Thread via llvm-branch-commits

Author: zoecarver
Date: 2020-11-23T14:27:22-08:00
New Revision: 0a20660c8fcb5bb8469e323585eeaecacea67c44

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

LOG: [libcxx] Resolve LWG 2724 protected -> private.

Fixes LWG issue 2724: "The protected virtual member functions of 
memory_resource should be private."

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

Added: 

libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/private_members.fail.cpp

Modified: 
libcxx/include/experimental/memory_resource

Removed: 

libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp



diff  --git a/libcxx/include/experimental/memory_resource 
b/libcxx/include/experimental/memory_resource
index f999fb9befda..816d21f51368 100644
--- a/libcxx/include/experimental/memory_resource
+++ b/libcxx/include/experimental/memory_resource
@@ -116,7 +116,7 @@ public:
 { return do_is_equal(__other); }
 
 // 8.5.3, memory.resource.priv
-protected:
+private:
 virtual void* do_allocate(size_t, size_t) = 0;
 virtual void do_deallocate(void*, size_t, size_t) = 0;
 virtual bool do_is_equal(memory_resource const &) const _NOEXCEPT = 0;
@@ -381,7 +381,7 @@ public:
 { return __alloc_; }
 
 // 8.7.3, memory.resource.adaptor.mem
-protected:
+private:
 virtual void * do_allocate(size_t __bytes, size_t)
 {
 if (__bytes > __max_size()) {
@@ -407,7 +407,6 @@ protected:
 return __p  ? __alloc_ == __p->__alloc_ : false;
 }
 
-private:
 _LIBCPP_INLINE_VISIBILITY
 size_t __max_size() const _NOEXCEPT {
 return numeric_limits::max() - _MaxAlign;

diff  --git 
a/libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp
 
b/libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/private_members.fail.cpp
similarity index 73%
rename from 
libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp
rename to 
libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/private_members.fail.cpp
index 85c4ce4ee91c..a0c84b0fa83c 100644
--- 
a/libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/protected_members.fail.cpp
+++ 
b/libcxx/test/std/experimental/memory/memory.resource/memory.resource.priv/private_members.fail.cpp
@@ -10,9 +10,9 @@
 
 // 
 
-// memory_resource::do_allocate(size_t, size_t);  /* protected */
-// memory_resource::do_deallocate(void*, size_t, size_t); /* protected */
-// memory_resource::do_is_equal(memory_resource const&);  /* protected */
+// memory_resource::do_allocate(size_t, size_t);  /* private */
+// memory_resource::do_deallocate(void*, size_t, size_t); /* private */
+// memory_resource::do_is_equal(memory_resource const&);  /* private */
 
 #include 
 
@@ -20,9 +20,9 @@ namespace ex = std::experimental::pmr;
 
 int main(int, char**) {
 ex::memory_resource *m = ex::new_delete_resource();
-m->do_allocate(0, 0); // expected-error{{'do_allocate' is a protected 
member}}
-m->do_deallocate(nullptr, 0, 0); // expected-error{{'do_deallocate' is a 
protected member}}
-m->do_is_equal(*m); // expected-error{{'do_is_equal' is a protected 
member}}
+m->do_allocate(0, 0); // expected-error{{'do_allocate' is a private 
member}}
+m->do_deallocate(nullptr, 0, 0); // expected-error{{'do_deallocate' is a 
private member}}
+m->do_is_equal(*m); // expected-error{{'do_is_equal' is a private member}}
 
   return 0;
 }



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


[llvm-branch-commits] [openmp] 9b7d6a6 - [OpenMP] Fix too long name for shm segment on macOS

2020-12-09 Thread via llvm-branch-commits

Author: Peyton, Jonathan L
Date: 2020-12-09T14:31:15-06:00
New Revision: 9b7d6a6bffce14c766eaa90c7a3d3b8d192cdfb0

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

LOG: [OpenMP] Fix too long name for shm segment on macOS

Remove the user id component to the shm segment name and just use
the pid like before.

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

Added: 


Modified: 
openmp/runtime/src/kmp_runtime.cpp

Removed: 




diff  --git a/openmp/runtime/src/kmp_runtime.cpp 
b/openmp/runtime/src/kmp_runtime.cpp
index cdcfdb0be178..f6d4524150f0 100644
--- a/openmp/runtime/src/kmp_runtime.cpp
+++ b/openmp/runtime/src/kmp_runtime.cpp
@@ -6356,11 +6356,12 @@ static char *__kmp_registration_str = NULL;
 // Value to be saved in env var __KMP_REGISTERED_LIB_.
 
 static inline char *__kmp_reg_status_name() {
-  /* On RHEL 3u5 if linked statically, getpid() returns 
diff erent values in
- each thread. If registration and unregistration go in 
diff erent threads
- (omp_misc_other_root_exit.cpp test case), the name of registered_lib_env
- env var can not be found, because the name will contain 
diff erent pid. */
-#if KMP_OS_UNIX && KMP_DYNAMIC_LIB // shared memory is with dynamic library
+/* On RHEL 3u5 if linked statically, getpid() returns 
diff erent values in
+   each thread. If registration and unregistration go in 
diff erent threads
+   (omp_misc_other_root_exit.cpp test case), the name of registered_lib_env
+   env var can not be found, because the name will contain 
diff erent pid. */
+// macOS* complains about name being too long with additional getuid()
+#if KMP_OS_UNIX && !KMP_OS_DARWIN && KMP_DYNAMIC_LIB
   return __kmp_str_format("__KMP_REGISTERED_LIB_%d_%d", (int)getpid(),
   (int)getuid());
 #else



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


[llvm-branch-commits] [openmp] fe3b244 - [OpenMP] Fix norespect affinity bug for Windows

2020-12-09 Thread via llvm-branch-commits

Author: Peyton, Jonathan L
Date: 2020-12-09T14:32:48-06:00
New Revision: fe3b244ef7c2656c5876ff3f91232406f9854c42

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

LOG: [OpenMP] Fix norespect affinity bug for Windows

KMP_AFFINITY=norespect was triggering an error because the underlying
process affinity mask was not updated to include the entire machine.
The Windows documentation states that the thread affinities must be
subsets of the process affinity. This patch also moves the printing
(for KMP_AFFINITY=verbose) of whether the initial mask was respected
out of each topology detection function and to one location where the
initial affinity mask is read.

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

Added: 


Modified: 
openmp/runtime/src/kmp.h
openmp/runtime/src/kmp_affinity.cpp
openmp/runtime/src/kmp_affinity.h

Removed: 




diff  --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 7a8f7d28f461..e450b128a005 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -694,6 +694,9 @@ class KMPAffinity {
 virtual int begin() const { return 0; }
 virtual int end() const { return 0; }
 virtual int next(int previous) const { return 0; }
+#if KMP_OS_WINDOWS
+virtual int set_process_affinity(bool abort_on_error) const { return -1; }
+#endif
 // Set the system's affinity to this affinity mask's value
 virtual int set_system_affinity(bool abort_on_error) const { return -1; }
 // Set this affinity mask to the current system affinity

diff  --git a/openmp/runtime/src/kmp_affinity.cpp 
b/openmp/runtime/src/kmp_affinity.cpp
index 10ba3e5125dc..8f77f36ed5be 100644
--- a/openmp/runtime/src/kmp_affinity.cpp
+++ b/openmp/runtime/src/kmp_affinity.cpp
@@ -729,15 +729,7 @@ static int __kmp_affinity_create_hwloc_map(AddrUnsPair 
**address2os,
 __kmp_ncores = nPackages = 1;
 __kmp_nThreadsPerCore = nCoresPerPkg = 1;
 if (__kmp_affinity_verbose) {
-  char buf[KMP_AFFIN_MASK_PRINT_LEN];
-  __kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN, oldMask);
-
   KMP_INFORM(AffUsingHwloc, "KMP_AFFINITY");
-  if (__kmp_affinity_respect_mask) {
-KMP_INFORM(InitOSProcSetRespect, "KMP_AFFINITY", buf);
-  } else {
-KMP_INFORM(InitOSProcSetNotRespect, "KMP_AFFINITY", buf);
-  }
   KMP_INFORM(AvailableOSProc, "KMP_AFFINITY", __kmp_avail_proc);
   KMP_INFORM(Uniform, "KMP_AFFINITY");
   KMP_INFORM(Topology, "KMP_AFFINITY", nPackages, nCoresPerPkg,
@@ -791,13 +783,6 @@ static int __kmp_affinity_create_hwloc_map(AddrUnsPair 
**address2os,
 
   // Print the machine topology summary.
   if (__kmp_affinity_verbose) {
-char mask[KMP_AFFIN_MASK_PRINT_LEN];
-__kmp_affinity_print_mask(mask, KMP_AFFIN_MASK_PRINT_LEN, oldMask);
-if (__kmp_affinity_respect_mask) {
-  KMP_INFORM(InitOSProcSetRespect, "KMP_AFFINITY", mask);
-} else {
-  KMP_INFORM(InitOSProcSetNotRespect, "KMP_AFFINITY", mask);
-}
 KMP_INFORM(AvailableOSProc, "KMP_AFFINITY", __kmp_avail_proc);
 if (uniform) {
   KMP_INFORM(Uniform, "KMP_AFFINITY");
@@ -898,16 +883,7 @@ static int __kmp_affinity_create_flat_map(AddrUnsPair 
**address2os,
   __kmp_ncores = nPackages = __kmp_avail_proc;
   __kmp_nThreadsPerCore = nCoresPerPkg = 1;
   if (__kmp_affinity_verbose) {
-char buf[KMP_AFFIN_MASK_PRINT_LEN];
-__kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN,
-  __kmp_affin_fullMask);
-
 KMP_INFORM(AffCapableUseFlat, "KMP_AFFINITY");
-if (__kmp_affinity_respect_mask) {
-  KMP_INFORM(InitOSProcSetRespect, "KMP_AFFINITY", buf);
-} else {
-  KMP_INFORM(InitOSProcSetNotRespect, "KMP_AFFINITY", buf);
-}
 KMP_INFORM(AvailableOSProc, "KMP_AFFINITY", __kmp_avail_proc);
 KMP_INFORM(Uniform, "KMP_AFFINITY");
 KMP_INFORM(Topology, "KMP_AFFINITY", nPackages, nCoresPerPkg,
@@ -1273,15 +1249,7 @@ static int __kmp_affinity_create_apicid_map(AddrUnsPair 
**address2os,
 __kmp_ncores = nPackages = 1;
 __kmp_nThreadsPerCore = nCoresPerPkg = 1;
 if (__kmp_affinity_verbose) {
-  char buf[KMP_AFFIN_MASK_PRINT_LEN];
-  __kmp_affinity_print_mask(buf, KMP_AFFIN_MASK_PRINT_LEN, oldMask);
-
   KMP_INFORM(AffUseGlobCpuid, "KMP_AFFINITY");
-  if (__kmp_affinity_respect_mask) {
-KMP_INFORM(InitOSProcSetRespect, "KMP_AFFINITY", buf);
-  } else {
-KMP_INFORM(InitOSProcSetNotRespect, "KMP_AFFINITY", buf);
-  }
   KMP_INFORM(AvailableOSProc, "KMP_AFFINITY", __kmp_avail_proc);
   KMP_INFORM(Uniform, "KMP_AFFINITY");
   KMP_INFORM(Topology, "KMP_AFFINITY", nPackages, nCoresPerPkg,
@@ -1406,15 +1374,7 @@ static int __kmp_affinity_create_apicid_map(AddrUnsPair 
**address2os,
   // not 

[llvm-branch-commits] [llvm] a7b2847 - [openmp] Remove clause from OMPKinds.def and use OMP.td info

2020-12-10 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-10T10:19:09-05:00
New Revision: a7b2847216b4f7a84ef75461fd47a5adfbb63e27

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

LOG: [openmp] Remove clause from OMPKinds.def and use OMP.td info

Remove the OpenMP clause information from the OMPKinds.def file and use the
information from the new OMP.td file. There is now a single source of truth for 
the
directives and clauses.

To avoid generate lots of specific small code from tablegen, the macros 
previously
used in OMPKinds.def are generated almost as identical. This can be polished and
possibly removed in a further patch.

Reviewed By: jdoerfert

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

Added: 


Modified: 
clang/include/clang/AST/ASTFwd.h
clang/include/clang/AST/ASTTypeTraits.h
clang/include/clang/AST/OpenMPClause.h
clang/include/clang/AST/RecursiveASTVisitor.h
clang/lib/AST/ASTTypeTraits.cpp
clang/lib/AST/OpenMPClause.cpp
clang/lib/AST/StmtProfile.cpp
clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
clang/lib/ASTMatchers/Dynamic/Marshallers.h
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/tools/libclang/CIndex.cpp
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/include/llvm/TableGen/DirectiveEmitter.h
llvm/test/TableGen/directive2.td
llvm/utils/TableGen/DirectiveEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ASTFwd.h 
b/clang/include/clang/AST/ASTFwd.h
index 65319a19728b..6eceb526ca4c 100644
--- a/clang/include/clang/AST/ASTFwd.h
+++ b/clang/include/clang/AST/ASTFwd.h
@@ -27,9 +27,9 @@ class Type;
 #include "clang/AST/TypeNodes.inc"
 class CXXCtorInitializer;
 class OMPClause;
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) class Class;
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
-
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) class Class;
+#include "llvm/Frontend/OpenMP/OMP.cpp.inc"
 
 } // end namespace clang
 

diff  --git a/clang/include/clang/AST/ASTTypeTraits.h 
b/clang/include/clang/AST/ASTTypeTraits.h
index ea3da8d90c5b..92123ed2a32a 100644
--- a/clang/include/clang/AST/ASTTypeTraits.h
+++ b/clang/include/clang/AST/ASTTypeTraits.h
@@ -147,8 +147,9 @@ class ASTNodeKind {
 #define TYPE(DERIVED, BASE) NKI_##DERIVED##Type,
 #include "clang/AST/TypeNodes.inc"
 NKI_OMPClause,
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) NKI_##Class,
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) NKI_##Class,
+#include "llvm/Frontend/OpenMP/OMP.cpp.inc"
 NKI_NumberOfKinds
   };
 
@@ -205,8 +206,9 @@ KIND_TO_KIND_ID(CXXBaseSpecifier)
 #include "clang/AST/StmtNodes.inc"
 #define TYPE(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Type)
 #include "clang/AST/TypeNodes.inc"
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class)
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class)
+#include "llvm/Frontend/OpenMP/OMP.cpp.inc"
 #undef KIND_TO_KIND_ID
 
 inline raw_ostream <<(raw_ostream , ASTNodeKind K) {

diff  --git a/clang/include/clang/AST/OpenMPClause.h 
b/clang/include/clang/AST/OpenMPClause.h
index cc6d3a93ba09..57ba4fa5510f 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -7758,20 +7758,22 @@ class OMPClauseVisitorBase {
 #define DISPATCH(CLASS) \
   return 
static_cast(this)->Visit##CLASS(static_cast(S))
 
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) \
-  RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); }
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) 
\
+  RetTy Visit##Class(PTR(Class) S) { DISPATCH(Class); }
+#include "llvm/Frontend/OpenMP/OMP.cpp.inc"
 
   RetTy Visit(PTR(OMPClause) S) {
 // Top switch clause: visit each OMPClause.
 switch (S->getClauseKind()) {
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) 
\
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) 
\
   case llvm::omp::Clause::Enum:
\
 return Visit##Class(static_cast(S));
-#define OMP_CLAUSE_NO_CLASS(Enum, Str) 
\
+#define CLAUSE_NO_CLASS(Enum, Str) 
\
   case llvm::omp::Clause::Enum:
\
 break;
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
+#include "llvm/Frontend/OpenMP/OMP.cpp.inc"
 default:
   break;
 }
@@ -7804,9 

[llvm-branch-commits] [clang] e9e6e3b - [clang-format] Add IndentPragma style to eliminate common clang-format off scenario

2020-12-10 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-10T11:17:33Z
New Revision: e9e6e3b34a8e0857a274df51aac27e88c1de402b

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

LOG: [clang-format] Add IndentPragma style to eliminate common clang-format off 
scenario

A quick search of github.com, shows one common scenario for excessive use of 
//clang-format off/on is the indentation of #pragma's, especially around the 
areas of loop optimization or OpenMP

This revision aims to help that by introducing an `IndentPragmas` style, the 
aim of which is to keep the pragma at the current level of scope

```
for (int i = 0; i < 5; i++) {
// clang-format off
#pragma HLS UNROLL
// clang-format on
for (int j = 0; j < 5; j++) {
// clang-format off
#pragma HLS UNROLL
// clang-format on
 
```

can become

```
for (int i = 0; i < 5; i++) {
#pragma HLS UNROLL
for (int j = 0; j < 5; j++) {
#pragma HLS UNROLL

```

This revision also support working alongside the `IndentPPDirective` of 
`BeforeHash` and `AfterHash` (see unit tests for examples)

Reviewed By: curdeius

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

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h
clang/lib/Format/ContinuationIndenter.cpp
clang/lib/Format/Format.cpp
clang/lib/Format/UnwrappedLineFormatter.cpp
clang/lib/Format/UnwrappedLineParser.cpp
clang/lib/Format/UnwrappedLineParser.h
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 239c9177bec2..f63ed168f099 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -1917,6 +1917,30 @@ the configuration (without a prefix: ``Auto``).
 
 
 
+**IndentPragmas** (``bool``)
+  Indent pragmas
+
+  When ``false``, pragmas are flushed left or follow IndentPPDirectives.
+  When ``true``, pragmas are indented to the current scope level.
+
+  .. code-block:: c++
+
+false:  true:
+#pragma once   vs   #pragma once
+void foo() {void foo() {
+#pragma omp simd  #pragma omp simd
+  for (int i=0;i<10;i++) {for (int i=0;i<10;i++) {
+#pragma omp simd#pragma omp simd
+for (int i=0;i<10;i++) {for (int i=0;i<10;i++) {
+}   }
+#if 1   #if 1
+#pragma omp simd#pragma omp simd
+for (int i=0;i<10;i++) {for (int i=0;i<10;i++) {
+}   }
+#endif  #endif
+  }   }
+}   }
+
 **IndentRequires** (``bool``)
   Indent the requires clause in a template
 

diff  --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 6e304630fbdc..d8ed27687b63 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -1528,6 +1528,29 @@ struct FormatStyle {
   /// \endcode
   bool IndentGotoLabels;
 
+  /// Indent pragmas
+  ///
+  /// When ``false``, pragmas are flushed left or follow IndentPPDirectives.
+  /// When ``true``, pragmas are indented to the current scope level.
+  /// \code
+  ///   false:  true:
+  ///   #pragma once   vs   #pragma once
+  ///   void foo() {void foo() {
+  ///   #pragma omp simd  #pragma omp simd
+  /// for (int i=0;i<10;i++) {for (int i=0;i<10;i++) {
+  ///   #pragma omp simd#pragma omp simd
+  ///   for (int i=0;i<10;i++) {for (int i=0;i<10;i++) {
+  ///   }   }
+  ///   #if 1   #if 1
+  ///   #pragma omp simd#pragma omp simd
+  ///   for (int i=0;i<10;i++) {for (int i=0;i<10;i++) {
+  ///   }   }
+  ///   #endif  #endif
+  /// }   }
+  ///   }   }
+  /// \endcode
+  bool IndentPragmas;
+
   /// Options for indenting preprocessor directives.
   enum PPDirectiveIndentStyle {
 /// Does not indent any directives.
@@ -2494,6 +2517,7 @@ struct FormatStyle {
IndentCaseLabels == R.IndentCaseLabels &&
  

[llvm-branch-commits] [clang] 7b2d62f - [clang-format] PR42434 Remove preprocessor and pragma lines from ObjectiveC guess

2020-12-10 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-10T11:13:22Z
New Revision: 7b2d62fd7f7befda2ce327d25075b0aac9bc6780

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

LOG: [clang-format] PR42434 Remove preprocessor and pragma lines from 
ObjectiveC guess

clang-format see the `disable:` in   __pragma(warning(disable:)) as ObjectiveC 
method call

Remove any line starting with `#` or __pragma line from being part of the 
ObjectiveC guess

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

Reviewed By: curdeius, krasimir

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

Added: 


Modified: 
clang/lib/Format/Format.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index a3f740ff8692..4263f7b47e7c 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -2032,6 +2032,10 @@ class ObjCHeaderStyleGuesser : public TokenAnalyzer {
 };
 
 for (auto Line : AnnotatedLines) {
+  if (Line->First && (Line->First->TokenText.startswith("#") ||
+  Line->First->TokenText == "__pragma" ||
+  Line->First->TokenText == "_Pragma"))
+continue;
   for (const FormatToken *FormatTok = Line->First; FormatTok;
FormatTok = FormatTok->Next) {
 if ((FormatTok->Previous && FormatTok->Previous->is(tok::at) &&

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index e897402e502a..d3ea5c2b5880 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -16713,6 +16713,15 @@ TEST_F(FormatTest, GuessLanguageWithCaret) {
   guessLanguage("foo.h", "int(^foo[(kNumEntries + 10)])(char, float);"));
 }
 
+TEST_F(FormatTest, GuessLanguageWithPragmas) {
+  EXPECT_EQ(FormatStyle::LK_Cpp,
+guessLanguage("foo.h", "__pragma(warning(disable:))"));
+  EXPECT_EQ(FormatStyle::LK_Cpp,
+guessLanguage("foo.h", "#pragma(warning(disable:))"));
+  EXPECT_EQ(FormatStyle::LK_Cpp,
+guessLanguage("foo.h", "_Pragma(warning(disable:))"));
+}
+
 TEST_F(FormatTest, FormatsInlineAsmSymbolicNames) {
   // ASM symbolic names are identifiers that must be surrounded by [] without
   // space in between:



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


[llvm-branch-commits] [clang] 254677e - [clang-format] [NFC] Fix spelling and grammatical errors in IncludeBlocks text

2020-12-10 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-10T11:06:48Z
New Revision: 254677e9ed4e705c1138166dc8053edad8ee7ed3

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

LOG: [clang-format] [NFC] Fix spelling and grammatical errors in IncludeBlocks 
text

Fix spelling mistake
Leave space after `.` and before beginning of next sentence
Reword it slightly to try and make it more readable.
Ensure RST is updated correctly (it generated a change)

Reviewed By: HazardyKnusperkeks, curdeius

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

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Tooling/Inclusions/IncludeStyle.h

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 55d706fe..239c9177bec2 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -1713,11 +1713,11 @@ the configuration (without a prefix: ``Auto``).
   always need to be first.
 
   There is a third and optional field ``SortPriority`` which can used while
-  ``IncludeBloks = IBS_Regroup`` to define the priority in which ``#includes``
-  should be ordered, and value of ``Priority`` defines the order of
-  ``#include blocks`` and also enables to group ``#includes`` of 
diff erent
-  priority for order.``SortPriority`` is set to the value of ``Priority``
-  as default if it is not assigned.
+  ``IncludeBlocks = IBS_Regroup`` to define the priority in which
+  ``#includes`` should be ordered. The value of ``Priority`` defines the
+  order of ``#include blocks`` and also allows the grouping of ``#includes``
+  of 
diff erent priority. ``SortPriority`` is set to the value of
+  ``Priority`` as default if it is not assigned.
 
   Each regular expression can be marked as case sensitive with the field
   ``CaseSensitive``, per default it is not.

diff  --git a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h 
b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
index 89b0d4635251..4caaf4121f15 100644
--- a/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
+++ b/clang/include/clang/Tooling/Inclusions/IncludeStyle.h
@@ -89,12 +89,11 @@ struct IncludeStyle {
   /// always need to be first.
   ///
   /// There is a third and optional field ``SortPriority`` which can used while
-  /// ``IncludeBloks = IBS_Regroup`` to define the priority in which
-  /// ``#includes`` should be ordered, and value of ``Priority`` defines the
-  /// order of
-  /// ``#include blocks`` and also enables to group ``#includes`` of 
diff erent
-  /// priority for order.``SortPriority`` is set to the value of ``Priority``
-  /// as default if it is not assigned.
+  /// ``IncludeBlocks = IBS_Regroup`` to define the priority in which
+  /// ``#includes`` should be ordered. The value of ``Priority`` defines the
+  /// order of ``#include blocks`` and also allows the grouping of 
``#includes``
+  /// of 
diff erent priority. ``SortPriority`` is set to the value of
+  /// ``Priority`` as default if it is not assigned.
   ///
   /// Each regular expression can be marked as case sensitive with the field
   /// ``CaseSensitive``, per default it is not.



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


[llvm-branch-commits] [clang] 95616a0 - [clang-format] NFC Add release note for IndentPragmas

2020-12-10 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-10T11:24:12Z
New Revision: 95616a033c16146b55352c5fb93af82e00422920

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

LOG: [clang-format] NFC Add release note for IndentPragmas

Add additional release note to announce new clang-format option added during 
{D92753}

Added: 


Modified: 
clang/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 7d68cdb99b48..ef7903e16f7f 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -272,13 +272,15 @@ clang-format
 };
 
 
-- Experimental Support in clang-format for concepts has been improved, to 
+- Experimental Support in clang-format for concepts has been improved, to
   aid this the follow options have been added
 
 - Option ``IndentRequires`` has been added to indent the ``requires`` keyword
   in templates.
 - Option ``BreakBeforeConceptDeclarations`` has been added to aid the 
formatting of concepts.
 
+- Option ``IndentPragmas`` has been added to allow #pragma to indented with 
the current scope level. This is especially useful when using #pragma to mark 
OpenMP sections of code.
+
 
 libclang
 



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


[llvm-branch-commits] [openmp] e0665a9 - [OpenMP] Add support for Intel's umonitor/umwait

2020-12-01 Thread via llvm-branch-commits

Author: Terry Wilmarth
Date: 2020-12-01T14:07:46-06:00
New Revision: e0665a9050840650809fa4eb6ef23bd8f5adfbf0

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

LOG: [OpenMP] Add support for Intel's umonitor/umwait

These changes add support for Intel's umonitor/umwait usage in wait
code, for architectures that support those intrinsic functions. Usage of
umonitor/umwait is off by default, but can be turned on by setting the
KMP_USER_LEVEL_MWAIT environment variable.

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

Added: 


Modified: 
openmp/runtime/cmake/config-ix.cmake
openmp/runtime/src/i18n/en_US.txt
openmp/runtime/src/kmp.h
openmp/runtime/src/kmp_barrier.cpp
openmp/runtime/src/kmp_config.h.cmake
openmp/runtime/src/kmp_global.cpp
openmp/runtime/src/kmp_lock.cpp
openmp/runtime/src/kmp_os.h
openmp/runtime/src/kmp_runtime.cpp
openmp/runtime/src/kmp_settings.cpp
openmp/runtime/src/kmp_stats.h
openmp/runtime/src/kmp_taskdeps.cpp
openmp/runtime/src/kmp_tasking.cpp
openmp/runtime/src/kmp_wait_release.cpp
openmp/runtime/src/kmp_wait_release.h
openmp/runtime/src/z_Linux_util.cpp
openmp/runtime/src/z_Windows_NT_util.cpp

Removed: 




diff  --git a/openmp/runtime/cmake/config-ix.cmake 
b/openmp/runtime/cmake/config-ix.cmake
index f13290a9bc4a..b5bf39b07728 100644
--- a/openmp/runtime/cmake/config-ix.cmake
+++ b/openmp/runtime/cmake/config-ix.cmake
@@ -10,6 +10,7 @@
 
 include(CheckCCompilerFlag)
 include(CheckCSourceCompiles)
+include(CheckCXXSourceCompiles)
 include(CheckCXXCompilerFlag)
 include(CheckIncludeFile)
 include(CheckLibraryExists)
@@ -141,6 +142,53 @@ else()
   endif()
 endif()
 
+# Checking for x86-specific waitpkg and rtm attribute and intrinsics
+if (IA32 OR INTEL64)
+  check_include_file(immintrin.h LIBOMP_HAVE_IMMINTRIN_H)
+  if (NOT LIBOMP_HAVE_IMMINTRIN_H)
+check_include_file(intrin.h LIBOMP_HAVE_INTRIN_H)
+  endif()
+  check_cxx_source_compiles("__attribute__((target(\"rtm\")))
+ int main() {return 0;}" LIBOMP_HAVE_ATTRIBUTE_RTM)
+  check_cxx_source_compiles("__attribute__((target(\"waitpkg\")))
+int main() {return 0;}" 
LIBOMP_HAVE_ATTRIBUTE_WAITPKG)
+  libomp_append(CMAKE_REQUIRED_DEFINITIONS -DIMMINTRIN_H 
LIBOMP_HAVE_IMMINTRIN_H)
+  libomp_append(CMAKE_REQUIRED_DEFINITIONS -DINTRIN_H LIBOMP_HAVE_INTRIN_H)
+  libomp_append(CMAKE_REQUIRED_DEFINITIONS -DATTRIBUTE_WAITPKG 
LIBOMP_HAVE_ATTRIBUTE_WAITPKG)
+  libomp_append(CMAKE_REQUIRED_DEFINITIONS -DATTRIBUTE_RTM 
LIBOMP_HAVE_ATTRIBUTE_RTM)
+  set(source_code "// check for attribute and wait pkg intrinsics
+  #ifdef IMMINTRIN_H
+  #include 
+  #endif
+  #ifdef INTRIN_H
+  #include 
+  #endif
+  #ifdef ATTRIBUTE_WAITPKG
+  __attribute__((target(\"waitpkg\")))
+  #endif
+  static inline int __kmp_umwait(unsigned hint, unsigned long long 
counter) {
+return _umwait(hint, counter);
+  }
+  int main() { int a = __kmp_umwait(0, 1000); return a; }")
+  check_cxx_source_compiles("${source_code}" LIBOMP_HAVE_WAITPKG_INTRINSICS)
+  set(source_code "// check for attribute rtm and rtm intrinsics
+  #ifdef IMMINTRIN_H
+  #include 
+  #endif
+  #ifdef INTRIN_H
+  #include 
+  #endif
+  #ifdef ATTRIBUTE_RTM
+  __attribute__((target(\"rtm\")))
+  #endif
+  static inline int __kmp_xbegin() {
+return _xbegin();
+  }
+  int main() { int a = __kmp_xbegin(); return a; }")
+  check_cxx_source_compiles("${source_code}" LIBOMP_HAVE_RTM_INTRINSICS)
+  set(CMAKE_REQUIRED_DEFINITIONS)
+endif()
+
 # Find perl executable
 # Perl is used to create omp.h (and other headers) along with kmp_i18n_id.inc 
and kmp_i18n_default.inc
 find_package(Perl REQUIRED)

diff  --git a/openmp/runtime/src/i18n/en_US.txt 
b/openmp/runtime/src/i18n/en_US.txt
index 0b084426fb41..26f4cf572dab 100644
--- a/openmp/runtime/src/i18n/en_US.txt
+++ b/openmp/runtime/src/i18n/en_US.txt
@@ -417,6 +417,8 @@ AffUsingHwloc"%1$s: Affinity capable, using 
hwloc."
 AffIgnoringHwloc "%1$s: Ignoring hwloc mechanism."
 AffHwlocErrorOccurred"%1$s: Hwloc failed in %2$s. Relying on internal 
affinity mechanisms."
 EnvSerialWarn"%1$s must be set prior to OpenMP runtime library 
initialization; ignored."
+EnvMwaitWarn "You have enabled the use of umonitor/umwait. If 
the CPU doesn't have that enabled "
+ "you'll get an illegal instruction exception."
 EnvVarDeprecated "%1$s variable deprecated, please use %2$s 
instead."
 RedMethodNotSupported"KMP_FORCE_REDUCTION: %1$s method is not 
supported; using critical."
 AffHWSubsetNoHWLOC  

[llvm-branch-commits] [clang] 1b8ed1d - [OpenMP51][DOCS] Claim "add present modifier in defaultmap clause", NFC.

2020-12-01 Thread via llvm-branch-commits

Author: cchen
Date: 2020-12-01T16:07:00-06:00
New Revision: 1b8ed1d03dee63fd0b787ab52d0b195df9c35b9c

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

LOG: [OpenMP51][DOCS] Claim "add present modifier in defaultmap clause", NFC.

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 227b373957ea..afa357a4d873 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -272,7 +272,7 @@ want to help with the implementation.
 
+--+--+--+---+
 | device extension | 'present' motion modifier 
   | :good:`done` | D84711, D84712  
  |
 
+--+--+--+---+
-| device extension | 'present' in defaultmap clause
   | :none:`unclaimed`| 
  |
+| device extension | 'present' in defaultmap clause
   | :part:`worked on`| D92427  
  |
 
+--+--+--+---+
 | device extension | map clause reordering reordering based on 
'present' modifier | :none:`unclaimed`| 
  |
 
+--+--+--+---+



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


[llvm-branch-commits] [clang] a36f8fb - [NFC] Add proper triple for arc.ll test

2020-12-02 Thread via llvm-branch-commits

Author: Yuanfang Chen
Date: 2020-12-02T23:31:06-08:00
New Revision: a36f8fb021d0a1719400eda446131290be21c3ed

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

LOG: [NFC] Add proper triple for arc.ll test

Added: 


Modified: 
clang/test/CodeGenObjC/arc.ll

Removed: 




diff  --git a/clang/test/CodeGenObjC/arc.ll b/clang/test/CodeGenObjC/arc.ll
index f23c656c3498..7b903d05cd17 100644
--- a/clang/test/CodeGenObjC/arc.ll
+++ b/clang/test/CodeGenObjC/arc.ll
@@ -1,4 +1,4 @@
-; RUN: %clang_cc1 -Os -emit-llvm -fobjc-arc -o - %s | FileCheck %s
+; RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Os -emit-llvm -fobjc-arc -o - 
%s | FileCheck %s
 
 target triple = "x86_64-apple-darwin10"
 



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


[llvm-branch-commits] [llvm] 1de56d6 - [llvmbuildectomy] Also include component groups in llvm-config --components list

2020-11-26 Thread via llvm-branch-commits

Author: Mariusz Ceier
Date: 2020-11-26T21:05:56+01:00
New Revision: 1de56d6d13c083c996dfd44a32041dacae037d66

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

LOG: [llvmbuildectomy] Also include component groups in llvm-config 
--components list

Without this change mesa fails while looking for llvm components like amdgpu, 
engine or native:

Run-time dependency LLVM (modules: amdgpu(missing), bitreader, bitwriter, 
core, engine(missing), executionengine, instcombine, ipo, mcdisassembler, 
mcjit, native(missing), scalaropts, transformutils, coroutines)
Looking for a fallback subproject for the dependency llvm (modules: 
bitwriter, engine, mcdisassembler, mcjit, core, executionengine, scalaropts, 
transformutils, instcombine, amdgpu, native, bitreader, ipo)

This change adds component groups (like all-targets, engine, native, amdgpu) to 
the "all" component.

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

Added: 


Modified: 
llvm/cmake/modules/LLVM-Build.cmake

Removed: 




diff  --git a/llvm/cmake/modules/LLVM-Build.cmake 
b/llvm/cmake/modules/LLVM-Build.cmake
index ce56273c5a1d..525186cbbb19 100644
--- a/llvm/cmake/modules/LLVM-Build.cmake
+++ b/llvm/cmake/modules/LLVM-Build.cmake
@@ -11,12 +11,9 @@ function(LLVMBuildGenerateCFragment)
 list(APPEND all_component_libdeps ${component_name})
   endforeach()
   list(APPEND llvmbuild_components all)
-  list(APPEND llvmbuild_components all-targets)
-  list(APPEND llvmbuild_components Engine)
-  list(APPEND llvmbuild_components Native)
-  list(APPEND llvmbuild_components NativeCodeGen)
-  foreach(llvm_target_to_build ${LLVM_TARGETS_TO_BUILD})
-list(APPEND llvmbuild_components ${llvm_target_to_build})
+  foreach(llvm_component all-targets Engine Native NativeCodeGen 
${LLVM_TARGETS_TO_BUILD})
+list(APPEND llvmbuild_components ${llvm_component})
+list(APPEND all_component_libdeps ${llvm_component})
   endforeach()
 
   list(LENGTH llvmbuild_components llvmbuild_components_size)



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


[llvm-branch-commits] [mlir] 7f52131 - Use `const` for array pointers in `StandardTypes.h`

2020-11-29 Thread via llvm-branch-commits

Author: George
Date: 2020-11-29T10:13:35-08:00
New Revision: 7f521318e4f7d9e64907fad8c4bd83ddc037f8c6

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

LOG: Use `const` for array pointers in `StandardTypes.h`

This mirrors the underlying C++ api.

Reviewed By: mehdi_amini

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

Added: 


Modified: 
mlir/include/mlir-c/StandardTypes.h
mlir/lib/CAPI/IR/StandardTypes.cpp

Removed: 




diff  --git a/mlir/include/mlir-c/StandardTypes.h 
b/mlir/include/mlir-c/StandardTypes.h
index 7b51ad8d6a77..9839a1946ad9 100644
--- a/mlir/include/mlir-c/StandardTypes.h
+++ b/mlir/include/mlir-c/StandardTypes.h
@@ -164,13 +164,14 @@ MLIR_CAPI_EXPORTED int mlirTypeIsAVector(MlirType type);
 /** Creates a vector type of the shape identified by its rank and dimensions,
  * with the given element type in the same context as the element type. The 
type
  * is owned by the context. */
-MLIR_CAPI_EXPORTED MlirType mlirVectorTypeGet(intptr_t rank, int64_t *shape,
+MLIR_CAPI_EXPORTED MlirType mlirVectorTypeGet(intptr_t rank,
+  const int64_t *shape,
   MlirType elementType);
 
 /** Same as "mlirVectorTypeGet" but returns a nullptr wrapping MlirType on
  * illegal arguments, emitting appropriate diagnostics. */
 MLIR_CAPI_EXPORTED MlirType mlirVectorTypeGetChecked(intptr_t rank,
- int64_t *shape,
+ const int64_t *shape,
  MlirType elementType,
  MlirLocation loc);
 
@@ -190,13 +191,13 @@ MLIR_CAPI_EXPORTED int mlirTypeIsAUnrankedTensor(MlirType 
type);
 /** Creates a tensor type of a fixed rank with the given shape and element type
  * in the same context as the element type. The type is owned by the context. 
*/
 MLIR_CAPI_EXPORTED MlirType mlirRankedTensorTypeGet(intptr_t rank,
-int64_t *shape,
+const int64_t *shape,
 MlirType elementType);
 
 /** Same as "mlirRankedTensorTypeGet" but returns a nullptr wrapping MlirType 
on
  * illegal arguments, emitting appropriate diagnostics. */
 MLIR_CAPI_EXPORTED MlirType mlirRankedTensorTypeGetChecked(intptr_t rank,
-   int64_t *shape,
+   const int64_t 
*shape,
MlirType 
elementType,
MlirLocation loc);
 
@@ -222,11 +223,9 @@ MLIR_CAPI_EXPORTED int mlirTypeIsAUnrankedMemRef(MlirType 
type);
 /** Creates a MemRef type with the given rank and shape, a potentially empty
  * list of affine layout maps, the given memory space and element type, in the
  * same context as element type. The type is owned by the context. */
-MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeGet(MlirType elementType,
-  intptr_t rank, int64_t *shape,
-  intptr_t numMaps,
-  MlirAttribute const *affineMaps,
-  unsigned memorySpace);
+MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeGet(
+MlirType elementType, intptr_t rank, const int64_t *shape, intptr_t 
numMaps,
+MlirAttribute const *affineMaps, unsigned memorySpace);
 
 /** Creates a MemRef type with the given rank, shape, memory space and element
  * type in the same context as the element type. The type has no affine maps,
@@ -234,14 +233,14 @@ MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeGet(MlirType 
elementType,
  * the context. */
 MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeContiguousGet(MlirType elementType,
 intptr_t rank,
-int64_t *shape,
+const int64_t *shape,
 unsigned memorySpace);
 
 /** Same as "mlirMemRefTypeContiguousGet" but returns a nullptr wrapping
  * MlirType on illegal arguments, emitting appropriate diagnostics. */
 MLIR_CAPI_EXPORTED MlirType mlirMemRefTypeContiguousGetChecked(
-MlirType elementType, intptr_t rank, int64_t *shape, unsigned memorySpace,
-MlirLocation loc);
+MlirType elementType, intptr_t rank, const int64_t *shape,
+unsigned memorySpace, MlirLocation loc);
 
 /** Creates an 

[llvm-branch-commits] [openmp] 9615890 - [OpenMP] libomp: change shm name to include UID, call unregister_lib on SIGTERM

2020-11-30 Thread via llvm-branch-commits

Author: Todd Erdner
Date: 2020-12-01T00:40:47+03:00
New Revision: 9615890db576721fbd73ae77d81d39435e83b4b4

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

LOG: [OpenMP] libomp: change shm name to include UID, call unregister_lib on 
SIGTERM

With the change to using shared memory, there were a few problems that need to 
be fixed.
- The previous filename that was used for SHM only used process id. Given that 
process is
  usually based on 16bit number, this was causing some conflicts on machines. 
Thus we add
  UID to the name to prevent this.
- It appears under some conditions (SIGTERM, etc) the shared memory files were 
not getting
  cleaned up. Added a call to clean up the shm files under those conditions. 
For this user
  needs to set envirable KMP_HANDLE_SIGNALS to true.

Patch by Erdner, Todd 

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

Added: 


Modified: 
openmp/runtime/src/kmp.h
openmp/runtime/src/kmp_runtime.cpp
openmp/runtime/src/z_Linux_util.cpp

Removed: 




diff  --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 3acee73dde4b..4aef35989ac9 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -3132,6 +3132,7 @@ extern void __kmp_internal_end_dest(void *);
 
 extern int __kmp_register_root(int initial_thread);
 extern void __kmp_unregister_root(int gtid);
+extern void __kmp_unregister_library(void); // called by __kmp_internal_end()
 
 extern int __kmp_ignore_mppbeg(void);
 extern int __kmp_ignore_mppend(void);

diff  --git a/openmp/runtime/src/kmp_runtime.cpp 
b/openmp/runtime/src/kmp_runtime.cpp
index c4fb008ecb47..aaaf9de35435 100644
--- a/openmp/runtime/src/kmp_runtime.cpp
+++ b/openmp/runtime/src/kmp_runtime.cpp
@@ -98,7 +98,6 @@ static int __kmp_expand_threads(int nNeed);
 #if KMP_OS_WINDOWS
 static int __kmp_unregister_root_other_thread(int gtid);
 #endif
-static void __kmp_unregister_library(void); // called by __kmp_internal_end()
 static void __kmp_reap_thread(kmp_info_t *thread, int is_root);
 kmp_info_t *__kmp_thread_pool_insert_pt = NULL;
 
@@ -6360,7 +6359,12 @@ static inline char *__kmp_reg_status_name() {
  each thread. If registration and unregistration go in 
diff erent threads
  (omp_misc_other_root_exit.cpp test case), the name of registered_lib_env
  env var can not be found, because the name will contain 
diff erent pid. */
+#if KMP_OS_UNIX && KMP_DYNAMIC_LIB // shared memory is with dynamic library
+  return __kmp_str_format("__KMP_REGISTERED_LIB_%d_%d", (int)getpid(),
+  (int)getuid());
+#else
   return __kmp_str_format("__KMP_REGISTERED_LIB_%d", (int)getpid());
+#endif
 } // __kmp_reg_status_get
 
 void __kmp_register_library_startup(void) {

diff  --git a/openmp/runtime/src/z_Linux_util.cpp 
b/openmp/runtime/src/z_Linux_util.cpp
index 58cc4d25f608..a3c9c3382354 100644
--- a/openmp/runtime/src/z_Linux_util.cpp
+++ b/openmp/runtime/src/z_Linux_util.cpp
@@ -1149,6 +1149,7 @@ static void __kmp_team_handler(int signo) {
   if (__kmp_debug_buf) {
 __kmp_dump_debug_buffer();
   }
+  __kmp_unregister_library(); // cleanup shared memory
   KMP_MB(); // Flush all pending memory write invalidates.
   TCW_4(__kmp_global.g.g_abort, signo);
   KMP_MB(); // Flush all pending memory write invalidates.



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


[llvm-branch-commits] [openmp] f6f28b4 - [OpenMP] libomp: fix mutexinoutset dependence for proxy tasks

2020-11-30 Thread via llvm-branch-commits

Author: AndreyChurbanov
Date: 2020-12-01T00:13:31+03:00
New Revision: f6f28b44ad48e35d1300693d9c34f47782b519a4

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

LOG: [OpenMP] libomp: fix mutexinoutset dependence for proxy tasks

Once __kmp_task_finish is not executed for proxy tasks,
move mutexinoutset dependency code to __kmp_release_deps
which is executed for all task kinds.

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

Added: 


Modified: 
openmp/runtime/src/kmp_taskdeps.h
openmp/runtime/src/kmp_tasking.cpp

Removed: 




diff  --git a/openmp/runtime/src/kmp_taskdeps.h 
b/openmp/runtime/src/kmp_taskdeps.h
index 2a712b348af6..4e5f8851f6b2 100644
--- a/openmp/runtime/src/kmp_taskdeps.h
+++ b/openmp/runtime/src/kmp_taskdeps.h
@@ -89,6 +89,16 @@ static inline void __kmp_release_deps(kmp_int32 gtid, 
kmp_taskdata_t *task) {
   kmp_info_t *thread = __kmp_threads[gtid];
   kmp_depnode_t *node = task->td_depnode;
 
+  // Check mutexinoutset dependencies, release locks
+  if (UNLIKELY(node && (node->dn.mtx_num_locks < 0))) {
+// negative num_locks means all locks were acquired
+node->dn.mtx_num_locks = -node->dn.mtx_num_locks;
+for (int i = node->dn.mtx_num_locks - 1; i >= 0; --i) {
+  KMP_DEBUG_ASSERT(node->dn.mtx_locks[i] != NULL);
+  __kmp_release_lock(node->dn.mtx_locks[i], gtid);
+}
+  }
+
   if (task->td_dephash) {
 KA_TRACE(
 40, ("__kmp_release_deps: T#%d freeing dependencies hash of task 
%p.\n",

diff  --git a/openmp/runtime/src/kmp_tasking.cpp 
b/openmp/runtime/src/kmp_tasking.cpp
index 3dfc3c4030d4..283bb934cd8f 100644
--- a/openmp/runtime/src/kmp_tasking.cpp
+++ b/openmp/runtime/src/kmp_tasking.cpp
@@ -849,17 +849,6 @@ static void __kmp_task_finish(kmp_int32 gtid, kmp_task_t 
*task,
 }
   }
 
-  // Check mutexinoutset dependencies, release locks
-  kmp_depnode_t *node = taskdata->td_depnode;
-  if (node && (node->dn.mtx_num_locks < 0)) {
-// negative num_locks means all locks were acquired
-node->dn.mtx_num_locks = -node->dn.mtx_num_locks;
-for (int i = node->dn.mtx_num_locks - 1; i >= 0; --i) {
-  KMP_DEBUG_ASSERT(node->dn.mtx_locks[i] != NULL);
-  __kmp_release_lock(node->dn.mtx_locks[i], gtid);
-}
-  }
-
   // bookkeeping for resuming task:
   // GEH - note tasking_ser => task_serial
   KMP_DEBUG_ASSERT(



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


[llvm-branch-commits] [libcxx] 644f68e - [libc++] Add slice_array operator= valarray overload.

2020-12-02 Thread via llvm-branch-commits

Author: zoecarver
Date: 2020-12-02T10:49:20-08:00
New Revision: 644f68ed4d741f33d254354c2b7bc9606b77c721

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

LOG: [libc++] Add slice_array operator= valarray overload.

Add the slice_array::operator=(const std::valarray& val_arr) overload.

Fixes https://llvm.org/PR40792.

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

Added: 

libcxx/test/std/numerics/numarray/template.slice.array/slice.arr.assign/template.pass.cpp

Modified: 
libcxx/include/valarray

libcxx/test/std/numerics/numarray/template.slice.array/slice.arr.assign/valarray.pass.cpp

Removed: 




diff  --git a/libcxx/include/valarray b/libcxx/include/valarray
index aaae6fbd5b3f..9654cd5aa998 100644
--- a/libcxx/include/valarray
+++ b/libcxx/include/valarray
@@ -136,6 +136,7 @@ public:
 void operator>>=(const valarray& v) const;
 
 void operator=(const value_type& x) const;
+void operator=(const valarray& val_arr) const;
 
 slice_array() = delete;
 };
@@ -1264,6 +1265,9 @@ public:
 _LIBCPP_INLINE_VISIBILITY
 void operator=(const value_type& __x) const;
 
+_LIBCPP_INLINE_VISIBILITY
+void operator=(const valarray& __va) const;
+
 private:
 _LIBCPP_INLINE_VISIBILITY
 slice_array(const slice& __sl, const valarray& __v)
@@ -1303,6 +1307,15 @@ slice_array<_Tp>::operator=(const _Expr& __v) const
 *__t = __v[__i];
 }
 
+template 
+inline void
+slice_array<_Tp>::operator=(const valarray& __va) const
+{
+value_type* __t = __vp_;
+for (size_t __i = 0; __i < __va.size(); ++__i, __t += __stride_)
+*__t = __va[__i];
+}
+
 template 
 template 
 inline

diff  --git 
a/libcxx/test/std/numerics/numarray/template.slice.array/slice.arr.assign/template.pass.cpp
 
b/libcxx/test/std/numerics/numarray/template.slice.array/slice.arr.assign/template.pass.cpp
new file mode 100644
index ..de2ffce12b90
--- /dev/null
+++ 
b/libcxx/test/std/numerics/numarray/template.slice.array/slice.arr.assign/template.pass.cpp
@@ -0,0 +1,33 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+// 
+
+// template  class slice_array
+
+// void operator=(const T& value) const;
+
+#include 
+#include 
+
+#include "test_macros.h"
+
+int main(int, char**)
+{
+double a[] = { 0, 0, 0 };
+std::valarray m(a, sizeof(a)/sizeof(a[0]));
+std::slice_array s = m[std::slice(0, 3, 1)];
+s = 42;
+assert(m[0] == 42);
+assert(m[1] == 42);
+assert(m[2] == 42);
+
+ASSERT_SAME_TYPE(decltype(s = 42), void);
+
+return 0;
+}

diff  --git 
a/libcxx/test/std/numerics/numarray/template.slice.array/slice.arr.assign/valarray.pass.cpp
 
b/libcxx/test/std/numerics/numarray/template.slice.array/slice.arr.assign/valarray.pass.cpp
index d1d9fe18bea7..a09ef7971368 100644
--- 
a/libcxx/test/std/numerics/numarray/template.slice.array/slice.arr.assign/valarray.pass.cpp
+++ 
b/libcxx/test/std/numerics/numarray/template.slice.array/slice.arr.assign/valarray.pass.cpp
@@ -23,7 +23,8 @@ int main(int, char**)
 int a2[] = {-1, -2, -3, -4, -5};
 std::valarray v1(a1, sizeof(a1)/sizeof(a1[0]));
 std::valarray v2(a2, sizeof(a2)/sizeof(a2[0]));
-v1[std::slice(1, 5, 3)] = v2;
+std::slice_array s1 = v1[std::slice(1, 5, 3)];
+s1 = v2;
 assert(v1.size() == 16);
 assert(v1[ 0] ==  0);
 assert(v1[ 1] == -1);
@@ -42,5 +43,19 @@ int main(int, char**)
 assert(v1[14] == 14);
 assert(v1[15] == 15);
 
-  return 0;
+ASSERT_SAME_TYPE(decltype(s1 = v2), void);
+
+// The initializer list constructor is disabled in C++03 mode.
+#if TEST_STD_VER > 03
+std::valarray m = { 0, 0, 0 };
+std::slice_array s2 = m[std::slice(0, 3, 1)];
+s2 = { 1, 2, 3 };
+assert(m[0] == 1);
+assert(m[1] == 2);
+assert(m[2] == 3);
+
+ASSERT_SAME_TYPE(decltype(s2 = {1, 2, 3}), void);
+#endif // TEST_STD_VER > 03
+
+return 0;
 }



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


[llvm-branch-commits] [llvm] a65d8c5 - [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-12-02 Thread via llvm-branch-commits

Author: jasonliu
Date: 2020-12-02T18:42:44Z
New Revision: a65d8c5d720db8c646adb0ad9dac54da5d5fa230

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

LOG: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

Summary:
AIX uses the existing EH infrastructure in clang and llvm.
The major differences would be
1. AIX do not have CFI instructions.
2. AIX uses a new personality routine, named __xlcxx_personality_v1.
   It doesn't use the GCC personality rountine, because the
   interoperability is not there yet on AIX.
3. AIX do not use eh_frame sections. Instead, it would use a eh_info
section (compat unwind section) to store the information about
personality routine and LSDA data address.

Reviewed By: daltenty, hubert.reinterpretcast

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

Added: 
llvm/lib/CodeGen/AsmPrinter/AIXException.cpp
llvm/test/CodeGen/PowerPC/aix-exception.ll

Modified: 
clang/lib/CodeGen/CGCleanup.h
clang/lib/CodeGen/CGException.cpp
clang/test/CodeGenCXX/personality.cpp
llvm/include/llvm/Analysis/EHPersonalities.h
llvm/include/llvm/CodeGen/AsmPrinter.h
llvm/include/llvm/MC/MCTargetOptions.h
llvm/lib/Analysis/EHPersonalities.cpp
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt
llvm/lib/CodeGen/AsmPrinter/DwarfException.h
llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/lib/CodeGen/TargetPassConfig.cpp
llvm/lib/MC/MCAsmInfoXCOFF.cpp
llvm/lib/MC/MCObjectFileInfo.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGCleanup.h b/clang/lib/CodeGen/CGCleanup.h
index ef4f6b9ec133..1b54c0018d27 100644
--- a/clang/lib/CodeGen/CGCleanup.h
+++ b/clang/lib/CodeGen/CGCleanup.h
@@ -612,6 +612,7 @@ struct EHPersonality {
   static const EHPersonality MSVC_C_specific_handler;
   static const EHPersonality MSVC_CxxFrameHandler3;
   static const EHPersonality GNU_Wasm_CPlusPlus;
+  static const EHPersonality XL_CPlusPlus;
 
   /// Does this personality use landingpads or the family of pad instructions
   /// designed to form funclets?

diff  --git a/clang/lib/CodeGen/CGException.cpp 
b/clang/lib/CodeGen/CGException.cpp
index bdf70252b5ad..85604cf5e611 100644
--- a/clang/lib/CodeGen/CGException.cpp
+++ b/clang/lib/CodeGen/CGException.cpp
@@ -113,6 +113,8 @@ const EHPersonality
 EHPersonality::MSVC_CxxFrameHandler3 = { "__CxxFrameHandler3", nullptr };
 const EHPersonality
 EHPersonality::GNU_Wasm_CPlusPlus = { "__gxx_wasm_personality_v0", nullptr };
+const EHPersonality EHPersonality::XL_CPlusPlus = {"__xlcxx_personality_v1",
+   nullptr};
 
 static const EHPersonality (const TargetInfo ,
 const LangOptions ) {
@@ -161,6 +163,8 @@ static const EHPersonality (const 
TargetInfo ,
   const llvm::Triple  = Target.getTriple();
   if (T.isWindowsMSVCEnvironment())
 return EHPersonality::MSVC_CxxFrameHandler3;
+  if (T.isOSAIX())
+return EHPersonality::XL_CPlusPlus;
   if (L.SjLjExceptions)
 return EHPersonality::GNU_CPlusPlus_SJLJ;
   if (L.DWARFExceptions)

diff  --git a/clang/test/CodeGenCXX/personality.cpp 
b/clang/test/CodeGenCXX/personality.cpp
index ce4bad370d91..1bdc7736c4da 100644
--- a/clang/test/CodeGenCXX/personality.cpp
+++ b/clang/test/CodeGenCXX/personality.cpp
@@ -12,6 +12,9 @@
 // RUN: %clang_cc1 -triple i686-unknown-windows-gnu -fexceptions 
-fseh-exceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s 
-check-prefix CHECK-GNU-SEH
 // RUN: %clang_cc1 -triple i686-unknown-windows-gnu -fexceptions 
-fsjlj-exceptions -fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s 
-check-prefix CHECK-GNU-SJLJ
 
+// RUN: %clang_cc1 -triple powerpc-unknown-aix-xcoff -fexceptions 
-fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-AIX
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix-xcoff -fexceptions 
-fcxx-exceptions -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-AIX
+
 extern void g();
 
 // CHECK-GNU: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
@@ -21,6 +24,8 @@ extern void g();
 
 // CHECK-WIN: personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
 
+// CHECK-AIX: personality i8* bitcast (i32 (...)* @__xlcxx_personality_v1 to 
i8*)
+
 void f() {
   try {
 g();

diff  --git a/llvm/include/llvm/Analysis/EHPersonalities.h 
b/llvm/include/llvm/Analysis/EHPersonalities.h
index 1905e0543fee..eaada6627494 100644
--- a/llvm/include/llvm/Analysis/EHPersonalities.h
+++ 

[llvm-branch-commits] [llvm] 2c63e76 - [XCOFF][AIX] Alternative path in EHStreamer for platforms do not have uleb128 support

2020-12-02 Thread via llvm-branch-commits

Author: jasonliu
Date: 2020-12-02T20:03:15Z
New Revision: 2c63e7604c87d97723919ca00d80ea38cddca8f9

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

LOG: [XCOFF][AIX] Alternative path in EHStreamer for platforms do not have 
uleb128 support

Summary:
Not all system assembler supports `.uleb128 label2 - label1` form.
When the target do not support this form, we have to take
alternative manual calculation to get the offsets from them.

Reviewed By: hubert.reinterpretcast

Diffierential Revision: https://reviews.llvm.org/D92058

Added: 
llvm/test/CodeGen/X86/gnu-eh-alternative.ll

Modified: 
llvm/include/llvm/MC/MCAsmInfo.h
llvm/include/llvm/Target/TargetLoweringObjectFile.h
llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
llvm/lib/MC/MCAsmInfo.cpp
llvm/lib/MC/MCAsmInfoXCOFF.cpp
llvm/lib/Target/TargetLoweringObjectFile.cpp
llvm/test/CodeGen/PowerPC/aix-exception.ll

Removed: 




diff  --git a/llvm/include/llvm/MC/MCAsmInfo.h 
b/llvm/include/llvm/MC/MCAsmInfo.h
index 2b889d0ed5fa..c55dab4e7973 100644
--- a/llvm/include/llvm/MC/MCAsmInfo.h
+++ b/llvm/include/llvm/MC/MCAsmInfo.h
@@ -186,6 +186,9 @@ class MCAsmInfo {
   /// alignment is supported.
   bool UseDotAlignForAlignment = false;
 
+  /// True if the target supports LEB128 directives.
+  bool HasLEB128Directives = true;
+
   //===--- Data Emission Directives -===//
 
   /// This should be set to the directive used to get some number of zero (and
@@ -575,6 +578,8 @@ class MCAsmInfo {
 return UseDotAlignForAlignment;
   }
 
+  bool hasLEB128Directives() const { return HasLEB128Directives; }
+
   const char *getZeroDirective() const { return ZeroDirective; }
   bool doesZeroDirectiveSupportNonZeroValue() const {
 return ZeroDirectiveSupportsNonZeroValue;

diff  --git a/llvm/include/llvm/Target/TargetLoweringObjectFile.h 
b/llvm/include/llvm/Target/TargetLoweringObjectFile.h
index edae4bb509ee..90041f077523 100644
--- a/llvm/include/llvm/Target/TargetLoweringObjectFile.h
+++ b/llvm/include/llvm/Target/TargetLoweringObjectFile.h
@@ -157,7 +157,7 @@ class TargetLoweringObjectFile : public MCObjectFileInfo {
   unsigned getPersonalityEncoding() const { return PersonalityEncoding; }
   unsigned getLSDAEncoding() const { return LSDAEncoding; }
   unsigned getTTypeEncoding() const { return TTypeEncoding; }
-  unsigned getCallSiteEncoding() const { return CallSiteEncoding; }
+  unsigned getCallSiteEncoding() const;
 
   const MCExpr *getTTypeReference(const MCSymbolRefExpr *Sym, unsigned 
Encoding,
   MCStreamer ) const;

diff  --git a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp 
b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
index b6fc83285a20..2ffe8a7b0469 100644
--- a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
@@ -413,6 +413,7 @@ MCSymbol *EHStreamer::emitExceptionTable() {
 
   bool IsSJLJ = Asm->MAI->getExceptionHandlingType() == 
ExceptionHandling::SjLj;
   bool IsWasm = Asm->MAI->getExceptionHandlingType() == 
ExceptionHandling::Wasm;
+  bool HasLEB128Directives = Asm->MAI->hasLEB128Directives();
   unsigned CallSiteEncoding =
   IsSJLJ ? static_cast(dwarf::DW_EH_PE_udata4) :
Asm->getObjFileLowering().getCallSiteEncoding();
@@ -505,6 +506,79 @@ MCSymbol *EHStreamer::emitExceptionTable() {
 Asm->OutStreamer->emitLabel(CstBeginLabel);
   };
 
+  // An alternative path to EmitTypeTableRefAndCallSiteTableEndRef.
+  // For some platforms, the system assembler does not accept the form of
+  // `.uleb128 label2 - label1`. In those situations, we would need to 
calculate
+  // the size between label1 and label2 manually.
+  // In this case, we would need to calculate the LSDA size and the call
+  // site table size.
+  auto EmitTypeTableOffsetAndCallSiteTableOffset = [&]() {
+assert(CallSiteEncoding == dwarf::DW_EH_PE_udata4 && !HasLEB128Directives 
&&
+   "Targets supporting .uleb128 do not need to take this path.");
+if (CallSiteRanges.size() > 1)
+  report_fatal_error(
+  "-fbasic-block-sections is not yet supported on "
+  "platforms that do not have general LEB128 directive support.");
+
+uint64_t CallSiteTableSize = 0;
+const CallSiteRange  = CallSiteRanges.back();
+for (size_t CallSiteIdx = CSRange.CallSiteBeginIdx;
+ CallSiteIdx < CSRange.CallSiteEndIdx; ++CallSiteIdx) {
+  const CallSiteEntry  = CallSites[CallSiteIdx];
+  // Each call site entry consists of 3 udata4 fields (12 bytes) and
+  // 1 ULEB128 field.
+  CallSiteTableSize += 12 + getULEB128Size(S.Action);
+  assert(isUInt<32>(CallSiteTableSize) && "CallSiteTableSize overflows.");
+}
+
+Asm->emitEncodingByte(TTypeEncoding, 

[llvm-branch-commits] [compiler-rt] 17427ec - [RISCV][crt] support building without init_array

2020-12-01 Thread via llvm-branch-commits

Author: Alexey Baturo
Date: 2020-12-01T17:17:50+03:00
New Revision: 17427ec3f31c2a95c106dbaa98c43b72a7c06a31

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

LOG: [RISCV][crt] support building without init_array

Reviewed By: luismarques, phosek, kito-cheng

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

Added: 


Modified: 
compiler-rt/lib/crt/crtbegin.c

Removed: 




diff  --git a/compiler-rt/lib/crt/crtbegin.c b/compiler-rt/lib/crt/crtbegin.c
index 24bea1a2c3a7..481c158ac777 100644
--- a/compiler-rt/lib/crt/crtbegin.c
+++ b/compiler-rt/lib/crt/crtbegin.c
@@ -52,6 +52,10 @@ __attribute__((section(".init_array"),
 __asm__(".pushsection .init,\"ax\",@progbits\n\t"
 "call " __USER_LABEL_PREFIX__ "__do_init\n\t"
 ".popsection");
+#elif defined(__riscv)
+__asm__(".pushsection .init,\"ax\",%progbits\n\t"
+"call " __USER_LABEL_PREFIX__ "__do_init\n\t"
+".popsection");
 #elif defined(__arm__) || defined(__aarch64__)
 __asm__(".pushsection .init,\"ax\",%progbits\n\t"
 "bl " __USER_LABEL_PREFIX__ "__do_init\n\t"
@@ -110,6 +114,10 @@ __asm__(".pushsection .fini,\"ax\",@progbits\n\t"
 "bl " __USER_LABEL_PREFIX__ "__do_fini\n\t"
 "nop\n\t"
 ".popsection");
+#elif defined(__riscv)
+__asm__(".pushsection .fini,\"ax\",@progbits\n\t"
+"call " __USER_LABEL_PREFIX__ "__do_fini\n\t"
+".popsection");
 #elif defined(__sparc__)
 __asm__(".pushsection .fini,\"ax\",@progbits\n\t"
 "call " __USER_LABEL_PREFIX__ "__do_fini\n\t"



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


[llvm-branch-commits] [openmp] 6bf8487 - [OpenMP] libomp: add UNLIKELY hints to rarely executed branches

2020-12-01 Thread via llvm-branch-commits

Author: AndreyChurbanov
Date: 2020-12-01T16:53:21+03:00
New Revision: 6bf84871e9382fe7bde1117194bc15abb2b09f68

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

LOG: [OpenMP] libomp: add UNLIKELY hints to rarely executed branches

Added UNLIKELY hint to one-time or rarely executed branches.
This improves performance of the library on some tasking benchmarks.

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

Added: 


Modified: 
openmp/runtime/src/kmp_itt.inl
openmp/runtime/src/kmp_tasking.cpp

Removed: 




diff  --git a/openmp/runtime/src/kmp_itt.inl b/openmp/runtime/src/kmp_itt.inl
index 29a05cb86a3f..6257cea4faf3 100644
--- a/openmp/runtime/src/kmp_itt.inl
+++ b/openmp/runtime/src/kmp_itt.inl
@@ -630,7 +630,7 @@ void __kmp_itt_barrier_finished(int gtid, void *object) {
 void *__kmp_itt_taskwait_object(int gtid) {
   void *object = NULL;
 #if USE_ITT_NOTIFY
-  if (__itt_sync_create_ptr) {
+  if (UNLIKELY(__itt_sync_create_ptr)) {
 kmp_info_t *thread = __kmp_thread_from_gtid(gtid);
 kmp_taskdata_t *taskdata = thread->th.th_current_task;
 object = reinterpret_cast(kmp_uintptr_t(taskdata) +
@@ -677,7 +677,7 @@ void __kmp_itt_task_starting(
 void *object // ITT sync object: barrier or taskwait.
 ) {
 #if USE_ITT_NOTIFY
-  if (object != NULL) {
+  if (UNLIKELY(object != NULL)) {
 KMP_ITT_DEBUG_LOCK();
 __itt_sync_cancel(object);
 KMP_ITT_DEBUG_PRINT("[tsk sta] scan( %p )\n", object);

diff  --git a/openmp/runtime/src/kmp_tasking.cpp 
b/openmp/runtime/src/kmp_tasking.cpp
index 283bb934cd8f..41421d6765e0 100644
--- a/openmp/runtime/src/kmp_tasking.cpp
+++ b/openmp/runtime/src/kmp_tasking.cpp
@@ -275,7 +275,7 @@ static bool __kmp_task_is_allowed(int gtid, const kmp_int32 
is_constrained,
   }
   // Check mutexinoutset dependencies, acquire locks
   kmp_depnode_t *node = tasknew->td_depnode;
-  if (node && (node->dn.mtx_num_locks > 0)) {
+  if (UNLIKELY(node && (node->dn.mtx_num_locks > 0))) {
 for (int i = 0; i < node->dn.mtx_num_locks; ++i) {
   KMP_DEBUG_ASSERT(node->dn.mtx_locks[i] != NULL);
   if (__kmp_test_lock(node->dn.mtx_locks[i], gtid))
@@ -332,7 +332,7 @@ static kmp_int32 __kmp_push_task(kmp_int32 gtid, kmp_task_t 
*task) {
   KA_TRACE(20,
("__kmp_push_task: T#%d trying to push task %p.\n", gtid, 
taskdata));
 
-  if (taskdata->td_flags.tiedness == TASK_UNTIED) {
+  if (UNLIKELY(taskdata->td_flags.tiedness == TASK_UNTIED)) {
 // untied task needs to increment counter so that the task structure is not
 // freed prematurely
 kmp_int32 counter = 1 + KMP_ATOMIC_INC(>td_untied_count);
@@ -344,7 +344,7 @@ static kmp_int32 __kmp_push_task(kmp_int32 gtid, kmp_task_t 
*task) {
   }
 
   // The first check avoids building task_team thread data if serialized
-  if (taskdata->td_flags.task_serial) {
+  if (UNLIKELY(taskdata->td_flags.task_serial)) {
 KA_TRACE(20, ("__kmp_push_task: T#%d team serialized; returning "
   "TASK_NOT_PUSHED for task %p\n",
   gtid, taskdata));
@@ -354,7 +354,7 @@ static kmp_int32 __kmp_push_task(kmp_int32 gtid, kmp_task_t 
*task) {
   // Now that serialized tasks have returned, we can assume that we are not in
   // immediate exec mode
   KMP_DEBUG_ASSERT(__kmp_tasking_mode != tskm_immediate_exec);
-  if (!KMP_TASKING_ENABLED(task_team)) {
+  if (UNLIKELY(!KMP_TASKING_ENABLED(task_team))) {
 __kmp_enable_tasking(task_team, thread);
   }
   KMP_DEBUG_ASSERT(TCR_4(task_team->tt.tt_found_tasks) == TRUE);
@@ -364,7 +364,7 @@ static kmp_int32 __kmp_push_task(kmp_int32 gtid, kmp_task_t 
*task) {
   thread_data = _team->tt.tt_threads_data[tid];
 
   // No lock needed since only owner can allocate
-  if (thread_data->td.td_deque == NULL) {
+  if (UNLIKELY(thread_data->td.td_deque == NULL)) {
 __kmp_alloc_task_deque(thread, thread_data);
   }
 
@@ -824,7 +824,7 @@ static void __kmp_task_finish(kmp_int32 gtid, kmp_task_t 
*task,
   }
 #endif /* BUILD_TIED_TASK_STACK */
 
-  if (taskdata->td_flags.tiedness == TASK_UNTIED) {
+  if (UNLIKELY(taskdata->td_flags.tiedness == TASK_UNTIED)) {
 // untied task needs to check the counter so that the task structure is not
 // freed prematurely
 kmp_int32 counter = KMP_ATOMIC_DEC(>td_untied_count) - 1;
@@ -1175,7 +1175,7 @@ kmp_task_t *__kmp_task_alloc(ident_t *loc_ref, kmp_int32 
gtid,
   kmp_taskdata_t *parent_task = thread->th.th_current_task;
   size_t shareds_offset;
 
-  if (!TCR_4(__kmp_init_middle))
+  if (UNLIKELY(!TCR_4(__kmp_init_middle)))
 __kmp_middle_initialize();
 
   KA_TRACE(10, ("__kmp_task_alloc(enter): T#%d loc=%p, flags=(0x%x) "
@@ -1433,8 +1433,8 @@ static void __kmp_invoke_task(kmp_int32 gtid, kmp_task_t 
*task,
   30, ("__kmp_invoke_task(enter): T#%d invoking task 

[llvm-branch-commits] [clang] db41c0b - [clang-format] PR35514 brace-init member initializers in function-try-blocks are not formatted correctly

2020-12-17 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-17T09:39:37Z
New Revision: db41c0b357d55ccd6206ff262dc50ed38f0d5474

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

LOG: [clang-format] PR35514 brace-init member initializers in 
function-try-blocks are not formatted correctly

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

Initializer lists with a try-block are incorrectly formatted.

e.g.

```
Foo(int abc, int def) try : _abc(abc), _def{def}, _ghi{1} {
  callA();
  callB();
} catch (std::exception&) {
}
```

is formatted as:

```
Foo(int abc, int def) try : _abc(abc), _def { def }
, _ghi{1} {
  callA();
  callB();
}
catch (std::exception&) {
}
```

This revision adds support in the parseTryCatch for braced initializers in the 
initializer list

Reviewed By: curdeius, HazardyKnusperkeks

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

Added: 


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

Removed: 




diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index ddb3a247429a..4c2ee421d092 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2050,6 +2050,13 @@ void UnwrappedLineParser::parseTryCatch() {
   nextToken();
   if (FormatTok->is(tok::l_paren))
 parseParens();
+  if (FormatTok->Previous && FormatTok->Previous->is(tok::identifier) &&
+  FormatTok->is(tok::l_brace)) {
+do {
+  nextToken();
+} while (!FormatTok->is(tok::r_brace));
+nextToken();
+  }
 
   // In case identifiers were removed by clang-tidy, what might follow is
   // multiple commas in sequence - after the first identifier.

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index a3dbec9a669f..d2aed304f213 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2727,6 +2727,29 @@ TEST_F(FormatTest, FormatTryCatch) {
"throw;\n"
"  }\n"
"};\n");
+  verifyFormat("class A {\n"
+   "  int a;\n"
+   "  A() try : a(0), b{1} {\n"
+   "  } catch (...) {\n"
+   "throw;\n"
+   "  }\n"
+   "};\n");
+  verifyFormat("class A {\n"
+   "  int a;\n"
+   "  A() try : a(0), b{1}, c{2} {\n"
+   "  } catch (...) {\n"
+   "throw;\n"
+   "  }\n"
+   "};\n");
+  verifyFormat("class A {\n"
+   "  int a;\n"
+   "  A() try : a(0), b{1}, c{2} {\n"
+   "{ // New scope.\n"
+   "}\n"
+   "  } catch (...) {\n"
+   "throw;\n"
+   "  }\n"
+   "};\n");
 
   // Incomplete try-catch blocks.
   verifyIncompleteFormat("try {} catch (");
@@ -7756,8 +7779,8 @@ TEST_F(FormatTest, UnderstandsUnaryOperators) {
   verifyFormat("co_yield -1;");
   verifyFormat("co_return -1;");
 
-  // Check that * is not treated as a binary operator when we set 
PointerAlignment
-  // as PAS_Left after a keyword and not a declaration.
+  // Check that * is not treated as a binary operator when we set
+  // PointerAlignment as PAS_Left after a keyword and not a declaration.
   FormatStyle PASLeftStyle = getLLVMStyle();
   PASLeftStyle.PointerAlignment = FormatStyle::PAS_Left;
   verifyFormat("co_return *a;", PASLeftStyle);



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


[llvm-branch-commits] [lld] 9ed8e0c - [NFC] Reduce include files dependency and AA header cleanup (part 2).

2020-12-17 Thread via llvm-branch-commits

Author: dfukalov
Date: 2020-12-17T14:04:48+03:00
New Revision: 9ed8e0caab9b6f638e82979f6fdf60d67ce65b92

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

LOG: [NFC] Reduce include files dependency and AA header cleanup (part 2).

Continuing work started in https://reviews.llvm.org/D92489:

Removed a bunch of includes from "AliasAnalysis.h" and "LoopPassManager.h".

Reviewed By: RKSimon

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

Added: 


Modified: 
clang/lib/CodeGen/BackendUtil.cpp
lld/MachO/Driver.cpp
llvm/examples/Bye/Bye.cpp
llvm/include/llvm/Analysis/AliasAnalysis.h
llvm/include/llvm/Analysis/BasicAliasAnalysis.h
llvm/include/llvm/Analysis/MemorySSA.h
llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
llvm/lib/Analysis/AliasAnalysis.cpp
llvm/lib/Analysis/MemDepPrinter.cpp
llvm/lib/Analysis/MemorySSA.cpp
llvm/lib/Analysis/ScopedNoAliasAA.cpp
llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
llvm/lib/CodeGen/LiveIntervals.cpp
llvm/lib/LTO/Caching.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/lib/Transforms/IPO/FunctionAttrs.cpp
llvm/lib/Transforms/IPO/HotColdSplitting.cpp
llvm/lib/Transforms/IPO/Inliner.cpp
llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp
llvm/lib/Transforms/Scalar/FlattenCFGPass.cpp
llvm/lib/Transforms/Scalar/Float2Int.cpp
llvm/lib/Transforms/Scalar/LoopDistribute.cpp
llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
llvm/lib/Transforms/Scalar/LoopPassManager.cpp
llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
llvm/lib/Transforms/Utils/LoopVersioning.cpp
llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
llvm/tools/opt/NewPMDriver.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 2dbf30ef171f..b326c643738f 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/StackSafetyAnalysis.h"
 #include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/Analysis/TargetTransformInfo.h"

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 030cbef53049..c522a082a306 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -34,6 +34,7 @@
 #include "llvm/LTO/LTO.h"
 #include "llvm/Object/Archive.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/MemoryBuffer.h"

diff  --git a/llvm/examples/Bye/Bye.cpp b/llvm/examples/Bye/Bye.cpp
index 4e39cd5c660b..78b4363123c3 100644
--- a/llvm/examples/Bye/Bye.cpp
+++ b/llvm/examples/Bye/Bye.cpp
@@ -3,6 +3,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Passes/PassBuilder.h"
 #include "llvm/Passes/PassPlugin.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
 

diff  --git a/llvm/include/llvm/Analysis/AliasAnalysis.h 
b/llvm/include/llvm/Analysis/AliasAnalysis.h
index cc5cec44b455..b84febaeeeaa 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -42,8 +42,6 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Analysis/MemoryLocation.h"
-#include "llvm/IR/Instruction.h"
-#include "llvm/IR/Instructions.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
 #include 
@@ -54,10 +52,17 @@
 namespace llvm {
 
 class AnalysisUsage;
+class AtomicCmpXchgInst;
 class BasicAAResult;
 class BasicBlock;
+class CatchPadInst;
+class CatchReturnInst;
 class DominatorTree;
+class FenceInst;
 class Function;
+class InvokeInst;
+class PreservedAnalyses;
+class TargetLibraryInfo;
 class Value;
 
 /// The possible results of an alias query.
@@ -768,40 +773,7 @@ class AAResults {
AAQueryInfo );
   ModRefInfo getModRefInfo(const Instruction *I,
const Optional ,
-   AAQueryInfo ) {
-if (OptLoc == None) {
-  if (const auto *Call = dyn_cast(I)) {
-return createModRefInfo(getModRefBehavior(Call));
-  }
-}
-
-const 

[llvm-branch-commits] [llvm] 15f2d4f - [AIX] Fixed "comparison of unsigned expression >= 0 is always true" gcc warnings.

2020-12-14 Thread via llvm-branch-commits

Author: diggerlin
Date: 2020-12-14T11:08:40-05:00
New Revision: 15f2d4f198380762e9fcf6b456d405078b87ae7a

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

LOG: [AIX] Fixed "comparison of unsigned expression >= 0 is always true" gcc 
warnings.

Summary:

fixed a  Fixed "comparison of unsigned expression >= 0 is always true" gcc 
warnings.
http://lab.llvm.org:8011/#/builders/5/builds/2407/steps/2/logs/stdio

the error caused by patch https://reviews.llvm.org/D92398

Added: 


Modified: 
llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp

Removed: 




diff  --git a/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp 
b/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
index 02a425044c75..d364eb9d3996 100644
--- a/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
@@ -67,7 +67,7 @@ bool PPCFunctionInfo::isLiveInZExt(Register VReg) const {
 
 void PPCFunctionInfo::appendParameterType(ParamType Type) {
   uint32_t CopyParamType = ParameterType;
-  unsigned Bits = 0;
+  int Bits = 0;
 
   // If it is fixed type, we only need to increase the FixedParamNum, for
   // the bit encode of fixed type is bit of zero, we do not need to change the



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


[llvm-branch-commits] [llvm] 71699a9 - [flang][openacc] Enforce restriction on routine directive and clauses

2020-12-17 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-17T11:33:34-05:00
New Revision: 71699a998d4f648396a1a12820c0f04cc61f8e19

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

LOG: [flang][openacc] Enforce restriction on routine directive and clauses

This patch add some checks for the restriction on the routine directive
and fix several issue at the same time.

Validity tests have been added in a separate file than acc-clause-validity.f90 
since this one
became quite large. I plan to split the larger file once on-going review are 
done.

Reviewed By: sameeranjoshi

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

Added: 
flang/test/Semantics/acc-routine-validity.f90

Modified: 
flang/include/flang/Parser/dump-parse-tree.h
flang/include/flang/Parser/parse-tree.h
flang/lib/Parser/openacc-parsers.cpp
flang/lib/Parser/unparse.cpp
flang/lib/Semantics/check-acc-structure.cpp
flang/lib/Semantics/resolve-directives.cpp
flang/test/Semantics/acc-clause-validity.f90
llvm/include/llvm/Frontend/OpenACC/ACC.td

Removed: 




diff  --git a/flang/include/flang/Parser/dump-parse-tree.h 
b/flang/include/flang/Parser/dump-parse-tree.h
index 8a7d1d1302b2..92f7113b316a 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -66,6 +66,7 @@ class ParseTreeDumper {
   NODE(parser, AccClause)
 #define GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
 #include "llvm/Frontend/OpenACC/ACC.cpp.inc"
+  NODE(parser, AccBindClause)
   NODE(parser, AccDefaultClause)
   NODE_ENUM(parser::AccDefaultClause, Arg)
   NODE(parser, AccClauseList)

diff  --git a/flang/include/flang/Parser/parse-tree.h 
b/flang/include/flang/Parser/parse-tree.h
index a2beac4737f6..6bf4d8568bde 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3852,6 +3852,12 @@ struct AccDeclarativeDirective {
 };
 
 // OpenACC Clauses
+struct AccBindClause {
+  UNION_CLASS_BOILERPLATE(AccBindClause);
+  std::variant u;
+  CharBlock source;
+};
+
 struct AccDefaultClause {
   ENUM_CLASS(Arg, None, Present)
   WRAPPER_CLASS_BOILERPLATE(AccDefaultClause, Arg);
@@ -4048,7 +4054,8 @@ struct OpenACCCombinedConstruct {
 struct OpenACCDeclarativeConstruct {
   UNION_CLASS_BOILERPLATE(OpenACCDeclarativeConstruct);
   CharBlock source;
-  std::variant u;
+  std::variant
+  u;
 };
 
 // OpenACC directives enclosing do loop
@@ -4068,8 +4075,8 @@ struct OpenACCStandaloneConstruct {
 struct OpenACCConstruct {
   UNION_CLASS_BOILERPLATE(OpenACCConstruct);
   std::variant
+  OpenACCLoopConstruct, OpenACCStandaloneConstruct, OpenACCCacheConstruct,
+  OpenACCWaitConstruct, OpenACCAtomicConstruct>
   u;
 };
 

diff  --git a/flang/lib/Parser/openacc-parsers.cpp 
b/flang/lib/Parser/openacc-parsers.cpp
index b4d2b285cd6c..2447ed70b1a1 100644
--- a/flang/lib/Parser/openacc-parsers.cpp
+++ b/flang/lib/Parser/openacc-parsers.cpp
@@ -28,8 +28,8 @@ TYPE_PARSER("AUTO" >> 
construct(construct()) ||
maybe(parenthesized(scalarIntExpr ||
 "ATTACH" >> construct(construct(
 parenthesized(Parser{}))) ||
-"BIND" >>
-construct(construct(parenthesized(name))) 
||
+"BIND" >> construct(
+  construct(Parser{})) ||
 "CAPTURE" >> construct(construct()) ||
 "COLLAPSE" >> construct(construct(
   parenthesized(scalarIntConstantExpr))) ||
@@ -166,6 +166,10 @@ TYPE_PARSER(sourced(construct(
 ".EQV." >> pure(AccReductionOperator::Operator::Eqv),
 ".NEQV." >> pure(AccReductionOperator::Operator::Neqv)
 
+// 2.15.1 Bind clause
+TYPE_PARSER(sourced(construct(parenthesized(name))) ||
+sourced(construct(parenthesized(scalarDefaultCharExpr
+
 // 2.5.14 Default clause
 TYPE_PARSER(construct(
 parenthesized(first("NONE" >> pure(AccDefaultClause::Arg::None),
@@ -287,8 +291,10 @@ 
TYPE_PARSER(construct(
 sourced(Parser{}), Parser{}))
 
 TYPE_PARSER(
-startAccLine >> sourced(construct(
-Parser{})))
+startAccLine >> first(sourced(construct(
+  
Parser{})),
+sourced(construct(
+Parser{}
 
 // OpenACC constructs
 TYPE_CONTEXT_PARSER("OpenACC construct"_en_US,
@@ -297,7 +303,6 @@ TYPE_CONTEXT_PARSER("OpenACC construct"_en_US,
 construct(Parser{}),
 construct(Parser{}),
 construct(Parser{}),
-construct(Parser{}),
 construct(Parser{}),
 construct(Parser{}),
 construct(Parser{})))

diff  --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index bd1c1a2c71eb..0f0c6f285f61 100644
--- a/flang/lib/Parser/unparse.cpp
+++ 

[llvm-branch-commits] [libc] cfe096d - Fix dead link

2020-12-17 Thread via llvm-branch-commits

Author: Guillaume Chatelet
Date: 2020-12-17T15:49:28+01:00
New Revision: cfe096d1f68783bcfab4a01d5a471a3c6ed1b46d

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

LOG: Fix dead link

Added: 


Modified: 
libc/benchmarks/README.md

Removed: 




diff  --git a/libc/benchmarks/README.md b/libc/benchmarks/README.md
index dbfb0641d337..96d108b5f35b 100644
--- a/libc/benchmarks/README.md
+++ b/libc/benchmarks/README.md
@@ -51,7 +51,7 @@ This is the preferred mode to use. The function parameters 
are randomized and th
 --output=/tmp/benchmark_result.json
 ```
 
-The `--size-distribution-name` flag is mandatory and points to one of the 
[predefined distribution](libc/benchmarks/MemorySizeDistributions.h).
+The `--size-distribution-name` flag is mandatory and points to one of the 
[predefined distribution](MemorySizeDistributions.h).
 
 > Note: These distributions are gathered from several important binaries at 
 > Google (servers, databases, realtime and batch jobs) and reflect the 
 > importance of focusing on small sizes.
 



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


[llvm-branch-commits] [clang] 5e31e22 - Remove Python2 fallback and only advertise Python3 in the doc

2020-12-17 Thread via llvm-branch-commits

Author: serge-sans-paille
Date: 2020-12-17T15:40:16+01:00
New Revision: 5e31e226b5b2b682607a6578ff5adb33daf4fe39

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

LOG: Remove Python2 fallback and only advertise Python3 in the doc

Differential Revision: https://www.youtube.com/watch?v=RsL0cipURA0

Added: 


Modified: 
clang/CMakeLists.txt
clang/tools/scan-build-py/README.md
clang/tools/scan-build/bin/set-xcode-analyzer
lld/CMakeLists.txt
lldb/docs/resources/build.rst
llvm/CMakeLists.txt
llvm/docs/GettingStarted.rst
llvm/docs/GettingStartedVS.rst
llvm/docs/HowToBuildOnARM.rst
llvm/docs/TestingGuide.rst

Removed: 




diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index f947b820bdac..f1e5a39cfe05 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -135,20 +135,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 COMPONENTS Interpreter)
-if(NOT Python3_Interpreter_FOUND)
-  message(WARNING "Python3 not found, using python2 as a fallback")
-  find_package(Python2 COMPONENTS Interpreter REQUIRED)
-  if(Python2_VERSION VERSION_LESS 2.7)
-message(SEND_ERROR "Python 2.7 or newer is required")
-  endif()
-
-  # Treat python2 as python3
-  add_executable(Python3::Interpreter IMPORTED)
-  set_target_properties(Python3::Interpreter PROPERTIES
-IMPORTED_LOCATION ${Python2_EXECUTABLE})
-  set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
-endif()
+find_package(Python3 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}

diff  --git a/clang/tools/scan-build-py/README.md 
b/clang/tools/scan-build-py/README.md
index 0f89b6fa43d8..63ce0273f22e 100644
--- a/clang/tools/scan-build-py/README.md
+++ b/clang/tools/scan-build-py/README.md
@@ -19,7 +19,7 @@ Should be working on UNIX operating systems.
 Prerequisites
 -
 
-1. **python** interpreter (version 2.7, 3.2, 3.3, 3.4, 3.5).
+1. **python** interpreter (version 3.6 or later).
 
 
 How to use

diff  --git a/clang/tools/scan-build/bin/set-xcode-analyzer 
b/clang/tools/scan-build/bin/set-xcode-analyzer
index c2a65c908598..9faaec1e8e6e 100755
--- a/clang/tools/scan-build/bin/set-xcode-analyzer
+++ b/clang/tools/scan-build/bin/set-xcode-analyzer
@@ -5,8 +5,8 @@
 # This one has the scripting bridge enabled.
 
 import sys
-if sys.version_info < (2, 7):
-print "set-xcode-analyzer requires Python 2.7 or later"
+if sys.version_info < (3, 6):
+print "set-xcode-analyzer requires Python 3.6 or later"
 sys.exit(1)
 
 import os

diff  --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 82b4b9b9b198..d4e561b50d8f 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -57,20 +57,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 COMPONENTS Interpreter)
-if(NOT Python3_Interpreter_FOUND)
-  message(WARNING "Python3 not found, using python2 as a fallback")
-  find_package(Python2 COMPONENTS Interpreter REQUIRED)
-  if(Python2_VERSION VERSION_LESS 2.7)
-message(SEND_ERROR "Python 2.7 or newer is required")
-  endif()
-
-  # Treat python2 as python3
-  add_executable(Python3::Interpreter IMPORTED)
-  set_target_properties(Python3::Interpreter PROPERTIES
-IMPORTED_LOCATION ${Python2_EXECUTABLE})
-  set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
-endif()
+find_package(Python3 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}

diff  --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index b4e58ca977a9..8aadd126ed0b 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -73,7 +73,7 @@ commands below.
   > yum install libedit-devel libxml2-devel ncurses-devel python-devel swig
   > sudo apt-get install build-essential subversion swig python3-dev 
libedit-dev libncurses5-dev
   > pkg install swig python
-  > pkgin install swig python27 cmake ninja-build
+  > pkgin install swig python36 cmake ninja-build
   > brew install swig cmake ninja
 
 Note that there's an `incompatibility

diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 54009573ed43..ee1b646ab651 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -708,20 +708,7 @@ set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER FALSE CACHE BOOL
 
 include(HandleLLVMOptions)
 
-find_package(Python3 COMPONENTS Interpreter)
-if(NOT 

[llvm-branch-commits] [flang] 36bf2de - [flang][openacc] Update serial construct clauses for OpenACC 3.1

2020-12-17 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-17T10:50:47-05:00
New Revision: 36bf2de8d866e2b448d17f4d2cb4bb96819d82b7

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

LOG: [flang][openacc] Update serial construct clauses for OpenACC 3.1

Update the allowed clauses for the SERIAL construct for the new OpenACC 3.1
specification.

Reviewed By: sameeranjoshi

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

Added: 


Modified: 
flang/test/Semantics/acc-clause-validity.f90
llvm/include/llvm/Frontend/OpenACC/ACC.td

Removed: 




diff  --git a/flang/test/Semantics/acc-clause-validity.f90 
b/flang/test/Semantics/acc-clause-validity.f90
index 1f98d0f2559f..a5c6193d32f5 100644
--- a/flang/test/Semantics/acc-clause-validity.f90
+++ b/flang/test/Semantics/acc-clause-validity.f90
@@ -3,8 +3,8 @@
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.6.5 Data
 !   2.5.1 Parallel
-!   2.5.2 Kernels
-!   2.5.3 Serial
+!   2.5.2 Serial
+!   2.5.3 Kernels
 !   2.9 Loop
 !   2.12 Atomic
 !   2.13 Declare
@@ -780,6 +780,170 @@ program openacc_clause_validity
   end do
   !$acc end parallel loop
 
+  !$acc serial
+  !$acc end serial
+
+  !$acc serial async
+  !$acc end serial
+
+  !$acc serial async(1)
+  !$acc end serial
+
+  !ERROR: At most one ASYNC clause can appear on the SERIAL directive
+  !$acc serial async(1) async(2)
+  !$acc end serial
+
+  !$acc serial async(async1)
+  !$acc end serial
+
+  !$acc serial wait
+  !$acc end serial
+
+  !$acc serial wait(1)
+  !$acc end serial
+
+  !$acc serial wait(wait1)
+  !$acc end serial
+
+  !$acc serial wait(1,2)
+  !$acc end serial
+
+  !$acc serial wait(wait1, wait2)
+  !$acc end serial
+
+  !$acc serial wait(wait1) wait(wait2)
+  !$acc end serial
+
+  !ERROR: NUM_GANGS clause is not allowed on the SERIAL directive
+  !$acc serial num_gangs(8)
+  !$acc end serial
+
+  !ERROR: NUM_WORKERS clause is not allowed on the SERIAL directive
+  !$acc serial num_workers(8)
+  !$acc end serial
+
+  !ERROR: VECTOR_LENGTH clause is not allowed on the SERIAL directive
+  !$acc serial vector_length(128)
+  !$acc end serial
+
+  !$acc serial if(.true.)
+  !$acc end serial
+
+  !ERROR: At most one IF clause can appear on the SERIAL directive
+  !$acc serial if(.true.) if(ifCondition)
+  !$acc end serial
+
+  !$acc serial if(ifCondition)
+  !$acc end serial
+
+  !$acc serial self
+  !$acc end serial
+
+  !$acc serial self(.true.)
+  !$acc end serial
+
+  !$acc serial self(ifCondition)
+  !$acc end serial
+
+  !$acc serial loop reduction(+: reduction_r)
+  do i = 1, N
+reduction_r = a(i) + i
+  end do
+
+  !$acc serial loop reduction(*: reduction_r)
+  do i = 1, N
+reduction_r = reduction_r * (a(i) + i)
+  end do
+
+  !$acc serial loop reduction(min: reduction_r)
+  do i = 1, N
+reduction_r = min(reduction_r, a(i) * i)
+  end do
+
+  !$acc serial loop reduction(max: reduction_r)
+  do i = 1, N
+reduction_r = max(reduction_r, a(i) * i)
+  end do
+
+  !$acc serial loop reduction(iand: b)
+  do i = 1, N
+b = iand(b, c(i))
+  end do
+
+  !$acc serial loop reduction(ior: b)
+  do i = 1, N
+b = ior(b, c(i))
+  end do
+
+  !$acc serial loop reduction(ieor: b)
+  do i = 1, N
+b = ieor(b, c(i))
+  end do
+
+  !$acc serial loop reduction(.and.: reduction_l)
+  do i = 1, N
+reduction_l = d(i) .and. e(i)
+  end do
+
+  !$acc serial loop reduction(.or.: reduction_l)
+  do i = 1, N
+reduction_l = d(i) .or. e(i)
+  end do
+
+  !$acc serial loop reduction(.eqv.: reduction_l)
+  do i = 1, N
+reduction_l = d(i) .eqv. e(i)
+  end do
+
+  !$acc serial loop reduction(.neqv.: reduction_l)
+  do i = 1, N
+reduction_l = d(i) .neqv. e(i)
+  end do
+
+  !$acc serial reduction(.neqv.: reduction_l)
+  !$acc loop reduction(.neqv.: reduction_l)
+  do i = 1, N
+reduction_l = d(i) .neqv. e(i)
+  end do
+  !$acc end serial
+
+  !$acc serial copy(aa) copyin(bb) copyout(cc)
+  !$acc end serial
+
+  !$acc serial copy(aa, bb) copyout(zero: cc)
+  !$acc end serial
+
+  !$acc serial present(aa, bb) create(cc)
+  !$acc end serial
+
+  !$acc serial copyin(readonly: aa, bb) create(zero: cc)
+  !$acc end serial
+
+  !$acc serial deviceptr(aa, bb) no_create(cc)
+  !$acc end serial
+
+  !$acc serial attach(aa, bb, cc)
+  !$acc end serial
+
+  !$acc serial firstprivate(bb, cc)
+  !$acc end serial
+
+  !$acc serial private(aa)
+  !$acc end serial
+
+  !$acc serial default(none)
+  !$acc end serial
+
+  !$acc serial default(present)
+  !$acc end serial
+
+  !ERROR: At most one DEFAULT clause can appear on the SERIAL directive
+  !$acc serial default(present) default(none)
+  !$acc end serial
+
+  !$acc serial device_type(*) async wait
+  !$acc end serial
+
   !$acc serial device_type(*) async
   do i = 1, N
 a(i) = 3.14

diff  

[llvm-branch-commits] [mlir] 4a327bd - Add call site location getter to C API

2020-12-17 Thread via llvm-branch-commits

Author: George
Date: 2020-12-17T09:55:21-08:00
New Revision: 4a327bd25289efdfb1c466b119e6e55fadebfc42

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

LOG: Add call site location getter to C API

Reviewed By: ftynse

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

Added: 


Modified: 
mlir/include/mlir-c/IR.h
mlir/lib/CAPI/IR/IR.cpp
mlir/test/CAPI/ir.c

Removed: 




diff  --git a/mlir/include/mlir-c/IR.h b/mlir/include/mlir-c/IR.h
index 74c90af5b4d5..13e32be049e4 100644
--- a/mlir/include/mlir-c/IR.h
+++ b/mlir/include/mlir-c/IR.h
@@ -147,6 +147,10 @@ MLIR_CAPI_EXPORTED MlirStringRef 
mlirDialectGetNamespace(MlirDialect dialect);
 MLIR_CAPI_EXPORTED MlirLocation mlirLocationFileLineColGet(
 MlirContext context, MlirStringRef filename, unsigned line, unsigned col);
 
+/// Creates a call site location with a callee and a caller.
+MLIR_CAPI_EXPORTED MlirLocation mlirLocationCallSiteGet(MlirLocation callee,
+MlirLocation caller);
+
 /// Creates a location with unknown position owned by the given context.
 MLIR_CAPI_EXPORTED MlirLocation mlirLocationUnknownGet(MlirContext context);
 

diff  --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp
index c5a78a2235fc..4de39490cea0 100644
--- a/mlir/lib/CAPI/IR/IR.cpp
+++ b/mlir/lib/CAPI/IR/IR.cpp
@@ -116,6 +116,10 @@ MlirLocation mlirLocationFileLineColGet(MlirContext 
context,
   FileLineColLoc::get(unwrap(filename), line, col, unwrap(context)));
 }
 
+MlirLocation mlirLocationCallSiteGet(MlirLocation callee, MlirLocation caller) 
{
+  return wrap(CallSiteLoc::get(unwrap(callee), unwrap(caller)));
+}
+
 MlirLocation mlirLocationUnknownGet(MlirContext context) {
   return wrap(UnknownLoc::get(unwrap(context)));
 }

diff  --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c
index a785d6ab4899..434f272de059 100644
--- a/mlir/test/CAPI/ir.c
+++ b/mlir/test/CAPI/ir.c
@@ -1295,7 +1295,7 @@ MlirLogicalResult errorHandler(MlirDiagnostic diagnostic, 
void *userData) {
   MlirLocation loc = mlirDiagnosticGetLocation(diagnostic);
   mlirLocationPrint(loc, printToStderr, NULL);
   assert(mlirDiagnosticGetNumNotes(diagnostic) == 0);
-  fprintf(stderr, ">> end of diagnostic (userData: %ld)\n", (long)userData);
+  fprintf(stderr, "\n>> end of diagnostic (userData: %ld)\n", (long)userData);
   return mlirLogicalResultSuccess();
 }
 
@@ -1308,16 +1308,32 @@ void testDiagnostics() {
   MlirContext ctx = mlirContextCreate();
   MlirDiagnosticHandlerID id = mlirContextAttachDiagnosticHandler(
   ctx, errorHandler, (void *)42, deleteUserData);
-  MlirLocation loc = mlirLocationUnknownGet(ctx);
   fprintf(stderr, "@test_diagnostics\n");
-  mlirEmitError(loc, "test diagnostics");
+  MlirLocation unknownLoc = mlirLocationUnknownGet(ctx);
+  mlirEmitError(unknownLoc, "test diagnostics");
+  MlirLocation fileLineColLoc = mlirLocationFileLineColGet(
+  ctx, mlirStringRefCreateFromCString("file.c"), 1, 2);
+  mlirEmitError(fileLineColLoc, "test diagnostics");
+  MlirLocation callSiteLoc = mlirLocationCallSiteGet(
+  mlirLocationFileLineColGet(
+  ctx, mlirStringRefCreateFromCString("other-file.c"), 2, 3),
+  fileLineColLoc);
+  mlirEmitError(callSiteLoc, "test diagnostics");
   mlirContextDetachDiagnosticHandler(ctx, id);
-  mlirEmitError(loc, "more test diagnostics");
+  mlirEmitError(unknownLoc, "more test diagnostics");
   // CHECK-LABEL: @test_diagnostics
   // CHECK: processing diagnostic (userData: 42) <<
   // CHECK:   test diagnostics
   // CHECK:   loc(unknown)
   // CHECK: >> end of diagnostic (userData: 42)
+  // CHECK: processing diagnostic (userData: 42) <<
+  // CHECK:   test diagnostics
+  // CHECK:   loc("file.c":1:2)
+  // CHECK: >> end of diagnostic (userData: 42)
+  // CHECK: processing diagnostic (userData: 42) <<
+  // CHECK:   test diagnostics
+  // CHECK:   loc(callsite("other-file.c":2:3 at "file.c":1:2))
+  // CHECK: >> end of diagnostic (userData: 42)
   // CHECK: deleting user data (userData: 42)
   // CHECK-NOT: processing diagnostic
   // CHECK: more test diagnostics



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


[llvm-branch-commits] [clang] f4c8b80 - [openmp] Remove clause from OMPKinds.def and use OMP.td info

2020-12-17 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-17T14:08:12-05:00
New Revision: f4c8b80318005ca61bfed9b40ee9e6039194159b

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

LOG: [openmp] Remove clause from OMPKinds.def and use OMP.td info

Remove the OpenMP clause information from the OMPKinds.def file and use the
information from the new OMP.td file. There is now a single source of truth for 
the
directives and clauses.

To avoid generate lots of specific small code from tablegen, the macros 
previously
used in OMPKinds.def are generated almost as identical. This can be polished and
possibly removed in a further patch.

Reviewed By: jdoerfert

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

Added: 


Modified: 
clang/include/clang/AST/ASTFwd.h
clang/include/clang/AST/ASTTypeTraits.h
clang/include/clang/AST/OpenMPClause.h
clang/include/clang/AST/RecursiveASTVisitor.h
clang/lib/AST/ASTTypeTraits.cpp
clang/lib/AST/OpenMPClause.cpp
clang/lib/AST/StmtProfile.cpp
clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
clang/lib/ASTMatchers/Dynamic/Marshallers.h
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/tools/libclang/CIndex.cpp
flang/include/flang/Parser/dump-parse-tree.h
flang/include/flang/Parser/parse-tree.h
flang/lib/Parser/unparse.cpp
flang/lib/Semantics/check-omp-structure.h
llvm/include/llvm/Frontend/OpenMP/CMakeLists.txt
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/include/llvm/TableGen/DirectiveEmitter.h
llvm/test/TableGen/directive2.td
llvm/utils/TableGen/DirectiveEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ASTFwd.h 
b/clang/include/clang/AST/ASTFwd.h
index 65319a19728b..649b57113424 100644
--- a/clang/include/clang/AST/ASTFwd.h
+++ b/clang/include/clang/AST/ASTFwd.h
@@ -27,9 +27,9 @@ class Type;
 #include "clang/AST/TypeNodes.inc"
 class CXXCtorInitializer;
 class OMPClause;
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) class Class;
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
-
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) class Class;
+#include "llvm/Frontend/OpenMP/OMP.inc"
 
 } // end namespace clang
 

diff  --git a/clang/include/clang/AST/ASTTypeTraits.h 
b/clang/include/clang/AST/ASTTypeTraits.h
index 2141f85911be..a91f6b0c1a69 100644
--- a/clang/include/clang/AST/ASTTypeTraits.h
+++ b/clang/include/clang/AST/ASTTypeTraits.h
@@ -147,8 +147,9 @@ class ASTNodeKind {
 #define TYPE(DERIVED, BASE) NKI_##DERIVED##Type,
 #include "clang/AST/TypeNodes.inc"
 NKI_OMPClause,
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) NKI_##Class,
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) NKI_##Class,
+#include "llvm/Frontend/OpenMP/OMP.inc"
 NKI_NumberOfKinds
   };
 
@@ -205,8 +206,9 @@ KIND_TO_KIND_ID(CXXBaseSpecifier)
 #include "clang/AST/StmtNodes.inc"
 #define TYPE(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Type)
 #include "clang/AST/TypeNodes.inc"
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class)
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class)
+#include "llvm/Frontend/OpenMP/OMP.inc"
 #undef KIND_TO_KIND_ID
 
 inline raw_ostream <<(raw_ostream , ASTNodeKind K) {

diff  --git a/clang/include/clang/AST/OpenMPClause.h 
b/clang/include/clang/AST/OpenMPClause.h
index cc6d3a93ba09..877c1d87d8ac 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -7758,22 +7758,22 @@ class OMPClauseVisitorBase {
 #define DISPATCH(CLASS) \
   return 
static_cast(this)->Visit##CLASS(static_cast(S))
 
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) \
-  RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); }
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) 
\
+  RetTy Visit##Class(PTR(Class) S) { DISPATCH(Class); }
+#include "llvm/Frontend/OpenMP/OMP.inc"
 
   RetTy Visit(PTR(OMPClause) S) {
 // Top switch clause: visit each OMPClause.
 switch (S->getClauseKind()) {
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) 
\
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) 
\
   case llvm::omp::Clause::Enum:
\
 return Visit##Class(static_cast(S));
-#define OMP_CLAUSE_NO_CLASS(Enum, Str) 
\
+#define CLAUSE_NO_CLASS(Enum, Str) 
\
   case 

[llvm-branch-commits] [llvm] 8c6d516 - [NFC][AMDGPU] Reorganize description of scratch handling

2020-12-17 Thread via llvm-branch-commits

Author: Tony
Date: 2020-12-17T19:33:14Z
New Revision: 8c6d516286d5eb51899f380526c59e8b7af69f24

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

LOG: [NFC][AMDGPU] Reorganize description of scratch handling

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

Added: 


Modified: 
llvm/docs/AMDGPUUsage.rst

Removed: 




diff  --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index c8dda47352ab..3dbdfa7764dc 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -107,21 +107,21 @@ specific information.
   .. table:: AMDGPU Processors
  :name: amdgpu-processor-table
 
- === ===  = = 
=== === ==
- Processor   Alternative Target   dGPU/ TargetTarget   
   OS Support  Example
- Processor   Triple   APU   Features  
Properties  *(see*  Products
- Architecture   Supported  
   `amdgpu-os`_
-   
   *and
-   
   corresponding
-   
   runtime release
-   
   notes for
-   
   current
-   
   information and
-   
   level of
-   
   support)*
- === ===  = = 
=== === ==
+ === ===  = = 
=== === ==
+ Processor   Alternative Target   dGPU/ TargetTarget   
   OS Support  Example
+ Processor   Triple   APU   Features  
Properties  *(see*  Products
+ Architecture   Supported  
   `amdgpu-os`_
+   
   *and
+   
   corresponding
+   
   runtime release
+   
   notes for
+   
   current
+   
   information and
+   
   level of
+   
   support)*
+ === ===  = = 
=== === ==
  **Radeon HD 2000/3000 Series (R600)** [AMD-RADEON-HD-2000-3000]_
- 
---
+ 
---
  ``r600````r600`` dGPU- Does 
not
 support
 generic
@@ -143,7 +143,7 @@ specific information.
 address
 space
  **Radeon HD 4000 Series (R700)** [AMD-RADEON-HD-4000]_
- 
---
+ 
---
  ``rv710``   ``r600`` dGPU- Does 
not
 support
 generic
@@ -160,7 +160,7 @@ specific information.
 address
   

[llvm-branch-commits] [mlir] de03121 - [mlir] Add canonicalization from `tensor_cast` to `dim` op.

2020-12-17 Thread via llvm-branch-commits

Author: MaheshRavishankar
Date: 2020-12-17T14:45:51-08:00
New Revision: de031216bf1755e61418a1515f2b0db0a9cfeddc

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

LOG: [mlir] Add canonicalization from `tensor_cast` to `dim` op.

Fold a `tensor_cast` -> `dim` to take the `dim` of the original tensor.

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

Added: 


Modified: 
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/test/Dialect/Standard/canonicalize.mlir

Removed: 




diff  --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp 
b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
index b19264ec4972..7ed9cffa8806 100644
--- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
+++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp
@@ -1472,11 +1472,29 @@ struct DimOfMemRefReshape : public 
OpRewritePattern {
 return success();
   }
 };
+
+/// Fold dim of a dim of a cast into the the dim of the source of the tensor
+/// cast.
+template 
+struct DimOfCastOp : public OpRewritePattern {
+  using OpRewritePattern::OpRewritePattern;
+
+  LogicalResult matchAndRewrite(DimOp dimOp,
+PatternRewriter ) const override {
+auto castOp = dimOp.memrefOrTensor().getDefiningOp();
+if (!castOp)
+  return failure();
+Value newSource = castOp.getOperand();
+rewriter.replaceOpWithNewOp(dimOp, newSource, dimOp.index());
+return success();
+  }
+};
+
 } // end anonymous namespace.
 
 void DimOp::getCanonicalizationPatterns(OwningRewritePatternList ,
 MLIRContext *context) {
-  results.insert(context);
+  results.insert>(context);
 }
 
 // ---

diff  --git a/mlir/test/Dialect/Standard/canonicalize.mlir 
b/mlir/test/Dialect/Standard/canonicalize.mlir
index d3c781d1290f..af67453a1f3c 100644
--- a/mlir/test/Dialect/Standard/canonicalize.mlir
+++ b/mlir/test/Dialect/Standard/canonicalize.mlir
@@ -115,3 +115,19 @@ func @dim_of_memref_reshape(%arg0: memref<*xf32>, %arg1: 
memref)
   %1 = dim %0, %c3 : memref<*xf32>
   return %1 : index
 }
+
+// Test case: Folding dim(tensor_cast %0, %idx) -> dim %0, %idx
+// CHECK-LABEL: func @fold_dim_of_tensor_cast
+//  CHECK-SAME:   %[[ARG0:.[a-z0-9A-Z_]+]]: tensor<4x?xf32>
+//   CHECK-DAG:   %[[C1:.+]] = constant 1 : index
+//   CHECK-DAG:   %[[C4:.+]] = constant 4 : index
+//   CHECK:   %[[T0:.+]] = dim %[[ARG0]], %[[C1]]
+//  CHECK-NEXT:   return %[[C4]], %[[T0]]
+func @fold_dim_of_tensor_cast(%arg0 : tensor<4x?xf32>) -> (index, index) {
+  %c0 = constant 0 : index
+  %c1 = constant 1 : index
+  %0 = tensor_cast %arg0 : tensor<4x?xf32> to tensor
+  %1 = dim %0, %c0 : tensor
+  %2 = dim %0, %c1 : tensor
+  return %1, %2: index, index
+}



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


[llvm-branch-commits] [mlir] 118a715 - [mlir][Linalg] Define a linalg.init_tensor operation.

2020-12-17 Thread via llvm-branch-commits

Author: MaheshRavishankar
Date: 2020-12-17T14:45:51-08:00
New Revision: 118a71565462db41cab1dbb0349200627d6e8524

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

LOG: [mlir][Linalg] Define a linalg.init_tensor operation.

This operation is used to materialize a tensor of a particular
shape. The shape could be specified as a mix of static and dynamic
values.

The use of this operation is to be an `init` tensor for Linalg
structured operation on tensors where the bounds of the computation
depends on the shape of the output of the linalg operation. The result
of this operation will be used as the `init` tensor of such Linalg
operations. To note,

1) The values in the tensor materialized is not used. Any operation to
   which this is an init tensor is expected to overwrite the entire
   tensor.
2) The tensor is materialized only for the shape of the output and to
   make the loop bounds depend only on operands of the structured
   operation.

Based on (1) and (2) it is assumed that these operations eventually go
away since they are only used in `dim` operations that can be
canonicalized to make this operation dead. Such canonicalization are
added here too.

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

Added: 


Modified: 
mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
mlir/include/mlir/Interfaces/ViewLikeInterface.h
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/lib/Interfaces/ViewLikeInterface.cpp
mlir/test/Dialect/Linalg/canonicalize.mlir
mlir/test/Dialect/Linalg/roundtrip.mlir

Removed: 




diff  --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td 
b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
index 454dde1bff93..a2e7d436eeb8 100644
--- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
+++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
@@ -32,6 +32,91 @@ class Linalg_Op traits = []> :
   let parser = [{ return ::parse$cppClass(parser, result); }];
 }
 
+def Linalg_InitTensorOp : Linalg_Op<"init_tensor", [NoSideEffect]> {
+  let summary = "operation to define a tensor of particular value";
+
+  let description = [{
+`linalg.init_tensor` is an operation that materializes a tensor of
+a given shape. The shape could be dynamic or static.
+  }];
+
+  let arguments =
+(ins Variadic:$sizes, I64ArrayAttr:$static_sizes);
+
+  let results = (outs AnyTensor:$result);
+
+  let verifier = [{ return ::verify(*this); }];
+
+  let extraClassDeclaration = [{
+static StringRef getStaticSizesAttrName() {
+  return "static_sizes";
+}
+
+RankedTensorType getType() {
+  return getResult().getType().cast(); }
+
+// Infer the shape of the result tensor given the static shapes
+// and element type of the result tensor.
+static Type inferResultType(ArrayRef staticSizes, Type 
elementType);
+
+// Return true if the size of the tensor is dynamic at `idx`
+bool isDynamicSize(unsigned idx) {
+  APInt v = *(static_sizes().getAsValueRange().begin() + idx);
+  return ShapedType::isDynamic(v.getSExtValue());
+}
+
+// Assert that the size of the result tensor is static at `idx`
+// and return the shape.
+int64_t getStaticSize(unsigned idx) {
+  assert(!isDynamicSize(idx) && "expected static size");
+  APInt v = *(static_sizes().
+  template getAsValueRange().begin() + idx);
+return v.getSExtValue();
+}
+
+// Return the argument position that contains the dynamic size of
+// the tensor at dimension `idx`. Asserts that the shape is
+// dynamic at that `idx`.
+unsigned getIndexOfDynamicSize(unsigned idx) {
+  assert(isDynamicSize(idx) && "expected dynamic size");
+  return std::count_if(
+  static_sizes().getValue().begin(),
+  static_sizes().getValue().begin() + idx,
+  [&](Attribute attr) {
+return ShapedType::isDynamic(attr.cast().getInt());
+  });
+}
+
+// Return the Value of the dynamic size of the tensor at dimension
+// `idx`. Asserts that the shape is dynamic at that `idx.
+Value getDynamicSize(unsigned idx) {
+  return getOperand(getIndexOfDynamicSize(idx));
+}
+  }];
+
+  let builders = [
+OpBuilderDAG<(ins "ValueRange":$shape,
+  "ArrayRef":$staticShape, "Type":$elementType),
+[{
+  build($_builder, $_state,
+InitTensorOp::inferResultType(staticShape, elementType),
+shape, $_builder.getI64ArrayAttr(staticShape));
+}]>,
+OpBuilderDAG<(ins "ValueRange":$shape, "Type":$elementType),
+[{
+  SmallVector staticShape(
+shape.size(), ShapedType::kDynamicSize);
+  build($_builder, $_state, shape, staticShape, elementType);
+}]>,
+OpBuilderDAG<(ins "ArrayRef":$staticShape, 

[llvm-branch-commits] [llvm] 997d286 - [AIX][XCOFF] emit traceback table for function in aix

2020-12-11 Thread via llvm-branch-commits

Author: diggerlin
Date: 2020-12-11T17:50:25-05:00
New Revision: 997d286f2d0fde66f6eb825932eb06ca3b83607f

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

LOG: [AIX][XCOFF] emit traceback table for function in aix

SUMMARY:
 1. added a new option -xcoff-traceback-table to control whether generate 
traceback table for function.
 2. implement the functionality of emit traceback table of a function.

Reviewers: hubert.reinterpretcast, Jason Liu
Differential Revision: https://reviews.llvm.org/D92398

Added: 
llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable-clobber-register.ll
llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable.ll

Modified: 
llvm/include/llvm/BinaryFormat/XCOFF.h
llvm/include/llvm/CodeGen/CommandFlags.h
llvm/include/llvm/Target/TargetMachine.h
llvm/include/llvm/Target/TargetOptions.h
llvm/lib/BinaryFormat/XCOFF.cpp
llvm/lib/CodeGen/CommandFlags.cpp
llvm/lib/Object/XCOFFObjectFile.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.cpp
llvm/lib/Target/PowerPC/PPCMachineFunctionInfo.h
llvm/test/CodeGen/PowerPC/aix-alias.ll
llvm/test/CodeGen/PowerPC/aix-cc-ext-vec-abi.ll
llvm/test/CodeGen/PowerPC/aix-extern-weak.ll
llvm/test/CodeGen/PowerPC/aix-extern.ll
llvm/test/CodeGen/PowerPC/aix-func-align.ll
llvm/test/CodeGen/PowerPC/aix-func-dsc-gen.ll
llvm/test/CodeGen/PowerPC/aix-return55.ll
llvm/test/CodeGen/PowerPC/aix-user-defined-memcpy.ll
llvm/test/CodeGen/PowerPC/aix-weak.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-explicit-section.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-const.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-reloc-symb.mir
llvm/test/CodeGen/PowerPC/aix-xcoff-reloc.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-symbol-rename.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-textdisassembly.ll
llvm/test/CodeGen/PowerPC/aix-xcoff-toc.ll

Removed: 




diff  --git a/llvm/include/llvm/BinaryFormat/XCOFF.h 
b/llvm/include/llvm/BinaryFormat/XCOFF.h
index dc5c21469769..f2e11efef5cd 100644
--- a/llvm/include/llvm/BinaryFormat/XCOFF.h
+++ b/llvm/include/llvm/BinaryFormat/XCOFF.h
@@ -18,6 +18,7 @@
 
 namespace llvm {
 class StringRef;
+template  class SmallString;
 
 namespace XCOFF {
 
@@ -28,6 +29,7 @@ constexpr size_t NameSize = 8;
 constexpr size_t SymbolTableEntrySize = 18;
 constexpr size_t RelocationSerializationSize32 = 10;
 constexpr uint16_t RelocOverflow = 65535;
+constexpr uint8_t AllocRegNo = 31;
 
 enum ReservedSectionNum : int16_t { N_DEBUG = -2, N_ABS = -1, N_UNDEF = 0 };
 
@@ -294,8 +296,27 @@ enum CFileCpuId : uint8_t {
 
 StringRef getMappingClassString(XCOFF::StorageMappingClass SMC);
 StringRef getRelocationTypeString(XCOFF::RelocationType Type);
+SmallString<32> parseParmsType(uint32_t Value, unsigned ParmsNum);
 
 struct TracebackTable {
+  enum LanguageID : uint8_t {
+C,
+Fortran,
+Pascal,
+Ada,
+PL1,
+Basic,
+Lisp,
+Cobol,
+Modula2,
+CPlusPlus,
+Rpg,
+PL8,
+PLIX = PL8,
+Assembly,
+Java,
+ObjectiveC
+  };
   // Byte 1
   static constexpr uint32_t VersionMask = 0xFF00';
   static constexpr uint8_t VersionShift = 24;
@@ -381,6 +402,8 @@ enum ExtendedTBTableFlag : uint8_t {
   TB_LONGTBTABLE2 = 0x01 ///< Additional tbtable extension exists
 };
 
+StringRef getNameForTracebackTableLanguageId(TracebackTable::LanguageID 
LangId);
+
 } // end namespace XCOFF
 } // end namespace llvm
 

diff  --git a/llvm/include/llvm/CodeGen/CommandFlags.h 
b/llvm/include/llvm/CodeGen/CommandFlags.h
index ee4a9a80662e..e6c64cd4dd8e 100644
--- a/llvm/include/llvm/CodeGen/CommandFlags.h
+++ b/llvm/include/llvm/CodeGen/CommandFlags.h
@@ -99,6 +99,8 @@ Optional getExplicitFunctionSections();
 
 bool getIgnoreXCOFFVisibility();
 
+bool getXCOFFTracebackTable();
+
 std::string getBBSections();
 
 std::string getStackProtectorGuard();

diff  --git a/llvm/include/llvm/Target/TargetMachine.h 
b/llvm/include/llvm/Target/TargetMachine.h
index 14ec0a37b3fe..d4fc2d8f0887 100644
--- a/llvm/include/llvm/Target/TargetMachine.h
+++ b/llvm/include/llvm/Target/TargetMachine.h
@@ -266,12 +266,16 @@ class TargetMachine {
 return Options.FunctionSections;
   }
 
-  /// Return true if visibility attribute should not be emitted in xcoff,
+  /// Return true if visibility attribute should not be emitted in XCOFF,
   /// corresponding to -mignore-xcoff-visibility.
   bool getIgnoreXCOFFVisibility() const {
 return Options.IgnoreXCOFFVisibility;
   }
 
+  /// Return true if XCOFF traceback table should be emitted,
+  /// corresponding to 

[llvm-branch-commits] [llvm] 7c8072c - [AIX] Fixed a link error.

2020-12-11 Thread via llvm-branch-commits

Author: diggerlin
Date: 2020-12-11T18:53:10-05:00
New Revision: 7c8072ce2dbcf76a4fcc4269b87dd313c95a526a

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

LOG: [AIX] Fixed a link error.

Summary:

 "Speculative fix for link failure on bots" with a mention of "the 
clang-ppc64le-rhel bot fails on link: 
http://lab.llvm.org:8011/#/builders/57/builds/2307/steps/6/logs/stdio;.

PPCAsmPrinter.cpp:(.text._ZN12_GLOBAL__N_116PPCAIXAsmPrinter19emitFunctionBodyEndEv+0x2f8):
 undefined reference to 
`llvm::XCOFF::getNameForTracebackTableLanguageId(llvm::XCOFF::TracebackTable::LanguageID)'
PPCAsmPrinter.cpp:(.text._ZN12_GLOBAL__N_116PPCAIXAsmPrinter19emitFunctionBodyEndEv+0x2170):
 undefined reference to `llvm::XCOFF::parseParmsType(unsigned int, unsigned 
int)'

Added: 


Modified: 
llvm/lib/Target/PowerPC/CMakeLists.txt

Removed: 




diff  --git a/llvm/lib/Target/PowerPC/CMakeLists.txt 
b/llvm/lib/Target/PowerPC/CMakeLists.txt
index eb2aa3929fd7..6da1601c169d 100644
--- a/llvm/lib/Target/PowerPC/CMakeLists.txt
+++ b/llvm/lib/Target/PowerPC/CMakeLists.txt
@@ -61,6 +61,7 @@ add_llvm_target(PowerPCCodeGen
   LINK_COMPONENTS
   Analysis
   AsmPrinter
+  BinaryFormat
   CodeGen
   Core
   MC



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


  1   2   3   4   5   6   7   8   9   10   >