Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix x86 regression tests #151

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8d4a7b2
Fix x86 regression tests
Aug 19, 2020
6fb8e1d
Auto update patch version
tonjen Jul 12, 2021
e3fe1f2
Auto update patch version
tonjen Jul 21, 2021
a9fa100
Auto update patch version
tonjen Jul 22, 2021
0f00ef3
Auto update patch version
tonjen Jul 28, 2021
0a72611
Auto update patch version
tonjen Jul 29, 2021
51264f3
Auto update patch version
tonjen Jul 29, 2021
99741cb
Auto update patch version
tonjen Jul 29, 2021
a3a221d
Auto update patch version
tonjen Jul 30, 2021
01efec8
Auto update patch version
tonjen Jul 30, 2021
5d6901b
Auto update patch version
tonjen Jul 30, 2021
46fb897
Auto update patch version
tonjen Jul 30, 2021
63d8102
Auto update patch version
tonjen Jul 31, 2021
aa62120
Auto update patch version
tonjen Aug 2, 2021
88dd2fa
Auto update patch version
tonjen Aug 2, 2021
3063073
Auto update patch version
tonjen Aug 3, 2021
67dde0a
Auto update patch version
tonjen Aug 3, 2021
cbb70e1
Auto update patch version
tonjen Aug 4, 2021
3eb4ca4
Auto update patch version
tonjen Aug 5, 2021
f94a5dd
Auto update patch version
tonjen Aug 6, 2021
bc3d15a
Auto update patch version
tonjen Aug 7, 2021
c403509
Auto update patch version
tonjen Aug 11, 2021
89e5de3
Auto update patch version
tonjen Sep 6, 2021
4e65b83
Auto update patch version
tonjen Sep 24, 2021
629736d
Auto update patch version
tonjen Oct 4, 2021
ad9a6db
Auto update patch version
tonjen Oct 29, 2021
d99720d
Auto update patch version
tonjen Nov 8, 2021
b4b6c23
Auto update patch version
tonjen Nov 16, 2021
01170c1
Auto update patch version
tonjen Dec 6, 2021
5922c2a
Auto update patch version
tonjen Dec 6, 2021
8ca323d
Auto update patch version
tonjen Jan 10, 2022
7ca6a2f
Auto update patch version
tonjen Jan 21, 2022
26a298f
Auto update patch version
tonjen Feb 11, 2022
d081663
Auto update patch version
tonjen Mar 30, 2022
c352387
Update CHANGELOG.md
tonjen Mar 30, 2022
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

All notable changes to this project will be documented in this file.

## Version: 7.7.34

### New



4 changes: 2 additions & 2 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ if(NOT DEFINED LLVM_VERSION_MAJOR)
set(LLVM_VERSION_MAJOR 7)
endif()
if(NOT DEFINED LLVM_VERSION_MINOR)
set(LLVM_VERSION_MINOR 0)
set(LLVM_VERSION_MINOR 7)
endif()
if(NOT DEFINED LLVM_VERSION_PATCH)
set(LLVM_VERSION_PATCH 0)
set(LLVM_VERSION_PATCH 34)
endif()
if(NOT DEFINED LLVM_VERSION_SUFFIX)
set(LLVM_VERSION_SUFFIX "")
Expand Down
8 changes: 4 additions & 4 deletions llvm/include/llvm/IR/Intrinsics.td
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ def int_experimental_gc_relocate : Intrinsic<[llvm_any_ty],

