Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cmake-test-release-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
BUILD_TYPE: Release
# The official LLVM release package, installed where a custom LLVM build would be - see
# scripts/install_llvm_prebuilt_release.sh.
LLVM_FULL_VERSION: "22.1.8"
LLVM_FULL_VERSION: "23.1.2"
GC_VERSION: "8.2.12"
LIBATOMIC_OPS_VERSION: "7.10.0"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cmake-test-release-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
CACHE_VERSION: v11
LLVM_VERSION: 22
LLVM_VERSION: 23
# The official LLVM release package plus a prebuilt MLIR archive, installed where a custom LLVM
# build would be - see scripts/install_llvm_prebuilt_release.ps1.
LLVM_FULL_VERSION: "22.1.8"
LLVM_FULL_VERSION: "23.1.2"
GC_VERSION: "8.2.12"
LIBATOMIC_OPS_VERSION: "7.10.0"

Expand Down
10 changes: 5 additions & 5 deletions scripts/install_llvm_prebuilt_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Skips everything when the prefix already has MLIR, so it never overwrites a custom build.
set -e

VERSION=${1:-22.1.8}
VERSION=${1:-23.1.2}
ROOT=$(cd "$(dirname "$0")/.." && pwd)
PREFIX=${PREFIX:-$ROOT/3rdParty/llvm/release}
WORK_DIR=${WORK_DIR:-$ROOT/__build/llvm-prebuilt}
Expand All @@ -28,17 +28,17 @@ if [ -f "$PREFIX/lib/cmake/mlir/MLIRConfig.cmake" ]; then
fi

NAME=LLVM-$VERSION-Linux-X64
PACKAGE=$WORK_DIR/$NAME.tar.xz
PACKAGE=$WORK_DIR/$NAME.tar.zst
mkdir -p "$WORK_DIR" "$PREFIX"
if [ ! -f "$PACKAGE" ]; then
echo "Downloading $NAME.tar.xz"
echo "Downloading $NAME.tar.zst"
curl -fsSL --retry 3 -o "$PACKAGE.part" \
"https://github.com/llvm/llvm-project/releases/download/llvmorg-$VERSION/$NAME.tar.xz"
"https://github.com/llvm/llvm-project/releases/download/llvmorg-$VERSION/$NAME.tar.zst"
mv "$PACKAGE.part" "$PACKAGE"
fi

echo "Unpacking $PACKAGE into $PREFIX"
xz -T0 -dc "$PACKAGE" | tar -x -C "$PREFIX" --strip-components=1 \
zstd --long=31 -T0 -dc "$PACKAGE" | tar -x -C "$PREFIX" --strip-components=1 \
--exclude='*/bin/flang*' --exclude='*/bin/bbc' --exclude='*/bin/tco' \
--exclude='*/bin/fir-*' --exclude='*/bin/f18-*' --exclude='*/bin/lldb*' \
--exclude='*/bin/llvm-bolt*' --exclude='*/bin/*bolt*' --exclude='*/bin/merge-fdata' \
Expand Down
6 changes: 3 additions & 3 deletions scripts/llvm_prebuilt_common.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Shared by build_mlir_prebuilt_release.ps1 and install_llvm_prebuilt_release.ps1 (dot-sourced).
#
# The official LLVM Windows package (clang+llvm-<ver>-x86_64-pc-windows-msvc.tar.xz, a GitHub
# The official LLVM Windows package (clang+llvm-<ver>-x86_64-pc-windows-msvc.tar.zst, a GitHub
# release asset of llvm/llvm-project) carries the LLVM, Clang and LLD libraries with their CMake
# packages, lld/wasm-ld, clang and clang's resource directory, built with the static CRT (/MT) the
# project needs. It has no MLIR at all. build_mlir_prebuilt_release.ps1 builds MLIR standalone
Expand All @@ -16,7 +16,7 @@
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"

# Windows' own bsdtar reads and writes .tar.xz; a Git for Windows tar earlier on PATH would need xz
# Windows' own bsdtar reads and writes .tar.zst; a Git for Windows tar earlier on PATH would need zst
# beside it.
$script:tar = Join-Path $env:SystemRoot "System32\tar.exe"

