[llvm-branch-commits] [llvm] 1817392 - [docs] Update release notes with items related to Flang

2021-09-07 Thread Andrzej Warzynski via llvm-branch-commits

Author: Andrzej Warzynski
Date: 2021-09-06T14:48:43+01:00
New Revision: 181739213aa00de40a5bc6fbb1c578ce25b78d39

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

LOG: [docs] Update release notes with items related to Flang

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

Added: 


Modified: 
llvm/docs/ReleaseNotes.rst

Removed: 




diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 515e9fef6d2aa..a192485d46836 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -55,6 +55,8 @@ Non-comprehensive list of changes in this release
   emits valid unwind entrypoints which are validated when the context is being
   set during exception handling.
 
+* Flang is now included in the binary packages released by LLVM.
+
 Changes to the LLVM IR
 --
 



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] a5e968b - [clang] Allow the OpenBSD driver to link the libclang_rt.profile library.

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

Author: Frederic Cambus
Date: 2021-09-07T10:38:36-07:00
New Revision: a5e968b66a5988ee0a565e8252bc5ed3557a1d53

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

LOG: [clang] Allow the OpenBSD driver to link the libclang_rt.profile library.

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

(cherry picked from commit 466451c6616272d8c779618b92b0ae80f394a795)

Added: 


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

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index e162165b25613..6711e2e2297dd 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -221,6 +221,8 @@ void openbsd::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
   }
 
+  ToolChain.addProfileRTLibs(Args, CmdArgs);
+
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] be30527 - OpenBSD also needs execinfo

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

Author: Brad Smith
Date: 2021-09-07T10:39:46-07:00
New Revision: be305271bfb6fc44b87662e10c85a9e7455a21c0

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

LOG: OpenBSD also needs execinfo

(cherry picked from commit b989662eb000efb54b91b8c82d2b2713e2da20fc)

Added: 


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

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 83cab3ac00cb6..0ffe95795381c 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -775,7 +775,8 @@ void tools::linkSanitizerRuntimeDeps(const ToolChain &TC,
 CmdArgs.push_back("-ldl");
   // Required for backtrace on some OSes
   if (TC.getTriple().isOSFreeBSD() ||
-  TC.getTriple().isOSNetBSD())
+  TC.getTriple().isOSNetBSD() ||
+  TC.getTriple().isOSOpenBSD())
 CmdArgs.push_back("-lexecinfo");
 }
 



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 6668e31 - Support linking against OpenMP runtime on OpenBSD.

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

Author: Brad Smith
Date: 2021-09-07T10:41:03-07:00
New Revision: 6668e31250ba436692e3babfbaf85a0d7cfb298d

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

LOG: Support linking against OpenMP runtime on OpenBSD.

(cherry picked from commit 775ab780fd2a23cfc80ace571938ddd21d080173)

Added: 


Modified: 
clang/lib/Driver/ToolChains/OpenBSD.cpp
clang/test/Driver/fopenmp.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/OpenBSD.cpp 
b/clang/lib/Driver/ToolChains/OpenBSD.cpp
index 6711e2e2297dd..89828fbb6f5f6 100644
--- a/clang/lib/Driver/ToolChains/OpenBSD.cpp
+++ b/clang/lib/Driver/ToolChains/OpenBSD.cpp
@@ -174,6 +174,11 @@ void openbsd::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
+// Use the static OpenMP runtime with -static-openmp
+bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
+!Args.hasArg(options::OPT_static);
+addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
+
 if (D.CCCIsCXX()) {
   if (ToolChain.ShouldLinkCXXStdlib(Args))
 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);

diff  --git a/clang/test/Driver/fopenmp.c b/clang/test/Driver/fopenmp.c
index b467fbed93e26..aadade101125e 100644
--- a/clang/test/Driver/fopenmp.c
+++ b/clang/test/Driver/fopenmp.c
@@ -10,6 +10,9 @@
 // RUN: %clang -target x86_64-netbsd -fopenmp=libomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
 // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
 // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
+// RUN: %clang -target x86_64-openbsd -fopenmp=libomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
+// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
+// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
@@ -74,6 +77,19 @@
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
 //
