[llvm-branch-commits] [llvm] 92f6036 - Revert "[AMDGPU] Add AMDGPU-specific module splitting (#89245)"

2024-05-23 Thread via llvm-branch-commits

Author: Vitaly Buka
Date: 2024-05-23T23:44:21-07:00
New Revision: 92f6036dfea9e64b141dcba8f8329ab17e53c3a5

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

LOG: Revert "[AMDGPU] Add AMDGPU-specific module splitting (#89245)"

This reverts commit d7c37130008374341e79c355ad85cc48942136ff.

Added: 


Modified: 
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h
llvm/lib/Target/AMDGPU/CMakeLists.txt

Removed: 
llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
llvm/lib/Target/AMDGPU/AMDGPUSplitModule.h
llvm/test/tools/llvm-split/AMDGPU/address-taken-externalize-with-call.ll
llvm/test/tools/llvm-split/AMDGPU/address-taken-externalize.ll
llvm/test/tools/llvm-split/AMDGPU/debug-name-hiding.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-alias-dependencies.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-cost-ranking.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-dependencies.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-dependency-duplication.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-dependency-external.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-dependency-indirect.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-dependency-overridable.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-global-variables-noexternal.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-global-variables.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-load-balancing.ll
llvm/test/tools/llvm-split/AMDGPU/kernels-no-dependencies.ll
llvm/test/tools/llvm-split/AMDGPU/large-kernels-merging.ll
llvm/test/tools/llvm-split/AMDGPU/lit.local.cfg



diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp 
b/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
deleted file mode 100644
index 56e275ce707b6..0
--- a/llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
+++ /dev/null
@@ -1,744 +0,0 @@
-//===- AMDGPUSplitModule.cpp 
--===//
-//
-// 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
-//
-//===--===//
-//
-/// \file Implements a module splitting algorithm designed to support the
-/// FullLTO --lto-partitions option for parallel codegen. This is completely
-/// 
diff erent from the common SplitModule pass, as this system is designed with
-/// AMDGPU in mind.
-///
-/// The basic idea of this module splitting implementation is the same as
-/// SplitModule: load-balance the module's functions across a set of N
-/// partitions to allow parallel codegen. However, it does it very
-/// 
diff erently than the target-agnostic variant:
-///   - Kernels are used as the module's "roots".
-/// They're known entry points on AMDGPU, and everything else is often
-/// internal only.
-///   - Each kernel has a set of dependencies, and when a kernel and its
-/// dependencies is considered "big", we try to put it in a partition where
-/// most dependencies are already imported, to avoid duplicating large
-/// amounts of code.
-///   - There's special care for indirect calls in order to ensure
-/// AMDGPUResourceUsageAnalysis can work correctly.
-///
-/// This file also includes a more elaborate logging system to enable
-/// users to easily generate logs that (if desired) do not include any value
-/// names, in order to not leak information about the source file.
-/// Such logs are very helpful to understand and fix potential issues with
-/// module splitting.
-
-#include "AMDGPUSplitModule.h"
-#include "AMDGPUTargetMachine.h"
-#include "Utils/AMDGPUBaseInfo.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Analysis/CallGraph.h"
-#include "llvm/Analysis/TargetTransformInfo.h"
-#include "llvm/IR/Function.h"
-#include "llvm/IR/Instruction.h"
-#include "llvm/IR/Module.h"
-#include "llvm/IR/User.h"
-#include "llvm/IR/Value.h"
-#include "llvm/Support/Casting.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Path.h"
-#include "llvm/Support/Process.h"
-#include "llvm/Support/SHA256.h"
-#include "llvm/Support/Threading.h"
-#include "llvm/Support/raw_ostream.h"
-#include "llvm/Transforms/Utils/Cloning.h"
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-using namespace llvm;
-
-#define DEBUG_TYPE "amdgpu-split-module"
-
-namespace {
-
-static cl::opt LargeKernelFactor(
-"amdgpu-module-splitting-large-kernel-threshold", cl::init(2.0f),
-cl::Hidden,
-cl::desc(
-"consider a kernel as large and

[llvm-branch-commits] [llvm] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-23 Thread Ahmed Bougacha via llvm-branch-commits

https://github.com/ahmedbougacha edited 
https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-23 Thread Ahmed Bougacha via llvm-branch-commits

ahmedbougacha wrote:

Thanks for taking a look;  updated

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-23 Thread Ahmed Bougacha via llvm-branch-commits


@@ -8640,6 +8642,15 @@ void SelectionDAGBuilder::LowerCallTo(const CallBase 
&CB, SDValue Callee,
   CB.countOperandBundlesOfType(LLVMContext::OB_preallocated) != 0)
   .setCFIType(CFIType)
   .setConvergenceControlToken(ConvControlToken);
+
+  // Set the pointer authentication info if we have it.
+  if (PAI) {
+if (!TLI.supportPtrAuthBundles())
+  report_fatal_error(

ahmedbougacha wrote:

I don't think testing this one is reasonable;  we couldn't even put it in 
AArch64 and would have to pollute another innocent backend

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-23 Thread Ahmed Bougacha via llvm-branch-commits


@@ -0,0 +1,183 @@
+; RUN: llc -mtriple arm64e-apple-darwin -o - -global-isel -global-isel-abort=1 
-verify-machineinstrs %s | FileCheck %s --check-prefixes=CHECK

ahmedbougacha wrote:

It's not standard practice to test other platforms, but sure, I added ELF 
checks.  Now you folks owe me darwin tests for future PAC changes you make ;)

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-23 Thread Ahmed Bougacha via llvm-branch-commits

https://github.com/ahmedbougacha edited 
https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-23 Thread Ahmed Bougacha via llvm-branch-commits

https://github.com/ahmedbougacha edited 
https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-23 Thread Ahmed Bougacha via llvm-branch-commits


@@ -1694,6 +1718,35 @@ let Predicates = [HasPAuth] in {
 def BLRABZ  : AuthOneOperand<0b001, 1, "blrabz">;
   }
 
+  // BLRA pseudo, generalized version of BLRAA/BLRAB/Z.
+  // This directly manipulates x16/x17, which are the only registers the OS
+  // guarantees are safe to use for sensitive operations.

ahmedbougacha wrote:

Unfortunately this sort of thing isn't documented.  We do describe the general 
contract in the security model sections of the clang docs.
For ELF it might make sense to have a formalization in the PAuth ABI, but that 
would have to be actually honored in an OS;  I imagine it currently isn't 
anywhere other than Darwin.

https://github.com/llvm/llvm-project/pull/85736
___
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] [AArch64][PAC] Lower authenticated calls with ptrauth bundles. (PR #85736)

2024-05-23 Thread Ahmed Bougacha via llvm-branch-commits

https://github.com/ahmedbougacha updated 
https://github.com/llvm/llvm-project/pull/85736

>From 75825f36ec58a2cf5d1a3f2d4de6a49ad06c02d8 Mon Sep 17 00:00:00 2001
From: Ahmed Bougacha 
Date: Mon, 27 Sep 2021 08:00:00 -0700
Subject: [PATCH 1/3] [AArch64] Adopt x8+ allocation order for GPR64noip.

73078ecd381 added GPR64noip for hwasan pseudos.
Give it an allocation order that prefers allocating from x8 and up,
to match GPR64: this allows for easier regalloc, as x0-x7 are
likely to be used for parameter passing.
---
 llvm/lib/Target/AArch64/AArch64RegisterInfo.td | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AArch64/AArch64RegisterInfo.td 
b/llvm/lib/Target/AArch64/AArch64RegisterInfo.td
index 80d0f9c57f4b3..dfaa67dd1959d 100644
--- a/llvm/lib/Target/AArch64/AArch64RegisterInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64RegisterInfo.td
@@ -234,7 +234,10 @@ def tcGPRnotx16 : RegisterClass<"AArch64", [i64], 64, (sub 
tcGPR64, X16)>;
 // Register set that excludes registers that are reserved for procedure calls.
 // This is used for pseudo-instructions that are actually implemented using a
 // procedure call.
-def GPR64noip : RegisterClass<"AArch64", [i64], 64, (sub GPR64, X16, X17, LR)>;
+def GPR64noip : RegisterClass<"AArch64", [i64], 64, (sub GPR64, X16, X17, LR)> 
{
+  let AltOrders = [(rotl GPR64noip, 8)];
+  let AltOrderSelect = [{ return 1; }];
+}
 
 // GPR register classes for post increment amount of vector load/store that
 // has alternate printing when Rm=31 and prints a constant immediate value

>From 536ab53e4a300841db5850efaf0ecc5b29733e6d Mon Sep 17 00:00:00 2001
From: Ahmed Bougacha 
Date: Wed, 24 Jan 2024 15:03:49 -0800
Subject: [PATCH 2/3] [AArch64][PAC] Lower authenticated calls with ptrauth
 bundles.

This adds codegen support for the "ptrauth" operand bundles, which can
be used to augment indirect calls with the equivalent of an
`@llvm.ptrauth.auth` intrinsic call on the call target (possibly
preceded by an `@llvm.ptrauth.blend` on the auth discriminator if
applicable.)

This allows the generation of combined authenticating calls
on AArch64 (in the BLRA* PAuth instructions), while avoiding
the raw just-authenticated function pointer from being
exposed to attackers.

This is done by threading a PtrAuthInfo descriptor through
the call lowering infrastructure.

Note that this also applies to the other forms of indirect calls,
notably invokes, rvmarker, and tail calls.  Tail-calls in particular
bring some additional complexity, with the intersecting register
constraints of BTI and PAC discriminator computation.
---
 .../llvm/CodeGen/GlobalISel/CallLowering.h|   8 +
 llvm/include/llvm/CodeGen/TargetLowering.h|  18 ++
 llvm/lib/CodeGen/GlobalISel/CallLowering.cpp  |   2 +
 llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp  |  16 +-
 .../SelectionDAG/SelectionDAGBuilder.cpp  |  51 -
 .../SelectionDAG/SelectionDAGBuilder.h|   6 +-
 llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp |  90 
 .../AArch64/AArch64ExpandPseudoInsts.cpp  |  43 +++-
 .../Target/AArch64/AArch64ISelLowering.cpp| 103 ++---
 llvm/lib/Target/AArch64/AArch64ISelLowering.h |  12 ++
 llvm/lib/Target/AArch64/AArch64InstrInfo.cpp  |   2 +
 llvm/lib/Target/AArch64/AArch64InstrInfo.td   |  80 +++
 .../AArch64/GISel/AArch64CallLowering.cpp |  88 ++--
 .../AArch64/GISel/AArch64GlobalISelUtils.cpp  |   2 +-
 .../AArch64/GlobalISel/ptrauth-invoke.ll  | 183 
 ...ranch-target-enforcement-indirect-calls.ll |   4 +-
 llvm/test/CodeGen/AArch64/ptrauth-bti-call.ll | 105 ++
 .../CodeGen/AArch64/ptrauth-call-rv-marker.ll | 154 ++
 llvm/test/CodeGen/AArch64/ptrauth-call.ll | 195 ++
 llvm/test/CodeGen/AArch64/ptrauth-invoke.ll   | 189 +
 20 files changed, 1292 insertions(+), 59 deletions(-)
 create mode 100644 llvm/test/CodeGen/AArch64/GlobalISel/ptrauth-invoke.ll
 create mode 100644 llvm/test/CodeGen/AArch64/ptrauth-bti-call.ll
 create mode 100644 llvm/test/CodeGen/AArch64/ptrauth-call-rv-marker.ll
 create mode 100644 llvm/test/CodeGen/AArch64/ptrauth-call.ll
 create mode 100644 llvm/test/CodeGen/AArch64/ptrauth-invoke.ll

diff --git a/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h 
b/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
index 4c187a3068d82..fb298898304eb 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
@@ -99,6 +99,11 @@ class CallLowering {
 ArgInfo() = default;
   };
 
+  struct PointerAuthInfo {
+Register Discriminator;
+uint64_t Key;
+  };
+
   struct CallLoweringInfo {
 /// Calling convention to be used for the call.
 CallingConv::ID CallConv = CallingConv::C;
@@ -125,6 +130,8 @@ class CallLowering {
 
 MDNode *KnownCallees = nullptr;
 
+std::optional PAI;
+
 /// True if the call must be tail call optimized.
 bool IsMustTailCall = false;
 
@@ -587,6 +594,

[llvm-branch-commits] [clang] [clang] add fallback to expr in the template differ when comparing ValueDecl (PR #93266)

2024-05-23 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Matheus Izvekov (mizvekov)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/93266.diff


3 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (+1) 
- (modified) clang/lib/AST/ASTDiagnostic.cpp (+5) 
- (modified) clang/test/Misc/diag-template-diffing-cxx26.cpp (+2-2) 


``diff
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 6e8687fadc6f7..5e217a76c81a1 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -784,6 +784,7 @@ Miscellaneous Bug Fixes
 - Fixed an infinite recursion in ASTImporter, on return type declared inside
   body of C++11 lambda without trailing return (#GH68775).
 - Fixed declaration name source location of instantiated function definitions 
(GH71161).
+- Missing fallback to expression in the template differ when comparing 
ValueDecls.
 
 Miscellaneous Clang Crashes Fixed
 ^
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 7e4a5709a44ce..1885b21178666 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -1936,6 +1936,11 @@ class TemplateDiff {
   return;
 }
 
+if (E) {
+  PrintExpr(E);
+  return;
+}
+
 OS << "(no argument)";
   }
 
diff --git a/clang/test/Misc/diag-template-diffing-cxx26.cpp 
b/clang/test/Misc/diag-template-diffing-cxx26.cpp
index cc174d6c334fb..2b6dd86a9885d 100644
--- a/clang/test/Misc/diag-template-diffing-cxx26.cpp
+++ b/clang/test/Misc/diag-template-diffing-cxx26.cpp
@@ -19,10 +19,10 @@ namespace GH93068 {
 // expected-note@#A {{no known conversion from 'A<0>' to 'const A<&n[1]> 
&' for 1st argument}}
 // expected-note@#A {{no known conversion from 'A<0>' to 'A<&n[1]> &&' for 
1st argument}}
 
-// notree-error@#2 {{no viable conversion from 'A' to 'A<(no 
argument)>'}}
+// notree-error@#2 {{no viable conversion from 'A' to 'A'}}
 /* tree-error@#2 {{no viable conversion
   A<
-[n != (no argument)]>}}*/
+[n != n + 1]>}}*/
 
 A v2 = A(); // #2
 // expected-note@#A {{no known conversion from 'A' to 'const A<&n[1]> 
&' for 1st argument}}

``




https://github.com/llvm/llvm-project/pull/93266
___
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] [clang] add fallback to expr in the template differ when comparing ValueDecl (PR #93266)

2024-05-23 Thread Matheus Izvekov via llvm-branch-commits

https://github.com/mizvekov created 
https://github.com/llvm/llvm-project/pull/93266

None

>From e74a7e69381731465efb8332890e0ebdc061fbb1 Mon Sep 17 00:00:00 2001
From: Matheus Izvekov 
Date: Thu, 23 May 2024 23:57:01 -0300
Subject: [PATCH] [clang] add fallback to expr in the template differ when
 comparing ValueDecl

---
 clang/docs/ReleaseNotes.rst | 1 +
 clang/lib/AST/ASTDiagnostic.cpp | 5 +
 clang/test/Misc/diag-template-diffing-cxx26.cpp | 4 ++--
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 6e8687fadc6f7..5e217a76c81a1 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -784,6 +784,7 @@ Miscellaneous Bug Fixes
 - Fixed an infinite recursion in ASTImporter, on return type declared inside
   body of C++11 lambda without trailing return (#GH68775).
 - Fixed declaration name source location of instantiated function definitions 
(GH71161).
+- Missing fallback to expression in the template differ when comparing 
ValueDecls.
 
 Miscellaneous Clang Crashes Fixed
 ^
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 7e4a5709a44ce..1885b21178666 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/lib/AST/ASTDiagnostic.cpp
@@ -1936,6 +1936,11 @@ class TemplateDiff {
   return;
 }
 
+if (E) {
+  PrintExpr(E);
+  return;
+}
+
 OS << "(no argument)";
   }
 
diff --git a/clang/test/Misc/diag-template-diffing-cxx26.cpp 
b/clang/test/Misc/diag-template-diffing-cxx26.cpp
index cc174d6c334fb..2b6dd86a9885d 100644
--- a/clang/test/Misc/diag-template-diffing-cxx26.cpp
+++ b/clang/test/Misc/diag-template-diffing-cxx26.cpp
@@ -19,10 +19,10 @@ namespace GH93068 {
 // expected-note@#A {{no known conversion from 'A<0>' to 'const A<&n[1]> 
&' for 1st argument}}
 // expected-note@#A {{no known conversion from 'A<0>' to 'A<&n[1]> &&' for 
1st argument}}
 
-// notree-error@#2 {{no viable conversion from 'A' to 'A<(no 
argument)>'}}
+// notree-error@#2 {{no viable conversion from 'A' to 'A'}}
 /* tree-error@#2 {{no viable conversion
   A<
-[n != (no argument)]>}}*/
+[n != n + 1]>}}*/
 
 A v2 = A(); // #2
 // expected-note@#A {{no known conversion from 'A' to 'const A<&n[1]> 