Expand Down Expand Up @@ -44,7 +44,7 @@ function Get-LlvmAsset([string]$version, [string]$name, [string]$dir) {
function Install-OfficialLlvm([string]$version, [string]$prefix, [string]$workDir) {
$llvmConfig = Join-Path $prefix "lib\cmake\llvm\LLVMConfig.cmake"
if (-not (Test-Path $llvmConfig)) {
$package = Get-LlvmAsset $version "clang+llvm-$version-x86_64-pc-windows-msvc.tar.xz" $workDir
$package = Get-LlvmAsset $version "clang+llvm-$version-x86_64-pc-windows-msvc.tar.zst" $workDir
New-Item -ItemType Directory -Force -Path $prefix | Out-Null
Write-Host "Unpacking $package into $prefix"
Invoke-Checked "Unpacking the LLVM package" { & $script:tar -xf $package -C $prefix --strip-components=1 }
Expand Down
4 changes: 2 additions & 2 deletions tslang/include/TypeScript/Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@
#define TRAMPOLINE_SIZE 40
#endif

#define ATTR(attr) mlir::StringAttr::get(rewriter.getContext(), attr)
#define TS_ATTR(attr) mlir::StringAttr::get(rewriter.getContext(), attr)
#define IDENT(name) mlir::Identifier::get(name, rewriter.getContext())
#define NAMED_ATTR(name, attr) mlir::ArrayAttr::get(rewriter.getContext(), {ATTR(name), ATTR(attr)})
#define NAMED_TS_ATTR(name, attr) mlir::ArrayAttr::get(rewriter.getContext(), {TS_ATTR(name), TS_ATTR(attr)})

#define DATA_VALUE_INDEX 0
#define THIS_VALUE_INDEX 1
Expand Down
33 changes: 16 additions & 17 deletions tslang/include/TypeScript/LowerToLLVM/LLVMDebugInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ class LLVMDebugInfoHelper
emptyDIExpr,
emptyDIExpr,
emptyDIExpr,
{});
StringAttr(), LLVM::DIDerivedTypeAttr(), {});

return fwdCompositeType;
}
Expand Down Expand Up @@ -530,15 +530,15 @@ class LLVMDebugInfoHelper
auto elementOffsetInBits = structLaytout->getElementOffsetInBits(index);

auto elementDiType = getDITypeScriptType(location, elementType, file, line, scope);
auto wrapperDiType = LLVM::DIDerivedTypeAttr::get(context, dwarf::DW_TAG_member, name, elementDiType,
sizesTrack.elementSizeInBits, sizesTrack.elementAlignInBits, elementOffsetInBits/*sizesTrack.offsetInBits*/, {}, {});
auto wrapperDiType = LLVM::DIDerivedTypeAttr::get(context, dwarf::DW_TAG_member, name, file, line, scope, elementDiType,
sizesTrack.elementSizeInBits, sizesTrack.elementAlignInBits, elementOffsetInBits, {}, LLVM::DIFlags::Zero, {});
elements.push_back(wrapperDiType);
}

LLVM::DIExpressionAttr emptyDIExpr;
auto compositeType = LLVM::DICompositeTypeAttr::get(context, dwarf::DW_TAG_structure_type,
StringAttr::get(context, isNamePrefix ? MLIRHelper::getAnonymousName(typeWithFields, name.data()) : name),
file, line, scope, LLVM::DITypeAttr(), LLVM::DIFlags::TypePassByValue, sizesTrack.sizeInBits, sizesTrack.alignInBits, emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, elements);
file, line, scope, LLVM::DITypeAttr(), LLVM::DIFlags::TypePassByValue, sizesTrack.sizeInBits, sizesTrack.alignInBits, emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, StringAttr(), LLVM::DIDerivedTypeAttr(), elements);

if (!isNamePrefix)
{
Expand All @@ -555,8 +555,8 @@ class LLVMDebugInfoHelper
auto offsetInBits = 0;

return LLVM::DIDerivedTypeAttr::get(
context, dwarf::DW_TAG_pointer_type, StringAttr::get(context, "pointer"), diElementType,
sizeInBits, alignInBits, offsetInBits, {}, {});
context, dwarf::DW_TAG_pointer_type, StringAttr::get(context, "pointer"), file, line, LLVM::DIScopeAttr(), diElementType,
sizeInBits, alignInBits, offsetInBits, {}, LLVM::DIFlags::Zero, {});
}

LLVM::DISubroutineTypeAttr getDISubroutineType(mlir::Location location, LLVM::LLVMFunctionType funcType, LLVM::DIFileAttr file, uint32_t line, LLVM::DIScopeAttr scope)
Expand Down Expand Up @@ -597,7 +597,7 @@ class LLVMDebugInfoHelper
// create forward declaration
auto fwdCompositeType = LLVM::DICompositeTypeAttr::get(context, dwarf::DW_TAG_structure_type,
StringAttr::get(context, structType.getName()),
file, line, scope, LLVM::DITypeAttr(), LLVM::DIFlags::FwdDecl, 0, 0, emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, {});
file, line, scope, LLVM::DITypeAttr(), LLVM::DIFlags::FwdDecl, 0, 0, emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, StringAttr(), LLVM::DIDerivedTypeAttr(), {});

return fwdCompositeType;
}
Expand All @@ -624,7 +624,7 @@ class LLVMDebugInfoHelper

auto elementDiType = getDILLVMType(location, llvmElementType, file, line, scope);
auto wrapperDiType = LLVM::DIDerivedTypeAttr::get(context, dwarf::DW_TAG_member,
elementName, elementDiType, sizesTrack.elementSizeInBits, sizesTrack.elementAlignInBits, elementOffsetInBits/*sizesTrack.offsetInBits*/, {}, {});
elementName, file, line, scope, elementDiType, sizesTrack.elementSizeInBits, sizesTrack.elementAlignInBits, elementOffsetInBits, {}, LLVM::DIFlags::Zero, {});
elements.push_back(wrapperDiType);
}

Expand All @@ -633,7 +633,7 @@ class LLVMDebugInfoHelper
: MLIRHelper::getAnonymousName(structType, "struct"));
auto compositeType = LLVM::DICompositeTypeAttr::get(context, dwarf::DW_TAG_structure_type, name,
file, line, scope, LLVM::DITypeAttr(), LLVM::DIFlags::TypePassByValue, sizesTrack.sizeInBits, sizesTrack.alignInBits,
emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, elements);
emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, StringAttr(), LLVM::DIDerivedTypeAttr(), elements);

if (structType.isIdentified())
{
Expand Down Expand Up @@ -674,15 +674,15 @@ class LLVMDebugInfoHelper
auto elementOffsetInBits = structLayout->getElementOffsetInBits(index);

auto elementDiType = getDIType(location, llvmElementType, elementType, file, line, scope);
auto wrapperDiType = LLVM::DIDerivedTypeAttr::get(context, dwarf::DW_TAG_member, name, elementDiType,
sizesTrack.elementSizeInBits, sizesTrack.elementAlignInBits, elementOffsetInBits/*sizesTrack.offsetInBits*/, {}, {});
auto wrapperDiType = LLVM::DIDerivedTypeAttr::get(context, dwarf::DW_TAG_member, name, file, line, scope, elementDiType,
sizesTrack.elementSizeInBits, sizesTrack.elementAlignInBits, elementOffsetInBits, {}, LLVM::DIFlags::Zero, {});
elements.push_back(wrapperDiType);
}

LLVM::DIExpressionAttr emptyDIExpr;
return LLVM::DICompositeTypeAttr::get(context, dwarf::DW_TAG_structure_type,
StringAttr::get(context, name), file, line, scope, LLVM::DITypeAttr(),
LLVM::DIFlags::TypePassByValue, sizesTrack.sizeInBits, sizesTrack.alignInBits, emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, elements);
LLVM::DIFlags::TypePassByValue, sizesTrack.sizeInBits, sizesTrack.alignInBits, emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, StringAttr(), LLVM::DIDerivedTypeAttr(), elements);
}