+// RUN: %clang -target x86_64-openbsd -fopenmp=libomp %s -o %t -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-LD-OMP
+// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp %s -o %t -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
+// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-LD-IOMP5
+//
+// RUN: %clang -target x86_64-openbsd -fopenmp=libomp -static-openmp %s -o %t 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP
+// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp -static-openmp %s -o %t 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP 
--check-prefix=CHECK-LD-STATIC-GOMP-NO-RT
+// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -static-openmp %s -o 
%t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5
+// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -static -static-openmp 
%s -o %t -### 2>&1 | FileCheck %s 
--check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC
+//
+// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libomp %s -o %t -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
+// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libgomp %s -o %t -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
+// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libiomp5 %s -o %t 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
+//
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-LD-OMP
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 
| FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
 // RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 
| FileCheck %s --check-prefix=CHECK-LD-IOMP5MD
@@ -120,7 +136,7 @@
 // CHECK-LD-STATIC-IOMP5: "-Bstatic" "-liomp5" "-Bdynamic"
 //
 // CHECK-LD-STATIC-IOMP5-NO-BD

[llvm-branch-commits] [clang] c30b281 - [clang] fix error recovery ICE on copy elision when returing invalid variable

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

Author: Matheus Izvekov
Date: 2021-09-07T10:45:35-07:00
New Revision: c30b2813a1d522eb9adeec2d73b1e79a8020c998

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

LOG: [clang] fix error recovery ICE on copy elision when returing invalid 
variable

See PR51708.

Attempting copy elision in dependent contexts with invalid variable,
such as a variable with incomplete type, would cause a crash when attempting
to calculate it's alignment.

The fix is to just skip this optimization on invalid VarDecl, as otherwise this
provides no benefit to error recovery: This functionality does not try to
diagnose anything, it only calculates a flag which will affect where the
variable will be allocated during codegen.

Signed-off-by: Matheus Izvekov 

Reviewed By: rtrieu

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

(cherry picked from commit d98c34f4d7950f531661ba3f498222ccf6239a0f)

Added: 


Modified: 
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/CXX/class/class.init/class.copy.elision/p3.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index be4c519307898..25f1348687581 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1087,7 +1087,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D,
 
   SemaRef.BuildVariableInstantiation(Var, D, TemplateArgs, LateAttrs, Owner,
  StartingScope, InstantiatingVarTemplate);
-  if (D->isNRVOVariable()) {
+  if (D->isNRVOVariable() && !Var->isInvalidDecl()) {
 QualType RT;
 if (auto *F = dyn_cast(DC))
   RT = F->getReturnType();

diff  --git a/clang/test/CXX/class/class.init/class.copy.elision/p3.cpp 
b/clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
index cd981264c9b69..7055acad6ccf9 100644
--- a/clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
+++ b/clang/test/CXX/class/class.init/class.copy.elision/p3.cpp
@@ -518,3 +518,37 @@ template  X test_dependent_invalid_decl() {
 template X test_dependent_invalid_decl(); // expected-note 
{{requested here}}
 
 } // namespace test_auto_variables
+
+namespace PR51708 {
+
+class a1;  // expected-note 4 {{forward declaration of 
'PR51708::a1'}}
+template  class A2; // expected-note 4 {{template is declared here}}
+using a2 = A2;
+
+template  b f() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function 
definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  b d;
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  return d;
+}
+template a1 f(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+template a2 f(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+
+template  b g() {
+  // expected-error@-1 {{incomplete result type 'PR51708::a1' in function 
definition}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  b d __attribute__((aligned(1)));
+  // expected-error@-1 {{variable has incomplete type 'PR51708::a1'}}
+  // expected-error@-2 {{implicit instantiation of undefined template 
'PR51708::A2}}
+
+  return d;
+}
+template a1 g(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+template a2 g(); // expected-note-re {{in instantiation {{.*}} requested 
here}}
+
+} // namespace PR51708



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] a52b7bf - PR50294: Fix a performance regression from 2c9dbcd.

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

Author: Richard Smith
Date: 2021-09-07T10:46:41-07:00
New Revision: a52b7bf7d1238bc34d5810884404993078beae01

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

LOG: PR50294: Fix a performance regression from 2c9dbcd.

Per the contract of ReadLateParsedTemplates, we should not be returning
the same results multiple times. No functionality change intended, other
than to runtime.

Thanks to Luboš Luňák for identifying the cause of the regression!

(cherry picked from commit 6eda66b0a9f793c65852aa94430ae9bd891bcf63)

Added: 


Modified: 
clang/lib/Serialization/ASTReader.cpp

Removed: 




diff  --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index 83bade9941b3d..1722572f1a277 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -8456,6 +8456,8 @@ void ASTReader::ReadLateParsedTemplates(
   LPTMap.insert(std::make_pair(FD, std::move(LT)));
 }
   }