// Coroutine Structure Intrinsics.
// TVM local begin
def int_coro_id : Intrinsic<[llvm_token_ty], [llvm_i257_ty, llvm_ptr_ty,
def int_coro_id : Intrinsic<[llvm_token_ty], [llvm_i32_ty, llvm_ptr_ty,
llvm_ptr_ty, llvm_ptr_ty],
[IntrArgMemOnly, IntrReadMem,
ReadNone<1>, ReadOnly<2>, NoCapture<2>]>;
Expand All @@ -799,7 +799,7 @@ def int_coro_noop : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>;
def int_coro_size : Intrinsic<[llvm_anyint_ty], [], [IntrNoMem]>;

def int_coro_save : Intrinsic<[llvm_token_ty], [llvm_ptr_ty], []>;
def int_coro_suspend : Intrinsic<[llvm_i257_ty], [llvm_token_ty, llvm_i1_ty], []>;
def int_coro_suspend : Intrinsic<[llvm_i8_ty], [llvm_token_ty, llvm_i1_ty], []>;

def int_coro_param : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_ptr_ty],
[IntrNoMem, ReadNone<0>, ReadNone<1>]>;
Expand All @@ -817,12 +817,12 @@ def int_coro_destroy : Intrinsic<[], [llvm_ptr_ty], [Throws]>;
def int_coro_done : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty],
[IntrArgMemOnly, ReadOnly<0>, NoCapture<0>]>;
def int_coro_promise : Intrinsic<[llvm_ptr_ty],
[llvm_ptr_ty, llvm_i257_ty, llvm_i1_ty],
[llvm_ptr_ty, llvm_i32_ty, llvm_i1_ty],
[IntrNoMem, NoCapture<0>]>;

// Coroutine Lowering Intrinsics. Used internally by coroutine passes.