LLVM::DICompositeTypeAttr getDIStructType(StringRef name, ArrayRef<std::pair<StringRef, LLVM::DITypeAttr>> fields, LLVM::DIFileAttr file, uint32_t line, LLVM::DIScopeAttr scope)
Expand All @@ -701,14 +701,13 @@ class LLVMDebugInfoHelper

sizesTrack.nextElementType(elementDiType);

auto wrapperDiType = LLVM::DIDerivedTypeAttr::get(context, dwarf::DW_TAG_member, name, elementDiType,
sizesTrack.elementSizeInBits, sizesTrack.elementAlignInBits, sizesTrack.offsetInBits, {}, {});
auto wrapperDiType = LLVM::DIDerivedTypeAttr::get(context, dwarf::DW_TAG_member, name, file, line, scope, elementDiType, sizesTrack.elementSizeInBits, sizesTrack.elementAlignInBits, sizesTrack.offsetInBits, {}, LLVM::DIFlags::Zero, {});
elements.push_back(wrapperDiType);
}

LLVM::DIExpressionAttr emptyDIExpr;
return LLVM::DICompositeTypeAttr::get(context, dwarf::DW_TAG_structure_type, StringAttr::get(context, name),
file, line, scope, LLVM::DITypeAttr(), LLVM::DIFlags::TypePassByValue, sizesTrack.sizeInBits, sizesTrack.alignInBits, emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, elements);
file, line, scope, LLVM::DITypeAttr(), LLVM::DIFlags::TypePassByValue, sizesTrack.sizeInBits, sizesTrack.alignInBits, emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, StringAttr(), LLVM::DIDerivedTypeAttr(), elements);
}

LLVM::DICompositeTypeAttr getDIUnionType(mlir::Location location, mlir_ts::UnionType unionType, LLVM::DIFileAttr file, uint32_t line, LLVM::DIScopeAttr scope)
Expand All @@ -731,14 +730,14 @@ class LLVMDebugInfoHelper

auto elementDiType = getDITypeScriptType(location, elementType, file, line, scope);
auto wrapperDiType = LLVM::DIDerivedTypeAttr::get(context, dwarf::DW_TAG_member, name,
elementDiType, sizesTrack.elementSizeInBits, sizesTrack.elementAlignInBits, 0, {}, {});
file, line, scope, elementDiType, sizesTrack.elementSizeInBits, sizesTrack.elementAlignInBits, 0, {}, LLVM::DIFlags::Zero, {});
elements.push_back(wrapperDiType);
}

LLVM::DIExpressionAttr emptyDIExpr;
return LLVM::DICompositeTypeAttr::get(context, dwarf::DW_TAG_union_type,
StringAttr::get(context, MLIRHelper::getAnonymousName(unionType, "union")), file, line, scope, LLVM::DITypeAttr(), LLVM::DIFlags::TypePassByValue,
sizeInBits, sizesTrack.alignInBits, emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, elements);
sizeInBits, sizesTrack.alignInBits, emptyDIExpr, emptyDIExpr, emptyDIExpr, emptyDIExpr, StringAttr(), LLVM::DIDerivedTypeAttr(), elements);
}
};

Expand Down
2 changes: 1 addition & 1 deletion tslang/include/TypeScript/LowerToLLVM/LLVMDebugInfoFixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class LLVMDebugInfoHelperFixer
}

auto subroutineTypeAttr = mlir::LLVM::DISubroutineTypeAttr::get(context, llvm::dwarf::DW_CC_normal, resultTypes);
SmallVector<mlir::LLVM::DINodeAttr> retainedNodes; // TODO: review usage of it
SmallVector<mlir::Attribute> retainedNodes; // TODO: review usage of it
SmallVector<mlir::LLVM::DINodeAttr> annotations; // TODO: review usage of it
// a fresh DistinctAttr id: references to the old subprogram outside this
// function (if any) keep the old identity instead of colliding with the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class LLVMRTTIHelperVCLinux
auto name = "__gxx_personality_v0";
auto cxxFrameHandler3 = ch.getOrInsertFunction(name, th.getFunctionType(th.getI32Type(), {}, true));