+
+  LateParsedTemplates.clear();
 }
 
 void ASTReader::LoadSelector(Selector Sel) {



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 2a1d8b5 - [clang] OpenBSD does not support C11 atomics or threads.

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

Author: Brad Smith
Date: 2021-09-07T10:47:40-07:00
New Revision: 2a1d8b5016eb1aa2838457c9c50699e179f7

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

LOG: [clang] OpenBSD does not support C11 atomics or threads.

(cherry picked from commit d8cd7806310c51af912a647a6ca46de62ff13214)

Added: 


Modified: 
clang/lib/Basic/Targets/OSTargets.h
clang/test/Preprocessor/init.c

Removed: 




diff  --git a/clang/lib/Basic/Targets/OSTargets.h 
b/clang/lib/Basic/Targets/OSTargets.h
index e24fb5cf082df..234365ae84d79 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -462,6 +462,11 @@ class LLVM_LIBRARY_VISIBILITY OpenBSDTargetInfo : public 
OSTargetInfo {
   Builder.defineMacro("__FLOAT128__");
   }
 
+  if (Opts.C11) {
+Builder.defineMacro("__STDC_NO_ATOMICS__");
+Builder.defineMacro("__STDC_NO_THREADS__");
+  }
+
 public:
   OpenBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : OSTargetInfo(Triple, Opts) {

diff  --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c
index 20ab2c05596b3..43708837c4ae6 100644
--- a/clang/test/Preprocessor/init.c
+++ b/clang/test/Preprocessor/init.c
@@ -1464,6 +1464,16 @@
 // OPENBSD:#define __WCHAR_TYPE__ int
 // OPENBSD:#define __WINT_TYPE__ int
 //
+// RUN: %clang_cc1 -x c -std=c11 -E -dM -ffreestanding 
-triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines 
-check-prefix OPENBSD-STDC %s
+// RUN: %clang_cc1 -x c -std=gnu11 -E -dM -ffreestanding 
-triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines 
-check-prefix OPENBSD-STDC %s
+// RUN: %clang_cc1 -x c -std=c17 -E -dM -ffreestanding 
-triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines 
-check-prefix OPENBSD-STDC %s
+// OPENBSD-STDC:#define __STDC_NO_ATOMICS__ 1
+// OPENBSD-STDC:#define __STDC_NO_THREADS__ 1
+//
+// RUN: %clang_cc1 -x c -std=c99 -E -dM -ffreestanding 
-triple=amd64-unknown-openbsd < /dev/null | FileCheck -match-full-lines 
-check-prefix OPENBSD-STDC-N %s
+// OPENBSD-STDC-N-NOT:#define __STDC_NO_ATOMICS__ 1
+// OPENBSD-STDC-N-NOT:#define __STDC_NO_THREADS__ 1
+//
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=xcore-none-none < /dev/null | 
FileCheck -match-full-lines -check-prefix XCORE %s
 // XCORE:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
 // XCORE:#define __LITTLE_ENDIAN__ 1



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 8aa8ed9 - Fix for commit d8cd7806310c51af912a647a6ca46de62ff13214.

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

Author: Brad Smith
Date: 2021-09-07T10:47:46-07:00
New Revision: 8aa8ed9d4b5f770771232c7fbe3a56ba8e8f2960

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

LOG: Fix for commit d8cd7806310c51af912a647a6ca46de62ff13214.

(cherry picked from commit bce178a5ecf10df762cbda59c7f60cca8e52ce3a)

Added: 


Modified: 
clang/lib/Basic/Targets/OSTargets.h

Removed: 




diff  --git a/clang/lib/Basic/Targets/OSTargets.h 
b/clang/lib/Basic/Targets/OSTargets.h
index 234365ae84d79..3fe39ed64d9ce 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -460,11 +460,11 @@ class LLVM_LIBRARY_VISIBILITY OpenBSDTargetInfo : public 
OSTargetInfo {
   Builder.defineMacro("_REENTRANT");
 if (this->HasFloat128)
   Builder.defineMacro("__FLOAT128__");
-  }
 
-  if (Opts.C11) {
-Builder.defineMacro("__STDC_NO_ATOMICS__");
-Builder.defineMacro("__STDC_NO_THREADS__");
+if (Opts.C11) {
+  Builder.defineMacro("__STDC_NO_ATOMICS__");
+  Builder.defineMacro("__STDC_NO_THREADS__");
+}
   }
 
 public:



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 49dacda - [tests] precommit tests for D107692

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

Author: Yunde Zhong
Date: 2021-09-07T22:33:46-07:00
New Revision: 49dacda603b353662583664f302b8ece019a346c

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

LOG: [tests] precommit tests for D107692

(cherry picked from commit 9790a2a72f60bb2caf891658c3c6a02b61e1f1a2)

Added: 
llvm/test/CodeGen/AArch64/arm64-srl-and.ll

Modified: 


Removed: 




diff  --git a/llvm/test/CodeGen/AArch64/arm64-srl-and.ll 
b/llvm/test/CodeGen/AArch64/arm64-srl-and.ll
new file mode 100644
index ..2f024e444d25
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/arm64-srl-and.ll
@@ -0,0 +1,29 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -mtriple=aarch64-linux-gnu -O3 < %s | FileCheck %s
+
+; Disable the dagcombine if operand has multi use
+
+@g = global i16 0, align 4
+define i32 @srl_and()  {
+; CHECK-LABEL: srl_and:
+; CHECK:   // %bb.0: // %entry
+; CHECK-NEXT:adrp x8, :got:g
+; CHECK-NEXT:ldr x8, [x8, :got_lo12:g]
+; CHECK-NEXT:mov w9, #50
+; CHECK-NEXT:ldrh w8, [x8]
+; CHECK-NEXT:eor w8, w8, w9
+; CHECK-NEXT:sub w8, w8, #1
+; CHECK-NEXT:and w0, w8, w8, lsr #16
+; CHECK-NEXT:ret
+entry:
+  %0 = load i16, i16* @g, align 4
+  %1 = xor i16 %0, 50
+  %tobool = icmp ne i16 %1, 0
+  %lor.ext = zext i1 %tobool to i32
+  %sub = add i16 %1, -1
+
+  %srl = zext i16 %sub to i32
+  %and = and i32 %srl, %lor.ext
+
+  ret i32 %and
+}



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 9b3867e - [DAGCombine] Prevent the transform of combine for multi-use operand

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

Author: Sanjay Patel
Date: 2021-09-07T22:33:53-07:00
New Revision: 9b3867e959fada1b09e681c99501accff72b6c1e

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

LOG: [DAGCombine] Prevent the transform of combine for multi-use operand

The test is based on a miscompile example in:
https://llvm.org/PR51321

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

(cherry picked from commit e1e4bf174b09bcd4b25cd624f177537890bff785)

Added: 


Modified: 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/arm64-srl-and.ll

Removed: 




diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 4f730b2cf372..dc245f0d7b16 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -5133,8 +5133,9 @@ SDValue DAGCombiner::visitANDLike(SDValue N0, SDValue N1, 
SDNode *N) {
   if (SDValue V = foldLogicOfSetCCs(true, N0, N1, DL))
 return V;
 
+  // TODO: Rewrite this to return a new 'AND' instead of using CombineTo.
   if (N0.getOpcode() == ISD::ADD && N1.getOpcode() == ISD::SRL &&
-  VT.getSizeInBits() <= 64) {
+  VT.getSizeInBits() <= 64 && N0->hasOneUse()) {
 if (ConstantSDNode *ADDI = dyn_cast(N0.getOperand(1))) {
   if (ConstantSDNode *SRLI = dyn_cast(N1.getOperand(1))) {
 // Look for (and (add x, c1), (lshr y, c2)). If C1 wasn't a legal

diff  --git a/llvm/test/CodeGen/AArch64/arm64-srl-and.ll 
b/llvm/test/CodeGen/AArch64/arm64-srl-and.ll
index 2f024e444d25..c6b301b8e80e 100644
--- a/llvm/test/CodeGen/AArch64/arm64-srl-and.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-srl-and.ll
@@ -1,7 +1,8 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
 ; RUN: llc -mtriple=aarch64-linux-gnu -O3 < %s | FileCheck %s
 
-; Disable the dagcombine if operand has multi use
+; This used to miscompile:
+; The 16-bit -1 should not become 32-bit -1 (sub w8, w8, #1).
 
 @g = global i16 0, align 4
 define i32 @srl_and()  {
@@ -12,7 +13,8 @@ define i32 @srl_and()  {
 ; CHECK-NEXT:mov w9, #50
 ; CHECK-NEXT:ldrh w8, [x8]
 ; CHECK-NEXT:eor w8, w8, w9
-; CHECK-NEXT:sub w8, w8, #1
+; CHECK-NEXT:mov w9, #65535
+; CHECK-NEXT:add w8, w8, w9
 ; CHECK-NEXT:and w0, w8, w8, lsr #16
 ; CHECK-NEXT:ret
 entry:



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] a98b397 - [SCEV] Fix applyLoopGuards() with range check idiom (PR51760)

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

Author: Nikita Popov
Date: 2021-09-07T22:34:39-07:00
New Revision: a98b397504f835ddc473c344a5a3f101a8d800f0

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

LOG: [SCEV] Fix applyLoopGuards() with range check idiom (PR51760)

Due to a typo, this replaced %x with umax(C1, umin(C2, %x + C3))
rather than umax(C1, umin(C2, %x)). This didn't make a difference
for the existing tests, because the result is only used for range
calculation, and %x will usually have an unknown starting range,
and the additional offset keeps it unknown. However, if %x already
has a known range, we may compute a result range that is too
small.

(cherry picked from commit 8d54c8a0c3d7d4a50186ae7087780c6082e5bb46)

Added: 


Modified: 
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll

Removed: 




diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp 
b/llvm/lib/Analysis/ScalarEvolution.cpp
index f22d834b5e57..2d980e6935b3 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -13969,7 +13969,7 @@ const SCEV *ScalarEvolution::applyLoopGuards(const SCEV 
*Expr, const Loop *L) {
   if (ExactRegion.isWrappedSet() || ExactRegion.isFullSet())
 return false;
   auto I = RewriteMap.find(LHSUnknown->getValue());
-  const SCEV *RewrittenLHS = I != RewriteMap.end() ? I->second : LHS;
+  const SCEV *RewrittenLHS = I != RewriteMap.end() ? I->second : 
LHSUnknown;
   RewriteMap[LHSUnknown->getValue()] = getUMaxExpr(
   getConstant(ExactRegion.getUnsignedMin()),
   getUMinExpr(RewrittenLHS, 
getConstant(ExactRegion.getUnsignedMax(;

diff  --git 
a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll 
b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
index 9e7957a3736e..7dd21827d0b3 100644
--- a/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
+++ b/llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll
@@ -1327,6 +1327,46 @@ exit:
   ret void
 }
 
+; Same as @optimized_range_check_unsigned, but %N already has a range limited
+; to [2,4) beforehand.
+define void @optimized_range_check_unsigned3(i16* %pred, i1 %c) {
+; CHECK-LABEL: 'optimized_range_check_unsigned3'
+; CHECK-NEXT:  Classifying expressions for: @optimized_range_check_unsigned3
+; CHECK-NEXT:%N = select i1 %c, i32 2, i32 3
+; CHECK-NEXT:--> %N U: [2,4) S: [2,4)
+; CHECK-NEXT:%N.off = add i32 %N, -1
+; CHECK-NEXT:--> (-1 + %N) U: [1,3) S: [1,3)
+; CHECK-NEXT:%iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
+; CHECK-NEXT:--> {0,+,1}<%loop> U: [0,3) S: [0,3) Exits: (-1 + 
%N) LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:%gep = getelementptr inbounds i16, i16* %pred, i32 %iv
+; CHECK-NEXT:--> {%pred,+,2}<%loop> U: full-set S: full-set Exits: 
((2 * (zext i32 (-1 + %N) to i64)) + %pred) LoopDispositions: { 
%loop: Computable }
+; CHECK-NEXT:%iv.next = add nuw nsw i32 %iv, 1
+; CHECK-NEXT:--> {1,+,1}<%loop> U: [1,4) S: [1,4) Exits: %N 
LoopDispositions: { %loop: Computable }
+; CHECK-NEXT:  Determining loop execution counts for: 
@optimized_range_check_unsigned3
+; CHECK-NEXT:  Loop %loop: backedge-taken count is (-1 + %N)
+; CHECK-NEXT:  Loop %loop: max backedge-taken count is 2
+; CHECK-NEXT:  Loop %loop: Predicated backedge-taken count is (-1 + %N)
+; CHECK-NEXT:   Predicates:
+; CHECK:   Loop %loop: Trip multiple is 1
+;
+entry:
+  %N = select i1 %c, i32 2, i32 3
+  %N.off = add i32 %N, -1
+  %cmp = icmp ult i32 %N.off, 7
+  br i1 %cmp, label %loop, label %exit
+
+loop:
+  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
+  %gep = getelementptr inbounds i16, i16* %pred, i32 %iv
+  store i16 0, i16* %gep, align 2
+  %iv.next = add nuw nsw i32 %iv, 1
+  %ec = icmp eq i32 %iv.next, %N
+  br i1 %ec, label %exit, label %loop
+
+exit:
+  ret void
+}
+
 ; Similar to @optimized_range_check_unsigned, but the initial compare checks
 ; against unsigned max (-1), which breaks the range check idiom.
 define void @not_optimized_range_check_unsigned1(i16* %pred, i32 %N) {



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libunwind] 09f6594 - libunwind: add missing break statements in EHABI

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

Author: Saleem Abdulrasool
Date: 2021-09-07T22:39:25-07:00
New Revision: 09f659449b8358fbc44b623caff7c99f9fcc995b

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

LOG: libunwind: add missing break statements in EHABI

Add missing break statements identified by static analysis tools.

Patch by Andrii Kurdiumov!

Reviewed By: compnerd, danielkiss

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

(cherry picked from commit 08a5ac36b956edeb989b4a65269a829eac26a5a2)

Added: 


Modified: 
libunwind/src/Unwind-EHABI.cpp

Removed: 




diff  --git a/libunwind/src/Unwind-EHABI.cpp b/libunwind/src/Unwind-EHABI.cpp
index 32b5cbc3be92..8843db7f54c3 100644
--- a/libunwind/src/Unwind-EHABI.cpp
+++ b/libunwind/src/Unwind-EHABI.cpp
@@ -97,9 +97,11 @@ _Unwind_Reason_Code ProcessDescriptors(
   case Descriptor::LU32:
 descriptor = getNextWord(descriptor, &length);
 descriptor = getNextWord(descriptor, &offset);
+break;
   case Descriptor::LU16:
 descriptor = getNextNibble(descriptor, &length);
 descriptor = getNextNibble(descriptor, &offset);
+break;
   default:
 assert(false);
 return _URC_FAILURE;



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] 427df19 - Update counter offset to account for binary ids

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

Author: Gulfem Savrun Yeniceri
Date: 2021-09-07T22:40:36-07:00
New Revision: 427df19c4791677a8e974bfeb8c09ab5b38bdbc3

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

LOG: Update counter offset to account for binary ids

In the raw profile, binary ids immediately follow the header so when
computing counters offset we need to account for the new section.

(cherry picked from commit 8111f2f7eef50f8c0cdfd4b575e275c0c4b7fc41)

Added: 


Modified: 
compiler-rt/lib/profile/InstrProfilingFile.c
compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c

Removed: 




diff  --git a/compiler-rt/lib/profile/InstrProfilingFile.c 
b/compiler-rt/lib/profile/InstrProfilingFile.c
index 32def21eec7f..2e91f16a2158 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -657,8 +657,9 @@ static void initializeProfileForContinuousMode(void) {
   const uint64_t *CountersBegin = __llvm_profile_begin_counters();
   const uint64_t *CountersEnd = __llvm_profile_end_counters();
   uint64_t DataSize = __llvm_profile_get_data_size(DataBegin, DataEnd);
-  const uint64_t CountersOffset =
-  sizeof(__llvm_profile_header) + (DataSize * sizeof(__llvm_profile_data));
+  const uint64_t CountersOffset = sizeof(__llvm_profile_header) +
+  __llvm_write_binary_ids(NULL) +
+  (DataSize * sizeof(__llvm_profile_data));
 
   int Length = getCurFilenameLength();
   char *FilenameBuf = (char *)COMPILER_RT_ALLOCA(Length + 1);

diff  --git a/compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c 
b/compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
index 0146b14c193f..1be0ef36a288 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
@@ -119,8 +119,9 @@ void __llvm_profile_initialize(void) {
   const uint64_t *CountersBegin = __llvm_profile_begin_counters();
   const uint64_t *CountersEnd = __llvm_profile_end_counters();
   const uint64_t DataSize = __llvm_profile_get_data_size(DataBegin, DataEnd);
-  const uint64_t CountersOffset =
-  sizeof(__llvm_profile_header) + (DataSize * sizeof(__llvm_profile_data));
+  const uint64_t CountersOffset = sizeof(__llvm_profile_header) +
+  __llvm_write_binary_ids(NULL) +
+  (DataSize * sizeof(__llvm_profile_data));
   uint64_t CountersSize = CountersEnd - CountersBegin;
 
   /* Don't publish a VMO if there are no counters. */



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits