[llvm-branch-commits] [clang] 635b787 - [clang-repl] Install clang-repl

2021-09-17 Thread Tom Stellard via llvm-branch-commits

Author: Vassil Vassilev
Date: 2021-09-17T10:11:23-07:00
New Revision: 635b7871de937b8f2ea23b5a9ce70a71491dc4ca

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

LOG: [clang-repl] Install clang-repl

This is essentially what D106813 was supposed to do but did not.

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

(cherry picked from commit c9948e9254fbb6ea00f66c7b4542311d21e060be)

Added: 


Modified: 
clang/tools/clang-repl/CMakeLists.txt

Removed: 




diff  --git a/clang/tools/clang-repl/CMakeLists.txt 
b/clang/tools/clang-repl/CMakeLists.txt
index c2576d7c564d9..060c62aa419c7 100644
--- a/clang/tools/clang-repl/CMakeLists.txt
+++ b/clang/tools/clang-repl/CMakeLists.txt
@@ -7,7 +7,7 @@ set( LLVM_LINK_COMPONENTS
   Support
   )
 
-add_clang_executable(clang-repl
+add_clang_tool(clang-repl
   ClangRepl.cpp
   )
 



___
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] 89f2c0c - [clang] disable implicit moves when not in CPlusPLus

2021-09-17 Thread Tom Stellard via llvm-branch-commits

Author: Matheus Izvekov
Date: 2021-09-17T10:13:15-07:00
New Revision: 89f2c0c63c220fd5aa36279401a5cb883dfbbc34

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

LOG: [clang] disable implicit moves when not in CPlusPLus

See PR51842.

This fixes an assert firing in the static analyzer, triggered by implicit moves
in blocks in C mode:

This also simplifies the AST a little bit when compiling non C++ code,
as the xvalue implicit casts are not inserted.

We keep and test that the nrvo flag is still being set on the VarDecls,
as that is still a bit beneficial while not really making anything
more complicated.

Signed-off-by: Matheus Izvekov 

Reviewed By: NoQ

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

(cherry picked from commit 2d6829bbbe6877920d9be1db93b9f3fc85b43d10)

Added: 
clang/test/AST/nrvo.c
clang/test/Analysis/blocks-nrvo.c

Modified: 
clang/lib/Sema/SemaStmt.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 3baccec2d7bb4..f7e4110e6110e 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -3481,7 +3481,8 @@ VerifyInitializationSequenceCXX98(const Sema &S,
 ExprResult Sema::PerformMoveOrCopyInitialization(
 const InitializedEntity &Entity, const NamedReturnInfo &NRInfo, Expr 
*Value,
 bool SupressSimplerImplicitMoves) {
-  if ((!getLangOpts().CPlusPlus2b || SupressSimplerImplicitMoves) &&
+  if (getLangOpts().CPlusPlus &&
+  (!getLangOpts().CPlusPlus2b || SupressSimplerImplicitMoves) &&
   NRInfo.isMoveEligible()) {
 ImplicitCastExpr AsRvalue(ImplicitCastExpr::OnStack, Value->getType(),
   CK_NoOp, Value, VK_XValue, FPOptionsOverride());

diff  --git a/clang/test/AST/nrvo.c b/clang/test/AST/nrvo.c
new file mode 100644
index 0..4f50d6a1e384b
--- /dev/null
+++ b/clang/test/AST/nrvo.c
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -ast-dump -fblocks %s | FileCheck -strict-whitespace %s
+
+struct A {};
+
+struct A f1() {
+  // CHECK:  FunctionDecl 0x{{[^ ]*}}  line:[[@LINE-1]]:10 f1 'struct A ()'
+  // CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} 
+  struct A a;
+  // CHECK-NEXT: DeclStmt 0x{{[^ ]*}} 
+  // CHECK-NEXT: VarDecl 0x{{[^ ]*}}  col:12 used a 'struct 
A':'struct A' nrvo
+  return a;
+  // CHECK-NEXT: ReturnStmt 0x{{[^ ]*}} 
+  // CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}  'struct A':'struct A' 

+  // CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}}  'struct A':'struct A' lvalue 
Var 0x{{[^ ]*}} 'a' 'struct A':'struct A'
+}
+
+void f2() {
+  (void)^{
+// CHECK:  BlockDecl 0x{{[^ ]*}}  line:[[@LINE-1]]:9
+// CHECK-NEXT: CompoundStmt 0x{{[^ ]*}} 
+struct A a;
+// CHECK-NEXT: DeclStmt 0x{{[^ ]*}} 
+// CHECK-NEXT: VarDecl 0x{{[^ ]*}}  col:14 used a 'struct 
A':'struct A' nrvo
+return a;
+// CHECK-NEXT: ReturnStmt 0x{{[^ ]*}} 
+// CHECK-NEXT: ImplicitCastExpr 0x{{[^ ]*}}  'struct A':'struct A' 

+// CHECK-NEXT: DeclRefExpr 0x{{[^ ]*}}  'struct A':'struct A' 
lvalue Var 0x{{[^ ]*}} 'a' 'struct A':'struct A'
+  }();
+}

diff  --git a/clang/test/Analysis/blocks-nrvo.c 
b/clang/test/Analysis/blocks-nrvo.c
new file mode 100644
index 0..bb0be869ee767
--- /dev/null
+++ b/clang/test/Analysis/blocks-nrvo.c
@@ -0,0 +1,14 @@
+// RUN: %clang_analyze_cc1 -w -analyzer-checker=core -fblocks -verify %s
+
+// expected-no-diagnostics
+
+typedef struct {
+  int x;
+} S;
+
+void foo() {
+  ^{
+S s;
+return s; // no-crash
+  };
+}



___
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] [compiler-rt] d811546 - [compiler-rt] Move -fno-omit-frame-pointer check to common config-ix

2021-09-17 Thread Tom Stellard via llvm-branch-commits

Author: Michał Górny
Date: 2021-09-17T16:35:02-07:00
New Revision: d811546f803c0aa33d092f6fa181b77a1770869a

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

LOG: [compiler-rt] Move -fno-omit-frame-pointer check to common config-ix

9ee64c374605683ae80b9641d5312a72c2a67336 has started using
COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG inside scudo.  However,
the relevant CMake check was performed in builtin-config-ix.cmake,
so the definition was missing when builtins were not built.  Move
the check to config-ix.cmake, so that it runs unconditionally of
the components being built.

Fixes PR#51847

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

(cherry picked from commit 210d72e9d6b4a8e7633921d0bd7186fd3c7a2c8c)

Added: 


Modified: 
compiler-rt/cmake/builtin-config-ix.cmake
compiler-rt/cmake/config-ix.cmake

Removed: 




diff  --git a/compiler-rt/cmake/builtin-config-ix.cmake 
b/compiler-rt/cmake/builtin-config-ix.cmake
index 213741869336b..fe5661b776360 100644
--- a/compiler-rt/cmake/builtin-config-ix.cmake
+++ b/compiler-rt/cmake/builtin-config-ix.cmake
@@ -10,7 +10,6 @@ builtin_check_c_compiler_flag(-fPIE 
COMPILER_RT_HAS_FPIE_FLAG)
 builtin_check_c_compiler_flag(-fno-builtin  
COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
 builtin_check_c_compiler_flag(-std=c11  
COMPILER_RT_HAS_STD_C11_FLAG)
 builtin_check_c_compiler_flag(-fvisibility=hidden   
COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG)
-builtin_check_c_compiler_flag(-fomit-frame-pointer  
COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG)
 builtin_check_c_compiler_flag(-ffreestanding
COMPILER_RT_HAS_FREESTANDING_FLAG)
 builtin_check_c_compiler_flag(-fxray-instrument 
COMPILER_RT_HAS_XRAY_COMPILER_FLAG)
 

diff  --git a/compiler-rt/cmake/config-ix.cmake 
b/compiler-rt/cmake/config-ix.cmake
index 6f13acfa27579..39b9120f00adf 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -55,6 +55,7 @@ endif ()
 
 # CodeGen options.
 check_c_compiler_flag(-ffreestanding 
COMPILER_RT_HAS_FFREESTANDING_FLAG)
+check_c_compiler_flag(-fomit-frame-pointer   
COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG)
 check_c_compiler_flag(-std=c11   COMPILER_RT_HAS_STD_C11_FLAG)
 check_cxx_compiler_flag(-fPICCOMPILER_RT_HAS_FPIC_FLAG)
 check_cxx_compiler_flag(-fPIECOMPILER_RT_HAS_FPIE_FLAG)



___
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] 8d78ac2 - [OpenMP]Fix PR51349: Remove AlwaysInline for if regions.

2021-09-17 Thread Tom Stellard via llvm-branch-commits

Author: Joseph Huber
Date: 2021-09-17T20:48:53-07:00
New Revision: 8d78ac26f4752b140d47076bf6ba7dd73226784a

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

LOG: [OpenMP]Fix PR51349: Remove AlwaysInline for if regions.

After D94315 we add the `NoInline` attribute to the outlined function to handle
data environments in the OpenMP if clause. This conflicted with the 
`AlwaysInline`
attribute added to the outlined function. for better performance in D106799.
The data environments should ideally not require NoInline, but for now this
fixes PR51349.

Reviewed By: mikerice

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

(cherry picked from commit 41a6b50c25961addc04438b567ee1f4ef9e40f98)

Added: 
clang/test/OpenMP/parallel_if_codegen_PR51349.cpp

Modified: 
clang/lib/CodeGen/CGOpenMPRuntime.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index c09797e91b998..ca98c7a574465 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -2120,11 +2120,12 @@ void CGOpenMPRuntime::emitParallelCall(CodeGenFunction 
&CGF, SourceLocation Loc,
 OutlinedFnArgs.append(CapturedVars.begin(), CapturedVars.end());
 
 // Ensure we do not inline the function. This is trivially true for the 
ones
-// passed to __kmpc_fork_call but the ones calles in serialized regions
+// passed to __kmpc_fork_call but the ones called in serialized regions
 // could be inlined. This is not a perfect but it is closer to the 
invariant
 // we want, namely, every data environment starts with a new function.
 // TODO: We should pass the if condition to the runtime function and do the
 //   handling there. Much cleaner code.
+OutlinedFn->removeFnAttr(llvm::Attribute::AlwaysInline);
 OutlinedFn->addFnAttr(llvm::Attribute::NoInline);
 RT.emitOutlinedFunctionCall(CGF, Loc, OutlinedFn, OutlinedFnArgs);
 

diff  --git a/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp 
b/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
new file mode 100644
index 0..eee2c4fd38bc6
--- /dev/null
+++ b/clang/test/OpenMP/parallel_if_codegen_PR51349.cpp
@@ -0,0 +1,38 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --function-signature --check-attributes --include-generated-funcs
+// RUN: %clang_cc1 -x c++ -O1 -fopenmp-version=45 -disable-llvm-optzns -verify 
-fopenmp -triple x86_64-unknown-linux -emit-llvm %s -o - | FileCheck %s 
--check-prefix=CHECK
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+
+void foo() {
+#pragma omp parallel if(0)
+  ;
+}
+
+#endif
+// CHECK: Function Attrs: mustprogress nounwind
+// CHECK-LABEL: define {{[^@]+}}@_Z3foov
+// CHECK-SAME: () #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[DOTTHREADID_TEMP_:%.*]] = alloca i32, align 4
+// CHECK-NEXT:[[DOTBOUND_ZERO_ADDR:%.*]] = alloca i32, align 4
+// CHECK-NEXT:store i32 0, i32* [[DOTBOUND_ZERO_ADDR]], align 4
+// CHECK-NEXT:[[TMP0:%.*]] = call i32 
@__kmpc_global_thread_num(%struct.ident_t* @[[GLOB1:[0-9]+]])
+// CHECK-NEXT:call void @__kmpc_serialized_parallel(%struct.ident_t* 
@[[GLOB1]], i32 [[TMP0]])
+// CHECK-NEXT:store i32 [[TMP0]], i32* [[DOTTHREADID_TEMP_]], align 4, 
!tbaa [[TBAA3:![0-9]+]]
+// CHECK-NEXT:call void @.omp_outlined.(i32* [[DOTTHREADID_TEMP_]], i32* 
[[DOTBOUND_ZERO_ADDR]]) #[[ATTR2:[0-9]+]]
+// CHECK-NEXT:call void @__kmpc_end_serialized_parallel(%struct.ident_t* 
@[[GLOB1]], i32 [[TMP0]])
+// CHECK-NEXT:ret void
+//
+//
+// CHECK: Function Attrs: noinline norecurse nounwind
+// CHECK-LABEL: define {{[^@]+}}@.omp_outlined.
+// CHECK-SAME: (i32* noalias [[DOTGLOBAL_TID_:%.*]], i32* noalias 
[[DOTBOUND_TID_:%.*]]) #[[ATTR1:[0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[DOTGLOBAL_TID__ADDR:%.*]] = alloca i32*, align 8
+// CHECK-NEXT:[[DOTBOUND_TID__ADDR:%.*]] = alloca i32*, align 8
+// CHECK-NEXT:store i32* [[DOTGLOBAL_TID_]], i32** 
[[DOTGLOBAL_TID__ADDR]], align 8, !tbaa [[TBAA7:![0-9]+]]
+// CHECK-NEXT:store i32* [[DOTBOUND_TID_]], i32** [[DOTBOUND_TID__ADDR]], 
align 8, !tbaa [[TBAA7]]
+// 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] [lld] 6aa0542 - [LLD] Add required `ppc` target to the test cases. NFC

2021-09-17 Thread Tom Stellard via llvm-branch-commits

Author: Simon Atanasyan
Date: 2021-09-17T20:51:23-07:00
New Revision: 6aa054242d60f7cf9512d927ebf7ca2289115ecd

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

LOG: [LLD] Add required `ppc` target to the test cases. NFC

(cherry picked from commit 454f69bcc17e6451c926a2e7b708e900fc8fdcb8)

Added: 


Modified: 
lld/test/ELF/compressed-debug-input-err.s
lld/test/ELF/compressed-debug-input.s

Removed: 




diff  --git a/lld/test/ELF/compressed-debug-input-err.s 
b/lld/test/ELF/compressed-debug-input-err.s
index 0495a9eaa08e9..922fcfc61bb37 100644
--- a/lld/test/ELF/compressed-debug-input-err.s
+++ b/lld/test/ELF/compressed-debug-input-err.s
@@ -1,4 +1,4 @@
-# REQUIRES: zlib, x86
+# REQUIRES: zlib, ppc, x86
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: not ld.lld %t.o -o /dev/null -shared 2>&1 | FileCheck %s

diff  --git a/lld/test/ELF/compressed-debug-input.s 
b/lld/test/ELF/compressed-debug-input.s
index 5b61ea8b384e0..af81d6fff3115 100644
--- a/lld/test/ELF/compressed-debug-input.s
+++ b/lld/test/ELF/compressed-debug-input.s
@@ -1,4 +1,4 @@
-# REQUIRES: zlib, x86
+# REQUIRES: zlib, ppc, x86
 
 # RUN: llvm-mc -compress-debug-sections=zlib -filetype=obj 
-triple=x86_64-unknown-linux %s -o %t
 # RUN: llvm-mc -compress-debug-sections=zlib -filetype=obj 
-triple=powerpc64-unknown-unknown %s -o %t-be



___
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] [compiler-rt] 6a5ccb2 - [compiler-rt] Implement __clear_cache() on OpenBSD/riscv64

2021-09-17 Thread Tom Stellard via llvm-branch-commits

Author: Jeremie Courreges-Anglas
Date: 2021-09-17T20:54:32-07:00
New Revision: 6a5ccb2ec43887dba71b5ba6a9a035b18e619ad6

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

LOG: [compiler-rt] Implement __clear_cache() on OpenBSD/riscv64

(cherry picked from commit 3db959060546eef76b90733ccde80c75576a97ad)

Added: 


Modified: 
compiler-rt/lib/builtins/clear_cache.c

Removed: 




diff  --git a/compiler-rt/lib/builtins/clear_cache.c 
b/compiler-rt/lib/builtins/clear_cache.c
index 3c12b74e8fa62..da0715914b416 100644
--- a/compiler-rt/lib/builtins/clear_cache.c
+++ b/compiler-rt/lib/builtins/clear_cache.c
@@ -35,7 +35,7 @@ uintptr_t GetCurrentProcess(void);
 #include 
 #endif
 
-#if defined(__OpenBSD__) && (defined(__arm__) || defined(__mips__))
+#if defined(__OpenBSD__) && (defined(__arm__) || defined(__mips__) || 
defined(__riscv))
 // clang-format off
 #include 
 #include 
@@ -166,6 +166,13 @@ void __clear_cache(void *start, void *end) {
: "=r"(start_reg)
: "r"(start_reg), "r"(end_reg), "r"(flags), 
"r"(syscall_nr));
   assert(start_reg == 0 && "Cache flush syscall failed.");
+#elif defined(__riscv) && defined(__OpenBSD__)
+  struct riscv_sync_icache_args arg;
+
+  arg.addr = (uintptr_t)start;
+  arg.len = (uintptr_t)end - (uintptr_t)start;
+
+  sysarch(RISCV_SYNC_ICACHE, &arg);
 #else
 #if __APPLE__
   // On Darwin, sys_icache_invalidate() provides this functionality



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