newFuncOp->setAttr(ATTR("personality"), FlatSymbolRefAttr::get(rewriter.getContext(), name));
newFuncOp->setAttr(TS_ATTR("personality"), FlatSymbolRefAttr::get(rewriter.getContext(), name));
return success();
}

Expand Down
5 changes: 3 additions & 2 deletions tslang/include/TypeScript/MLIRLogic/MLIRDebugInfoHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,13 @@ class MLIRDebugInfoHelper

auto funcNameAttr = builder.getStringAttr(functionName);
auto linkageNameAttr = builder.getStringAttr(linkageName);
SmallVector<mlir::LLVM::DINodeAttr> retainedNodes; // TODO: review usage of it
SmallVector<mlir::Attribute> retainedNodes; // TODO: review usage of it
SmallVector<mlir::LLVM::DINodeAttr> annotations; // TODO: review usage of it
auto subprogramAttr = mlir::LLVM::DISubprogramAttr::get(
builder.getContext(), DistinctAttr::create(builder.getUnitAttr()), compileUnitAttr, isAcceptableSubProgramScope(scopeAttr) ? scopeAttr : compileUnitAttr,
funcNameAttr, linkageNameAttr,
file/*compileUnitAttr.getFile()*/, line, scopeLine, subprogramFlags, type, retainedNodes, annotations);
file/*compileUnitAttr.getFile()*/, line, scopeLine, subprogramFlags, type,
retainedNodes, annotations);

debugScope.insert(SUBPROGRAM_DEBUG_SCOPE, subprogramAttr);
debugScope.insert(DEBUG_SCOPE, subprogramAttr);
Expand Down
8 changes: 4 additions & 4 deletions tslang/include/TypeScript/TypeScriptOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -1812,7 +1812,7 @@ def TypeScript_ReturnInternalOp : TypeScript_Op<"ReturnInternal", [Pure, HasPare
}

def TypeScript_IfOp : TypeScript_Op<"If",
[DeclareOpInterfaceMethods<RegionBranchOpInterface>, SingleBlockImplicitTerminator<"typescript::ResultOp">,
[DeclareOpInterfaceMethods<RegionBranchOpInterface, ["getSuccessorInputs"]>, SingleBlockImplicitTerminator<"typescript::ResultOp">,
NoRegionArguments]> {
let summary = "if-then-else operation";

Expand Down Expand Up @@ -1870,7 +1870,7 @@ def TypeScript_WhileOp : TypeScript_Op<"While",
[
LoopLikeOpInterface,
ConditionallySpeculatable,
DeclareOpInterfaceMethods<RegionBranchOpInterface, ["getEntrySuccessorOperands"]>
DeclareOpInterfaceMethods<RegionBranchOpInterface, ["getEntrySuccessorOperands", "getSuccessorInputs"]>
]> {
let summary = "a generic 'while' loop";
let description = [{
Expand Down Expand Up @@ -1915,7 +1915,7 @@ def TypeScript_DoWhileOp : TypeScript_Op<"DoWhile",
[
LoopLikeOpInterface,
ConditionallySpeculatable,
DeclareOpInterfaceMethods<RegionBranchOpInterface, ["getEntrySuccessorOperands"]>
DeclareOpInterfaceMethods<RegionBranchOpInterface, ["getEntrySuccessorOperands", "getSuccessorInputs"]>
]> {
let summary = "a generic 'do-while' loop";
let description = [{
Expand Down Expand Up @@ -1943,7 +1943,7 @@ def TypeScript_ForOp : TypeScript_Op<"For",
[
LoopLikeOpInterface,
ConditionallySpeculatable,
DeclareOpInterfaceMethods<RegionBranchOpInterface, ["getEntrySuccessorOperands"]>
DeclareOpInterfaceMethods<RegionBranchOpInterface, ["getEntrySuccessorOperands", "getSuccessorInputs"]>
]> {
let summary = "a generic 'for' loop";

Expand Down
Loading
Loading