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

[pull] master from llvm:master #30

Merged
merged 4 commits into from
Aug 28, 2019
Merged
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
6 changes: 3 additions & 3 deletions clang/test/CodeGenCXX/castexpr-basepathsize-threshold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// https://bugs.llvm.org/show_bug.cgi?id=38356
// We only check that we do not crash.

// ASAN increases stack usage, so we are hitting stack overflow before reaching
// recursive template instantiation limit.
// XFAIL: darwin && asan
// This test can exceed stack usage in some configurations, so unless we can
// properly handle that don't run it.
// REQUIRES: thread_support

template <typename a, a b(unsigned), int c, unsigned...>
struct d : d<a, b, c - 1> {};
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/Target/Mips/Mips.td
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class PredicateControl {
list<Predicate> GPRPredicates = [];
// Predicates for the PTR size such as IsPTR64bit
list<Predicate> PTRPredicates = [];
// Predicates for a symbol's size such as hasSym32.
list<Predicate> SYMPredicates = [];
// Predicates for the FGR size and layout such as IsFP64bit
list<Predicate> FGRPredicates = [];
// Predicates for the instruction group membership such as ISA's.
Expand All @@ -38,6 +40,7 @@ class PredicateControl {
list<Predicate> Predicates = !listconcat(EncodingPredicates,
GPRPredicates,
PTRPredicates,
SYMPredicates,
FGRPredicates,
InsnPredicates,
HardFloatPredicate,
Expand Down
35 changes: 35 additions & 0 deletions llvm/lib/Target/Mips/Mips64InstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ def : MipsPat<(MipsTlsHi tglobaltlsaddr:$in), (LUi64 tglobaltlsaddr:$in)>,
let AdditionalPredicates = [NotInMicroMips] in {
def : MipsPat<(MipsJmpLink (i64 texternalsym:$dst)),
(JAL texternalsym:$dst)>, ISA_MIPS3, GPR_64, SYM_64;

def : MipsPat<(MipsHighest (i64 tglobaladdr:$in)),
(LUi64 tglobaladdr:$in)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(MipsHighest (i64 tblockaddress:$in)),
Expand Down Expand Up @@ -682,6 +683,20 @@ let AdditionalPredicates = [NotInMicroMips] in {
(DADDiu GPR64:$hi, tjumptable:$lo)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(add GPR64:$hi, (MipsHigher (i64 tconstpool:$lo))),
(DADDiu GPR64:$hi, tconstpool:$lo)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(add GPR64:$hi, (MipsHigher (i64 texternalsym:$lo))),
(DADDiu GPR64:$hi, texternalsym:$lo)>,
ISA_MIPS3, GPR_64, SYM_64;

def : MipsPat<(MipsHi (i64 tglobaladdr:$in)),
(DADDiu ZERO_64, tglobaladdr:$in)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(MipsHi (i64 tblockaddress:$in)),
(DADDiu ZERO_64, tblockaddress:$in)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(MipsHi (i64 tjumptable:$in)),
(DADDiu ZERO_64, tjumptable:$in)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(MipsHi (i64 tconstpool:$in)),
(DADDiu ZERO_64, tconstpool:$in)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(MipsHi (i64 texternalsym:$in)),
(DADDiu ZERO_64, texternalsym:$in)>, ISA_MIPS3, GPR_64, SYM_64;

def : MipsPat<(add GPR64:$hi, (MipsHi (i64 tglobaladdr:$lo))),
(DADDiu GPR64:$hi, tglobaladdr:$lo)>, ISA_MIPS3, GPR_64, SYM_64;
Expand All @@ -692,6 +707,23 @@ let AdditionalPredicates = [NotInMicroMips] in {
(DADDiu GPR64:$hi, tjumptable:$lo)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(add GPR64:$hi, (MipsHi (i64 tconstpool:$lo))),
(DADDiu GPR64:$hi, tconstpool:$lo)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(add GPR64:$hi, (MipsHi (i64 texternalsym:$lo))),
(DADDiu GPR64:$hi, texternalsym:$lo)>,
ISA_MIPS3, GPR_64, SYM_64;

def : MipsPat<(MipsLo (i64 tglobaladdr:$in)),
(DADDiu ZERO_64, tglobaladdr:$in)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(MipsLo (i64 tblockaddress:$in)),
(DADDiu ZERO_64, tblockaddress:$in)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(MipsLo (i64 tjumptable:$in)),
(DADDiu ZERO_64, tjumptable:$in)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(MipsLo (i64 tconstpool:$in)),
(DADDiu ZERO_64, tconstpool:$in)>, ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(MipsLo (i64 tglobaltlsaddr:$in)),
(DADDiu ZERO_64, tglobaltlsaddr:$in)>,
ISA_MIPS3, GPR_64, SYM_64;
def : MipsPat<(MipsLo (i64 texternalsym:$in)),
(DADDiu ZERO_64, texternalsym:$in)>, ISA_MIPS3, GPR_64, SYM_64;

def : MipsPat<(add GPR64:$hi, (MipsLo (i64 tglobaladdr:$lo))),
(DADDiu GPR64:$hi, tglobaladdr:$lo)>, ISA_MIPS3, GPR_64, SYM_64;
Expand All @@ -705,6 +737,9 @@ let AdditionalPredicates = [NotInMicroMips] in {
def : MipsPat<(add GPR64:$hi, (MipsLo (i64 tglobaltlsaddr:$lo))),
(DADDiu GPR64:$hi, tglobaltlsaddr:$lo)>, ISA_MIPS3, GPR_64,
SYM_64;
def : MipsPat<(add GPR64:$hi, (MipsLo (i64 texternalsym:$lo))),
(DADDiu GPR64:$hi, texternalsym:$lo)>,
ISA_MIPS3, GPR_64, SYM_64;
}

// gp_rel relocs
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/Mips/MipsInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ def HasCnMips : Predicate<"Subtarget->hasCnMips()">,
AssemblerPredicate<"FeatureCnMips">;
def NotCnMips : Predicate<"!Subtarget->hasCnMips()">,
AssemblerPredicate<"!FeatureCnMips">;
def IsSym32 : Predicate<"Subtarget->HasSym32()">,
def IsSym32 : Predicate<"Subtarget->hasSym32()">,
AssemblerPredicate<"FeatureSym32">;
def IsSym64 : Predicate<"!Subtarget->HasSym32()">,
def IsSym64 : Predicate<"!Subtarget->hasSym32()">,
AssemblerPredicate<"!FeatureSym32">;
def IsN64 : Predicate<"Subtarget->isABI_N64()">;
def IsNotN64 : Predicate<"!Subtarget->isABI_N64()">;
Expand Down
14 changes: 6 additions & 8 deletions llvm/test/CodeGen/Mips/indirect-jump-hazard/long-calls.ll
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,18 @@ define void @caller() {
; N64-NEXT: daddiu $25, $1, %lo(callee)
; N64-NEXT: jalr.hb $25
; N64-NEXT: nop
; N64-NEXT: daddiu $1, $zero, %higher(memset)
; N64-NEXT: lui $2, %highest(memset)
; N64-NEXT: daddu $1, $2, $1
; N64-NEXT: dsll $1, $1, 16
; N64-NEXT: lui $2, %hi(memset)
; N64-NEXT: daddu $1, $1, $2
; N64-NEXT: dsll $1, $1, 16
; N64-NEXT: daddiu $25, $1, %lo(memset)
; N64-NEXT: lui $1, %highest(val)
; N64-NEXT: daddiu $1, $1, %higher(val)
; N64-NEXT: dsll $1, $1, 16
; N64-NEXT: daddiu $1, $1, %hi(val)
; N64-NEXT: dsll $1, $1, 16
; N64-NEXT: lui $2, %highest(memset)
; N64-NEXT: daddiu $4, $1, %lo(val)
; N64-NEXT: daddiu $1, $2, %higher(memset)
; N64-NEXT: dsll $1, $1, 16
; N64-NEXT: daddiu $1, $1, %hi(memset)
; N64-NEXT: dsll $1, $1, 16
; N64-NEXT: daddiu $25, $1, %lo(memset)
; N64-NEXT: daddiu $5, $zero, 0
; N64-NEXT: jalr.hb $25
; N64-NEXT: daddiu $6, $zero, 80
Expand Down
6 changes: 4 additions & 2 deletions llvm/test/CodeGen/Mips/long-calls.ll
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ define void @caller() {
; ON64: daddiu $25, $1, %lo(callee)
; ON64: jalr $25

; ON64: daddiu $1, $zero, %higher(memset)
; ON64: lui $2, %highest(memset)
; ON64: lui $2, %hi(memset)
; ON64: daddiu $1, $2, %higher(memset)
; ON64: dsll $1, $1, 16
; ON64: daddiu $1, $1, %hi(memset)
; ON64: dsll $1, $1, 16
; ON64: daddiu $25, $1, %lo(memset)
; ON64: jalr $25

Expand Down
28 changes: 28 additions & 0 deletions llvm/test/CodeGen/Mips/pr42736.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
; RUN: llc -mtriple=mips64-linux-gnuabi64 \
; RUN: -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC
; RUN: llc -mtriple=mips64-linux-gnuabi64 \
; RUN: -relocation-model=static < %s | FileCheck %s -check-prefix=STATIC

define void @bar1() nounwind {
entry:
; PIC: lui $[[R0:[0-9]+]], 4095
; PIC-NEXT: ori $[[R0]], $[[R0]], 65535
; PIC-NEXT: ld $[[R1:[0-9]+]], %got_disp(foo)(${{[0-9]+}})
; PIC-NEXT: and $[[R1]], $[[R1]], $[[R0]]
; PIC-NEXT: sd $[[R1]]

; STATIC: lui $[[R0:[0-9]+]], 4095
; STATIC-NEXT: ori $[[R0]], $[[R0]], 65535
; STATIC-NEXT: daddiu $[[R1:[0-9]+]], $zero, %hi(foo)
; STATIC-NEXT: dsll $[[R1]], $[[R1]], 16
; STATIC-NEXT: daddiu $[[R1]], $[[R1]], %lo(foo)
; STATIC-NEXT: and $[[R0]], $[[R1]], $[[R0]]
; STATIC-NEXT: sd $[[R0]]

%val = alloca i64, align 8
store i64 and (i64 ptrtoint (void ()* @foo to i64), i64 268435455), i64* %val, align 8
%0 = load i64, i64* %val, align 8
ret void
}

declare void @foo()
9 changes: 8 additions & 1 deletion llvm/utils/TableGen/CodeGenTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,14 @@ CodeGenTarget::getSuperRegForSubReg(const ValueTypeByHwMode &ValueTy,
// Find and return the largest of our candidate classes.
llvm::stable_sort(Candidates, [&](const CodeGenRegisterClass *A,
const CodeGenRegisterClass *B) {
return A->getMembers().size() > B->getMembers().size();
if (A->getMembers().size() > B->getMembers().size())
return true;

if (A->getMembers().size() < B->getMembers().size())
return false;

// Order by name as a tie-breaker.
return StringRef(A->getName()) < B->getName();
});

return Candidates[0];
Expand Down