[GlobalISel][AArch64] LegalizerInfo verifier: Fixing bugs exposed by LegalizerInfo::verify(...)

Reviewers: aemerson, qcolombet

Reviewed By: qcolombet

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

llvm-svn: 333618
This commit is contained in:
Roman Tereshin 2018-05-31 01:56:05 +00:00
parent f811de484c
commit 5a65eb75c7
4 changed files with 12 additions and 21 deletions

View File

@ -212,9 +212,7 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST) {
// Extensions
getActionDefinitionsBuilder({G_ZEXT, G_SEXT, G_ANYEXT})
.legalFor({s1, s8, s16, s32, s64})
.maxScalar(0, s64)
.widenScalarToNextPow2(0);
.legalForCartesianProduct({s8, s16, s32, s64}, {s1, s8, s16, s32});
// FP conversions
getActionDefinitionsBuilder(G_FPTRUNC).legalFor(
@ -260,7 +258,7 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST) {
.unsupportedIf([&](const LegalityQuery &Query) {
return Query.Types[0].getSizeInBits() != Query.Types[1].getSizeInBits();
})
.legalFor({s64, p0});
.legalFor({{p0, s64}});
// Casts for 32 and 64-bit width type are just copies.
// Same for 128-bit width type, except they are on the FPR bank.
@ -280,19 +278,14 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST) {
.clampScalar(0, s8, s64)
.widenScalarToNextPow2(0, /*Min*/ 8);
if (ST.hasLSE()) {
getActionDefinitionsBuilder(G_ATOMIC_CMPXCHG)
.legalForCartesianProduct({s8, s16, s32, s64}, {p0});
}
if (ST.hasLSE()) {
getActionDefinitionsBuilder(G_ATOMIC_CMPXCHG_WITH_SUCCESS)
.lowerFor({s8, s16, s32, s64});
.lowerForCartesianProduct({s8, s16, s32, s64}, {s1}, {p0});
getActionDefinitionsBuilder(
{G_ATOMICRMW_XCHG, G_ATOMICRMW_ADD, G_ATOMICRMW_SUB, G_ATOMICRMW_AND,
G_ATOMICRMW_OR, G_ATOMICRMW_XOR, G_ATOMICRMW_MIN, G_ATOMICRMW_MAX,
G_ATOMICRMW_UMIN, G_ATOMICRMW_UMAX})
G_ATOMICRMW_UMIN, G_ATOMICRMW_UMAX, G_ATOMIC_CMPXCHG})
.legalForCartesianProduct({s8, s16, s32, s64}, {p0});
}

View File

@ -1,6 +1,5 @@
# RUN: not llc -mtriple=aarch64-- -run-pass=legalizer %s -o - 2>&1 | FileCheck %s
# REQUIRES: asserts
# XFAIL: *
# This is to demonstrate what kind of bugs we're missing w/o some kind
# of validation for LegalizerInfo: G_INTTOPTR could only be legal /

View File

@ -1,6 +1,5 @@
# RUN: not llc -mtriple=aarch64-- -run-pass=legalizer %s -o - 2>&1 | FileCheck %s
# REQUIRES: asserts
# XFAIL: *
# This is to demonstrate what kind of bugs we're missing w/o some kind
# of validation for LegalizerInfo: G_INTTOPTR could only be legal /

View File

@ -1,8 +1,8 @@
# RUN: llc -mtriple=aarch64-- -run-pass=legalizer %s \
# RUN: -mcpu=cortex-a75 -o - 2>&1 | FileCheck %s --check-prefixes=CHECK --match-full-lines
# RUN: -mcpu=cortex-a75 -o - 2>&1 | FileCheck %s --check-prefixes=CHECK
# RUN: llc -mtriple=aarch64-- -run-pass=legalizer %s -debug-only=legalizer-info \
# RUN: -mcpu=cortex-a75 -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,DEBUG --match-full-lines
# RUN: -mcpu=cortex-a75 -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,DEBUG
# REQUIRES: asserts
@ -73,7 +73,7 @@
# DEBUG: .. the first uncovered type index: 2, OK
#
# DEBUG-NEXT: G_INTTOPTR (opcode {{[0-9]+}}): 2 type indices
# DEBUG: .. the first uncovered type index: 1, FAIL
# DEBUG: .. the first uncovered type index: 2, OK
#
# DEBUG-NEXT: G_BITCAST (opcode {{[0-9]+}}): 2 type indices
# DEBUG: .. the first uncovered type index: 2, OK
@ -91,7 +91,7 @@
# DEBUG: .. type index coverage check SKIPPED: user-defined predicate detected
#
# DEBUG-NEXT: G_ATOMIC_CMPXCHG_WITH_SUCCESS (opcode {{[0-9]+}}): 3 type indices
# DEBUG: .. the first uncovered type index: 1, FAIL
# DEBUG: .. the first uncovered type index: 3, OK
#
# DEBUG-NEXT: G_ATOMIC_CMPXCHG (opcode {{[0-9]+}}): 2 type indices
# DEBUG: .. the first uncovered type index: 2, OK
@ -142,7 +142,7 @@
# DEBUG: .. type index coverage check SKIPPED: no rules defined
#
# DEBUG-NEXT: G_ANYEXT (opcode {{[0-9]+}}): 2 type indices
# DEBUG: .. the first uncovered type index: 1, FAIL
# DEBUG: .. the first uncovered type index: 2, OK
#
# DEBUG-NEXT: G_TRUNC (opcode {{[0-9]+}}): 2 type indices
# DEBUG: .. type index coverage check SKIPPED: no rules defined
@ -160,10 +160,10 @@
# DEBUG: .. the first uncovered type index: 2, OK
#
# DEBUG-NEXT: G_SEXT (opcode {{[0-9]+}}): 2 type indices
# DEBUG: .. the first uncovered type index: 1, FAIL
# DEBUG: .. the first uncovered type index: 2, OK
#
# DEBUG-NEXT: G_ZEXT (opcode {{[0-9]+}}): 2 type indices
# DEBUG: .. the first uncovered type index: 1, FAIL
# DEBUG: .. the first uncovered type index: 2, OK
#
# DEBUG-NEXT: G_SHL (opcode {{[0-9]+}}): 1 type index
# DEBUG: .. the first uncovered type index: 1, OK
@ -285,7 +285,7 @@
# DEBUG-NEXT: G_BSWAP (opcode {{[0-9]+}}): 1 type index
# DEBUG: .. the first uncovered type index: 1, OK
# CHECK: The following opcodes have ill-defined legalization rules: G_INTTOPTR G_ATOMIC_CMPXCHG_WITH_SUCCESS G_ANYEXT G_SEXT G_ZEXT
# CHECK-NOT: ill-defined
---
name: dummy