&' for 1st argument}}

___
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] 8871ef5 - Revert "[clang] Implement CWG2398 provisional TTP matching to class templates…"

2024-05-23 Thread via llvm-branch-commits

Author: Matheus Izvekov
Date: 2024-05-23T21:30:43-03:00
New Revision: 8871ef58ece10234b8cd97c5e7199dee7d7a8b08

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

LOG: Revert "[clang] Implement CWG2398 provisional TTP matching to class 
templates…"

This reverts commit ff3f41deb04c03ba57658776e4e0dc26ef01187d.

Added: 


Modified: 
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateDeduction.cpp
clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp
clang/test/SemaTemplate/cwg2398.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 268f079980a6c..39e9dbed0c3e0 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -1807,8 +1807,6 @@ static void SetNestedNameSpecifier(Sema &S, TagDecl *T,
 // Returns the template parameter list with all default template argument
 // information.
 static TemplateParameterList *GetTemplateParameterList(TemplateDecl *TD) {
-  if (TD->isImplicit())
-return TD->getTemplateParameters();
   // Make sure we get the template parameter list from the most
   // recent declaration, since that is the only one that is guaranteed to
   // have all the default template argument information.
@@ -1829,8 +1827,7 @@ static TemplateParameterList 
*GetTemplateParameterList(TemplateDecl *TD) {
   //template  friend struct C;
   //  };
   //  template struct S;
-  while ((D->isImplicit() ||
-  D->getFriendObjectKind() != Decl::FriendObjectKind::FOK_None) &&
+  while (D->getFriendObjectKind() != Decl::FriendObjectKind::FOK_None &&
  D->getPreviousDecl())
 D = D->getPreviousDecl();
   return cast(D)->getTemplateParameters();

diff  --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 08a69d3cb2589..f9ec34163e656 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -527,8 +527,8 @@ static NamedDecl *getTemplateParameterWithDefault(Sema &S, 
NamedDecl *A,
 R->setDefaultArgument(
 S.Context,
 S.getTrivialTemplateArgumentLoc(Default, QualType(), 
SourceLocation()));
-if (T->hasTypeConstraint()) {
-  auto *C = T->getTypeConstraint();
+if (R->hasTypeConstraint()) {
+  auto *C = R->getTypeConstraint();
   R->setTypeConstraint(C->getConceptReference(),
C->getImmediatelyDeclaredConstraint());
 }
@@ -583,53 +583,37 @@ DeduceTemplateArguments(Sema &S, TemplateParameterList 
*TemplateParams,
   return TemplateDeductionResult::Success;
 
 auto NewDeduced = DeducedTemplateArgument(Arg);
-// Provisional resolution for CWG2398: If Arg names a template
-// specialization, then we deduce a synthesized template template parameter
-// based on A, but using the TS's arguments as defaults.
-if (DefaultArguments.size() != 0) {
+// Provisional resolution for CWG2398: If Arg is also a template template
+// param, and it names a template specialization, then we deduce a
+// synthesized template template parameter based on A, but using the TS's
+// arguments as defaults.
+if (auto *TempArg = dyn_cast_or_null(
+Arg.getAsTemplateDecl())) {
   assert(Arg.getKind() == TemplateName::Template);
-  TemplateDecl *TempArg = Arg.getAsTemplateDecl();
+  assert(!TempArg->isExpandedParameterPack());
+
   TemplateParameterList *As = TempArg->getTemplateParameters();
-  assert(DefaultArguments.size() <= As->size());
-
-  SmallVector Params(As->size());
-  for (unsigned I = 0; I < DefaultArguments.size(); ++I)
-Params[I] = getTemplateParameterWithDefault(S, As->getParam(I),
-DefaultArguments[I]);
-  for (unsigned I = DefaultArguments.size(); I < As->size(); ++I)
-Params[I] = As->getParam(I);
-  // FIXME: We could unique these, and also the parameters, but we don't
-  // expect programs to contain a large enough amount of these deductions
-  // for that to be worthwhile.
-  auto *TPL = TemplateParameterList::Create(
-  S.Context, SourceLocation(), SourceLocation(), Params,
-  SourceLocation(), As->getRequiresClause());
-
-  TemplateDecl *TD;
-  switch (TempArg->getKind()) {
-  case Decl::TemplateTemplateParm: {
-auto *A = cast(TempArg);
-assert(!A->isExpandedParameterPack());
-TD = TemplateTemplateParmDecl::Create(
-S.Context, A->getDeclContext(), SourceLocation(), A->getDepth(),
-A->getPosition(), A->isParameterPack(), A->getIdentifier(),
-A->wasDeclaredWithTypename(), TPL);
-break;
-  }
-  case Decl::ClassTemplate: {
-auto *A = cast(TempArg);
-  

[llvm-branch-commits] [clang] 1786075 - Revert "[SME] Add intrinsics for FCVT(wid.) and FCVTL (#90215)"

2024-05-23 Thread via llvm-branch-commits

Author: Lukacma
Date: 2024-05-23T15:13:01+01:00
New Revision: 1786075d2a347465e518cfaa04a40cb75eb75828

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

LOG: Revert "[SME] Add intrinsics for FCVT(wid.) and FCVTL (#90215)"

This reverts commit 05c154f2bcba34f002b1f0c22c7a9e9614e9d83c.

Added: 


Modified: 
clang/include/clang/Basic/arm_sve.td
clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvt.c
llvm/include/llvm/IR/IntrinsicsAArch64.td
llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
llvm/test/CodeGen/AArch64/sme2-intrinsics-cvt.ll

Removed: 
clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvtl.c
llvm/test/CodeGen/AArch64/sme2-intrinsics-cvtl.ll



diff  --git a/clang/include/clang/Basic/arm_sve.td 
b/clang/include/clang/Basic/arm_sve.td
index 4f28547998550..03570f94de666 100644
--- a/clang/include/clang/Basic/arm_sve.td
+++ b/clang/include/clang/Basic/arm_sve.td
@@ -2265,10 +2265,6 @@ let TargetGuard = "sme2" in {
   def SVCVT_S32_F32_X4 : SInst<"svcvt_{d}[_f32_x4]", "4.d4.M", "i",  
MergeNone, "aarch64_sve_fcvtzs_x4", [IsStreaming, 
IsOverloadWhileOrMultiVecCvt], []>;
 }
 
-let TargetGuard = "sme-f16f16" in {
-  def SVCVT_F32_X2 : SInst<"svcvt_{d}[_f16_x2]", "2h", "f", MergeNone, 
"aarch64_sve_fcvt_widen_x2", [ IsStreaming],[]>;
-}
-
 //
 // Multi-vector floating-point convert from single-precision to interleaved 
half-precision/BFloat16
 //
@@ -2277,13 +2273,6 @@ let TargetGuard = "sme2" in {
   def SVCVTN_BF16_X2 : SInst<"svcvtn_bf16[_f32_x2]", "$2", "f", MergeNone, 
"aarch64_sve_bfcvtn_x2", [IsOverloadNone, IsStreaming],[]>;
 }
 
-//
-//Multi-vector floating-point convert from half-precision to deinterleaved 
single-precision.
-//
-let TargetGuard = "sme-f16f16" in {
-  def SVCVTL_F32_X2 : SInst<"svcvtl_f32[_f16_x2]", "2h", "f", MergeNone, 
"aarch64_sve_fcvtl_widen_x2", [ IsStreaming],[]>;
-}
-
 //
 // Multi-vector saturating extract narrow
 //

diff  --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvt.c 
b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvt.c
index e26499d3a63cc..4a5ee7e021f74 100644
--- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvt.c
+++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvt.c
@@ -497,25 +497,3 @@ svuint8_t test_qcvt_u8_s32_x4(svint32x4_t zn) 
__arm_streaming {
 svuint16_t test_qcvt_u16_s64_x4(svint64x4_t zn) __arm_streaming {
   return SVE_ACLE_FUNC(svqcvt_u16,_s64_x4,,)(zn);
 }
-
-// CHECK-LABEL: @test_cvt_f32_x2(
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:[[TMP0:%.*]] = tail call { ,  } @llvm.aarch64.sve.fcvt.widen.x2.nxv4f32( 
[[ZN:%.*]])
-// CHECK-NEXT:[[TMP1:%.*]] = extractvalue { ,  } [[TMP0]], 0
-// CHECK-NEXT:[[TMP2:%.*]] = tail call  
@llvm.vector.insert.nxv8f32.nxv4f32( poison,  [[TMP1]], i64 0)
-// CHECK-NEXT:[[TMP3:%.*]] = extractvalue { ,  } [[TMP0]], 1
-// CHECK-NEXT:[[TMP4:%.*]] = tail call  
@llvm.vector.insert.nxv8f32.nxv4f32( [[TMP2]],  [[TMP3]], i64 4)
-// CHECK-NEXT:ret  [[TMP4]]
-//
-// CPP-CHECK-LABEL: @_Z15test_cvt_f32_x2u13__SVFloat16_t(
-// CPP-CHECK-NEXT:  entry:
-// CPP-CHECK-NEXT:[[TMP0:%.*]] = tail call { ,  } @llvm.aarch64.sve.fcvt.widen.x2.nxv4f32( 
[[ZN:%.*]])
-// CPP-CHECK-NEXT:[[TMP1:%.*]] = extractvalue { , 
 } [[TMP0]], 0
-// CPP-CHECK-NEXT:[[TMP2:%.*]] = tail call  
@llvm.vector.insert.nxv8f32.nxv4f32( poison,  [[TMP1]], i64 0)
-// CPP-CHECK-NEXT:[[TMP3:%.*]] = extractvalue { , 
 } [[TMP0]], 1
-// CPP-CHECK-NEXT:[[TMP4:%.*]] = tail call  
@llvm.vector.insert.nxv8f32.nxv4f32( [[TMP2]],  [[TMP3]], i64 4)
-// CPP-CHECK-NEXT:ret  [[TMP4]]
-//
-__attribute__((target("sme-f16f16"))) svfloat32x2_t 
test_cvt_f32_x2(svfloat16_t zn)  __arm_streaming {
-  return SVE_ACLE_FUNC(svcvt_f32,_f16_x2,,)(zn);
-}

diff  --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvtl.c 
b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvtl.c
deleted file mode 100644
index 1142065614b8f..0
--- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_cvtl.c
+++ /dev/null
@@ -1,40 +0,0 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-
-// REQUIRES: aarch64-registered-target
-
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +sme-f16f16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o 
- %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme 
-target-feature +sme-f16f16 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o 
- -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s 
-check-prefix=CPP-CHECK
-// RUN: %clang_cc1 -D__SVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu 
-target-feature +sme -target-feature +sme-f16f16 -S -disa

[llvm-branch-commits] [clang] 8c86a4b - Revert "[AArch64][SME] Add intrinsics for vector groups ZERO (#88114)"

2024-05-23 Thread via llvm-branch-commits

Author: Lukacma
Date: 2024-05-23T15:12:27+01:00
New Revision: 8c86a4b19b8c6d7ed5dcb31709bd518383130174

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

LOG: Revert "[AArch64][SME] Add intrinsics for vector groups ZERO (#88114)"

This reverts commit 7a1022a3895f51a3c11dd326c47d861575ffaf55.

Added: 


Modified: 
clang/include/clang/Basic/arm_sme.td
llvm/include/llvm/IR/IntrinsicsAArch64.td
llvm/lib/Target/AArch64/SMEInstrFormats.td

Removed: 
clang/test/CodeGen/aarch64-sme2p1-intrinsics/acle_sme2p1_zero.c
llvm/test/CodeGen/AArch64/sme2p1-intrinsics-zero.ll



diff  --git a/clang/include/clang/Basic/arm_sme.td 
b/clang/include/clang/Basic/arm_sme.td
index 564a58e4eb670..80e635e4a57ec 100644
--- a/clang/include/clang/Basic/arm_sme.td
+++ b/clang/include/clang/Basic/arm_sme.td
@@ -146,25 +146,6 @@ let TargetGuard = "sme" in {
  [IsOverloadNone, IsStreamingCompatible, IsOutZA]>;
 }
 
-let TargetGuard = "sme2p1" in {
-  def SVZERO_ZA64_VG1x2 : SInst<"svzero_za64_vg1x2", "vm", "", MergeNone, 
"aarch64_sme_zero_za64_vg1x2",
-[IsOverloadNone, IsStreaming, IsInOutZA]>;
-  def SVZERO_ZA64_VG1x4 : SInst<"svzero_za64_vg1x4", "vm", "", MergeNone, 
"aarch64_sme_zero_za64_vg1x4",
-[IsOverloadNone, IsStreaming, IsInOutZA]>;
-  def SVZERO_ZA64_VG2x1 : SInst<"svzero_za64_vg2x1", "vm", "", MergeNone, 
"aarch64_sme_zero_za64_vg2x1",
-[IsOverloadNone, IsStreaming, IsInOutZA]>;
-  def SVZERO_ZA64_VG2x2 : SInst<"svzero_za64_vg2x2", "vm", "", MergeNone, 
"aarch64_sme_zero_za64_vg2x2",
-[IsOverloadNone, IsStreaming, IsInOutZA]>;
-  def SVZERO_ZA64_VG2x4 : SInst<"svzero_za64_vg2x4", "vm", "", MergeNone, 
"aarch64_sme_zero_za64_vg2x4",
-[IsOverloadNone, IsStreaming, IsInOutZA]>;
-  def SVZERO_ZA64_VG4x1 : SInst<"svzero_za64_vg4x1", "vm", "", MergeNone, 
"aarch64_sme_zero_za64_vg4x1",
-[IsOverloadNone, IsStreaming, IsInOutZA]>;
-  def SVZERO_ZA64_VG4x2 : SInst<"svzero_za64_vg4x2", "vm", "", MergeNone, 
"aarch64_sme_zero_za64_vg4x2",
-[IsOverloadNone, IsStreaming, IsInOutZA]>;
-  def SVZERO_ZA64_VG4x4 : SInst<"svzero_za64_vg4x4", "vm", "", MergeNone, 
"aarch64_sme_zero_za64_vg4x4",
-[IsOverloadNone, IsStreaming, IsInOutZA]>;
-}
-
 

 // SME - Counting elements in a streaming vector
 

diff  --git a/clang/test/CodeGen/aarch64-sme2p1-intrinsics/acle_sme2p1_zero.c 
b/clang/test/CodeGen/aarch64-sme2p1-intrinsics/acle_sme2p1_zero.c
deleted file mode 100644
index bdd7579855414..0
--- a/clang/test/CodeGen/aarch64-sme2p1-intrinsics/acle_sme2p1_zero.c
+++ /dev/null
@@ -1,139 +0,0 @@
-// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py 
UTC_ARGS: --version 4
-// REQUIRES: aarch64-registered-target
-
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2p1 -S 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2p1 -S 
-disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p 
mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2p1 -S 
-disable-O0-optnone -Werror -Wall -o /dev/null %s
-
-#include 
-
-#define SVE_ACLE_FUNC(A1,A2) A1##A2
-
-// CHECK-LABEL: define dso_local void @test_svzero_za64_vg1x2(
-// CHECK-SAME: i32 noundef [[SLICE:%.*]]) #[[ATTR0:[0-9]+]] {
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:tail call void @llvm.aarch64.sme.zero.za64.vg1x2(i32 
[[SLICE]])
-// CHECK-NEXT:ret void
-//
-// CPP-CHECK-LABEL: define dso_local void @_Z22test_svzero_za64_vg1x2j(
-// CPP-CHECK-SAME: i32 noundef [[SLICE:%.*]]) #[[ATTR0:[0-9]+]] {
-// CPP-CHECK-NEXT:  entry:
-// CPP-CHECK-NEXT:tail call void @llvm.aarch64.sme.zero.za64.vg1x2(i32 
[[SLICE]])
-// CPP-CHECK-NEXT:ret void
-//
-void test_svzero_za64_vg1x2(uint32_t slice) __arm_streaming __arm_inout("za")
-{
-   SVE_ACLE_FUNC(svzero_za64,_vg1x2)(slice);
-}
-
-// CHECK-LABEL: define dso_local void @test_svzero_za64_vg1x4(
-// CHECK-SAME: i32 noundef [[SLICE:%.*]]) #[[ATTR0]] {
-// CHECK-NEXT:  entry:
-// CHECK-NEXT:tail call void @llvm.aarch64.sme.zero.za64.vg1x4(i32 
[[SLICE]])
-// CHECK-NEXT:ret void
-//
-// CPP-CHECK-LABEL: define dso_local void @_Z22test_svzero_za64_vg1x4j(
-// CPP-CHECK-SAME: i32 noundef [[SLICE:%.*]]) #[[ATTR0]] {
-// CPP-CHECK-NEXT:  entry:
-// CPP-CHECK-NEXT:tail call void @llvm.aarch64.sme.zero.za

[llvm-branch-commits] [llvm] [openmp] [openmp] Revise IDE folder structure (PR #89750)

2024-05-23 Thread Michael Kruse via llvm-branch-commits


@@ -292,6 +294,7 @@ if(WIN32)
   set(LIBOMP_IMP_LIB_TARGET omp)
   set(LIBOMP_GENERATED_DEF_FILE ${LIBOMP_LIB_NAME}.def)
   add_custom_target(libomp-needed-def-file DEPENDS 
${LIBOMP_GENERATED_DEF_FILE})
+  set_target_properties(libomp-needed-def-file PROPERTIES FOLDER 
"OpenMP/Codegenning")

Meinersbur wrote:

For LLVM/Clang/MLIR the folder is already named 
["Tablegenning"](https://github.com/llvm/llvm-project/blob/31f1590e4fb324c43dc36199587c453e27b6f6fa/llvm/cmake/modules/TableGen.cmake#L170)
 since forever. Since tablegen is not involved here, I found "Codegenning" more 
appropriate.

https://github.com/llvm/llvm-project/pull/89750
___
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] [openmp] [openmp] Revise IDE folder structure (PR #89750)

2024-05-23 Thread Michael Kruse via llvm-branch-commits

https://github.com/Meinersbur edited 
https://github.com/llvm/llvm-project/pull/89750
___
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] [lldb] 788e65c - Revert "[lldb] Make use of Scripted{Python,}Interface for ScriptedThreadPlan …"

2024-05-23 Thread via llvm-branch-commits

Author: Med Ismail Bennani
Date: 2024-05-23T01:45:18-07:00
New Revision: 788e65c8171e233d399f3f1df645d6f9fb8f66bc

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

LOG: Revert "[lldb] Make use of Scripted{Python,}Interface for 
ScriptedThreadPlan …"

This reverts commit 4cc6d0f4dfb26deb9863901c70258d6d7f0c8ba4.

Added: 


Modified: 
lldb/bindings/python/python-swigsafecast.swig
lldb/bindings/python/python-wrapper.swig
lldb/include/lldb/API/SBEvent.h
lldb/include/lldb/API/SBStream.h
lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h
lldb/include/lldb/Interpreter/ScriptInterpreter.h
lldb/include/lldb/Target/ThreadPlanPython.h
lldb/include/lldb/lldb-forward.h
lldb/source/Interpreter/ScriptInterpreter.cpp
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/CMakeLists.txt

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPlatformPythonInterface.cpp

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.h

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPythonInterface.cpp
lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
lldb/source/Target/ThreadPlanPython.cpp
lldb/test/API/functionalities/step_scripted/Steps.py
lldb/test/API/functionalities/thread_plan/wrap_step_over.py
lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

Removed: 
lldb/include/lldb/Interpreter/Interfaces/ScriptedThreadPlanInterface.h

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.cpp

lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedThreadPlanPythonInterface.h



diff  --git a/lldb/bindings/python/python-swigsafecast.swig 
b/lldb/bindings/python/python-swigsafecast.swig
index 34f8c6f0ff8d3..d5ea514872713 100644
--- a/lldb/bindings/python/python-swigsafecast.swig
+++ b/lldb/bindings/python/python-swigsafecast.swig
@@ -37,6 +37,10 @@ PythonObject SWIGBridge::ToSWIGWrapper(const Status& status) 
{
   return ToSWIGHelper(new lldb::SBError(status), SWIGTYPE_p_lldb__SBError);
 }
 
+PythonObject SWIGBridge::ToSWIGWrapper(std::unique_ptr 
stream_sb) {
+  return ToSWIGHelper(stream_sb.release(), SWIGTYPE_p_lldb__SBStream);
+}
+
 PythonObject SWIGBridge::ToSWIGWrapper(std::unique_ptr 
data_sb) {
   return ToSWIGHelper(data_sb.release(), SWIGTYPE_p_lldb__SBStructuredData);
 }
@@ -111,16 +115,9 @@ SWIGBridge::ToSWIGWrapper(CommandReturnObject &cmd_retobj) 
{
   SWIGTYPE_p_lldb__SBCommandReturnObject);
 }
 
-PythonObject SWIGBridge::ToSWIGWrapper(const Stream *s) {
-  return ToSWIGHelper(new lldb::SBStream(), SWIGTYPE_p_lldb__SBStream);
-}
-
-PythonObject SWIGBridge::ToSWIGWrapper(std::shared_ptr 
stream_sb) {
-  return ToSWIGHelper(stream_sb.get(), SWIGTYPE_p_lldb__SBStream);
-}
-
-PythonObject SWIGBridge::ToSWIGWrapper(Event *event) {
-  return ToSWIGHelper(new lldb::SBEvent(event), SWIGTYPE_p_lldb__SBEvent);
+ScopedPythonObject SWIGBridge::ToSWIGWrapper(Event *event) {
+  return ScopedPythonObject(new lldb::SBEvent(event),
+   SWIGTYPE_p_lldb__SBEvent);
 }
 
 PythonObject SWIGBridge::ToSWIGWrapper(

diff  --git a/lldb/bindings/python/python-wrapper.swig 
b/lldb/bindings/python/python-wrapper.swig
index 28ab58f8ce495..1370afc885d43 100644
--- a/lldb/bindings/python/python-wrapper.swig
+++ b/lldb/bindings/python/python-wrapper.swig
@@ -229,6 +229,133 @@ PythonObject 
lldb_private::python::SWIGBridge::LLDBSwigPythonCreateCommandObject
   return pfunc(SWIGBridge::ToSWIGWrapper(std::move(debugger_sp)), dict);
 }
 
+PythonObject 
lldb_private::python::SWIGBridge::LLDBSwigPythonCreateScriptedThreadPlan(
+const char *python_class_name, const char *session_dictionary_name,
+const lldb_private::StructuredDataImpl &args_impl,
+std::string &error_string, const lldb::ThreadPlanSP &thread_plan_sp) {
+  if (python_class_name == NULL || python_class_name[0] == '\0' ||
+  !session_dictionary_name)
+return PythonObject();
+
+  PyErr_Cleaner py_err_cleaner(true);
+
+  auto dict = PythonModule::MainModule().ResolveName(
+  session_dictionary_name);
+  auto pfunc = PythonObject::ResolveNameWithDictionary(
+  python_class_name, dict);
+
+  if (!pfunc.IsAllocated()) {
+error_string.append("could not find script class: ");
+error_string.append(python_class_name);
+return PythonObject();
+  }
+
+  Pyth