def int_coro_subfn_addr : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty, llvm_i257_ty],
def int_coro_subfn_addr : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty, llvm_i8_ty],
[IntrReadMem, IntrArgMemOnly, ReadOnly<0>,
NoCapture<0>]>;
// TVM local end
Expand Down
4 changes: 3 additions & 1 deletion llvm/lib/Analysis/InlineCost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/CodeMetrics.h"
Expand Down Expand Up @@ -2029,7 +2030,8 @@ bool llvm::isInlineViable(Function &F) {
// TVM local begin
#define CORO_PRESPLIT_ATTR "coroutine.presplit"
// Disallow inlining of pre-split coroutines
if (F.hasFnAttribute(CORO_PRESPLIT_ATTR)) {
if (Triple(F.getParent()->getTargetTriple()).isTVM() &&
F.hasFnAttribute(CORO_PRESPLIT_ATTR)) {
return false;
}
// TVM local end
Expand Down
10 changes: 8 additions & 2 deletions llvm/lib/Transforms/Coroutines/CoroEarly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//

#include "CoroInternal.h"
#include "llvm/ADT/Triple.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/InstIterator.h"
Expand Down Expand Up @@ -80,9 +81,14 @@ void Lowerer::lowerCoroPromise(CoroPromiseInst *Intrin) {

Builder.SetInsertPoint(Intrin);
// TVM local begin
Value *Replacement;
// Fix: Offset as a signed constant
Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Offset, true);
Value *Replacement = Builder.CreateInBoundsGEP(Int8Ty, Operand, Idx);
if (Triple((Intrin->getModule()->getTargetTriple())).isTVM()) {
Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Offset, true);
Replacement = Builder.CreateInBoundsGEP(Int8Ty, Operand, Idx);
} else {
Replacement = Builder.CreateConstInBoundsGEP1_32(Int8Ty, Operand, Offset);
}
// TVM local end

Intrin->replaceAllUsesWith(Replacement);
Expand Down
18 changes: 10 additions & 8 deletions llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,15 +771,16 @@ static bool materializable(Instruction &V, Value *ThisPtr) {
return true;
}
}
// Rematerializing load from contract class data for TVM
if (auto *Load = dyn_cast<LoadInst>(&V)) {
auto *Ptr = Load->getPointerOperand()->stripInBoundsConstantOffsets();
if (Ptr == ThisPtr)
if (Triple(V.getModule()->getTargetTriple()).isTVM()) {
// Rematerializing load from contract class data for TVM
if (auto *Load = dyn_cast<LoadInst>(&V)) {
auto *Ptr = Load->getPointerOperand()->stripInBoundsConstantOffsets();
if (Ptr == ThisPtr)
return true;
}
if (isa<Constant>(&V))
return true;
}
if (isa<Constant>(&V))
return true;

return isa<CastInst>(&V) || isa<GetElementPtrInst>(&V) ||
isa<BinaryOperator>(&V) || isa<CmpInst>(&V) || isa<SelectInst>(&V);
}
Expand Down Expand Up @@ -932,7 +933,8 @@ void coro::buildCoroutineFrame(Function &F, Shape &Shape) {
for (int Repeat = 0; Repeat < 4; ++Repeat) {
// See if there are materializable instructions across suspend points.
// TVM local begin
assert(F.arg_size() >= 2 &&
assert((!Triple(F.getParent()->getTargetTriple()).isTVM() ||
F.arg_size() >= 2) &&
"We only support coroutine methods in TVM (resumable sret + this)");
auto *ThisPtr = &*std::next(F.arg_begin());
for (Instruction &I : instructions(F))
Expand Down
6 changes: 0 additions & 6 deletions llvm/lib/Transforms/Coroutines/CoroInstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ class LLVM_LIBRARY_VISIBILITY CoroSubFnInst : public IntrinsicInst {

public:
enum ResumeKind {
// TVM local begin
RestartTrigger = -1,
// TVM local end
ResumeIndex,
DestroyIndex,
CleanupIndex,
Expand All @@ -49,10 +47,6 @@ class LLVM_LIBRARY_VISIBILITY CoroSubFnInst : public IntrinsicInst {

Value *getFrame() const { return getArgOperand(FrameArg); }
ResumeKind getIndex() const {
// TVM local begin
if (getRawIndex()->getValue().getMinSignedBits() > 64)
return RestartTrigger;
// TVM local end
int64_t Index = getRawIndex()->getValue().getSExtValue();
assert(Index >= IndexFirst && Index < IndexLast &&
"unexpected CoroSubFnInst index argument");
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Transforms/Coroutines/CoroTVMExpand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ struct CoroTVMExpand : FunctionPass {
}

bool runOnFunction(Function &F) override {
if (!Triple(F.getParent()->getTargetTriple()).isTVM())
return false;
if (!L)
return false;

Expand Down
32 changes: 8 additions & 24 deletions llvm/tools/clang/lib/CodeGen/CGCleanup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,22 +343,18 @@ static void ResolveAllBranchFixups(CodeGenFunction &CGF,
// i.e. where there's an unresolved fixup inside a single cleanup
// entry which we're currently popping.
if (Fixup.OptimisticBranchBlock == nullptr) {
// TVM local begin
createStoreInstBefore(CGF.Builder.getInt257(Fixup.DestinationIndex),
createStoreInstBefore(CGF.Builder.getInt32(Fixup.DestinationIndex),
CGF.getNormalCleanupDestSlot(),
Fixup.InitialBranch);
// TVM local end
Fixup.InitialBranch->setSuccessor(0, CleanupEntry);
}

// Don't add this case to the switch statement twice.
if (!CasesAdded.insert(Fixup.Destination).second)
continue;

// TVM local begin
Switch->addCase(CGF.Builder.getInt257(Fixup.DestinationIndex),
Switch->addCase(CGF.Builder.getInt32(Fixup.DestinationIndex),
Fixup.Destination);
// TVM local end
}

CGF.EHStack.clearFixups();
Expand Down Expand Up @@ -417,9 +413,7 @@ void CodeGenFunction::ResolveBranchFixups(llvm::BasicBlock *Block) {
llvm::SwitchInst *Switch = TransitionToCleanupSwitch(*this, BranchBB);

// Add a case to the switch.
// TVM local begin
Switch->addCase(Builder.getInt257(Fixup.DestinationIndex), Block);
// TVM local end
Switch->addCase(Builder.getInt32(Fixup.DestinationIndex), Block);
}

if (ResolvedAny)
Expand Down Expand Up @@ -800,10 +794,8 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) {
// If there's a fallthrough, we need to store the cleanup
// destination index. For fall-throughs this is always zero.
if (HasFallthrough) {
// TVM local begin
if (!HasPrebranchedFallthrough)
Builder.CreateStore(Builder.getInt257(0), getNormalCleanupDestSlot());
// TVM local end
Builder.CreateStore(Builder.getInt32(0), getNormalCleanupDestSlot());

// Otherwise, save and clear the IP if we don't have fallthrough
// because the cleanup is inactive.
Expand Down Expand Up @@ -885,10 +877,8 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) {
// Branch-after fallthrough.
if (FallthroughSource && !FallthroughIsBranchThrough) {
FallthroughDest = createBasicBlock("cleanup.cont");
// TVM local begin
if (HasFallthrough)
Switch->addCase(Builder.getInt257(0), FallthroughDest);
// TVM local end
Switch->addCase(Builder.getInt32(0), FallthroughDest);
}

for (unsigned I = 0, E = Scope.getNumBranchAfters(); I != E; ++I) {
Expand Down Expand Up @@ -923,11 +913,9 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) {
BranchFixup &Fixup = EHStack.getBranchFixup(I);
if (!Fixup.Destination) continue;
if (!Fixup.OptimisticBranchBlock) {
// TVM local begin
createStoreInstBefore(Builder.getInt257(Fixup.DestinationIndex),
createStoreInstBefore(Builder.getInt32(Fixup.DestinationIndex),
getNormalCleanupDestSlot(),
Fixup.InitialBranch);
// TVM local end
Fixup.InitialBranch->setSuccessor(0, NormalEntry);
}
Fixup.OptimisticBranchBlock = NormalExit;
Expand Down Expand Up @@ -1098,9 +1086,7 @@ void CodeGenFunction::EmitBranchThroughCleanup(JumpDest Dest) {
// Otherwise, thread through all the normal cleanups in scope.

// Store the index at the start.
// TVM local begin
llvm::ConstantInt *Index = Builder.getInt257(Dest.getDestIndex());
// TVM local end
llvm::ConstantInt *Index = Builder.getInt32(Dest.getDestIndex());
createStoreInstBefore(Index, getNormalCleanupDestSlot(), BI);

// Adjust BI to point to the first cleanup block.
Expand Down Expand Up @@ -1282,11 +1268,9 @@ void CodeGenFunction::DeactivateCleanupBlock(EHScopeStack::stable_iterator C,
}

Address CodeGenFunction::getNormalCleanupDestSlot() {
// TVM local begin
if (!NormalCleanupDest.isValid())
NormalCleanupDest =
CreateDefaultAlignTempAlloca(Builder.getInt257Ty(), "cleanup.dest.slot");
// TVM local end
CreateDefaultAlignTempAlloca(Builder.getInt32Ty(), "cleanup.dest.slot");
return NormalCleanupDest;
}

Expand Down
14 changes: 4 additions & 10 deletions llvm/tools/clang/lib/CodeGen/CGCoroutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,8 @@ static LValueOrRValue emitSuspendExpression(CodeGenFunction &CGF, CGCoroData &Co

// Create a switch capturing three possible continuations.
auto *Switch = Builder.CreateSwitch(SuspendResult, Coro.SuspendBB, 2);
// TVM local begin
Switch->addCase(Builder.getInt257(0), ReadyBlock);
Switch->addCase(Builder.getInt257(1), CleanupBlock);
// TVM local end
Switch->addCase(Builder.getInt8(0), ReadyBlock);
Switch->addCase(Builder.getInt8(1), CleanupBlock);

// Emit cleanup for this suspend point.
CGF.EmitBlock(CleanupBlock);
Expand Down Expand Up @@ -563,18 +561,14 @@ void CodeGenFunction::EmitCoroutineBody(const CoroutineBodyStmt &S) {
auto *FinalBB = createBasicBlock("coro.final");
auto *RetBB = createBasicBlock("coro.ret");

// TVM local begin
auto *CoroId = Builder.CreateCall(
CGM.getIntrinsic(llvm::Intrinsic::coro_id),
{Builder.getInt257(NewAlign), NullPtr, NullPtr, NullPtr});
// TVM local end
{Builder.getInt32(NewAlign), NullPtr, NullPtr, NullPtr});
createCoroData(*this, CurCoro, CoroId);
CurCoro.Data->SuspendBB = RetBB;

// TVM local begin
// Backend is allowed to elide memory allocations, to help it, emit
// auto mem = coro.alloc() ? ... allocation code ... : 0;
// TVM local end
// auto mem = coro.alloc() ? 0 : ... allocation code ...;
auto *CoroAlloc = Builder.CreateCall(
CGM.getIntrinsic(llvm::Intrinsic::coro_alloc), {CoroId});

Expand Down