Skip to content

Commit

Permalink
Merged master:4589dd924dfc into amd-gfx:9a4c659a6ab9
Browse files Browse the repository at this point in the history
Local branch amd-gfx 9a4c659 Merged master:891759db73f into amd-gfx:64f77d560c5
Remote branch master 4589dd9 [mlir][DialectConversion] Enable deeper integration of type conversions
  • Loading branch information
Sw authored and Sw committed Jul 24, 2020
2 parents 9a4c659 + 4589dd9 commit 0d6feb7
Show file tree
Hide file tree
Showing 31 changed files with 995 additions and 183 deletions.
2 changes: 1 addition & 1 deletion lld/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ configure_lit_site_cfg(
set(LLD_TEST_DEPS lld)
if (NOT LLD_BUILT_STANDALONE)
list(APPEND LLD_TEST_DEPS
FileCheck count llc llvm-ar llvm-as llvm-bcanalyzer llvm-config llvm-cvtres
FileCheck count extract llc llvm-ar llvm-as llvm-bcanalyzer llvm-config llvm-cvtres
llvm-dis llvm-dwarfdump llvm-lib llvm-lipo llvm-mc llvm-nm llvm-objcopy
llvm-objdump llvm-pdbutil llvm-readelf llvm-readobj llvm-strip not obj2yaml
opt yaml2obj
Expand Down
19 changes: 12 additions & 7 deletions lld/test/ELF/linkerscript/noload.s
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
# RUN: echo "SECTIONS { \
# RUN: .data_noload_a (NOLOAD) : { *(.data_noload_a) } \
# RUN: .data_noload_b (0x10000) (NOLOAD) : { *(.data_noload_b) } \
# RUN: .no_input_sec_noload (NOLOAD) : { . += 1; } \
# RUN: .text (0x20000) : { *(.text) } };" > %t.script
# RUN: ld.lld -o %t --script %t.script %t.o
# RUN: extract asm %s -o %t.s && extract lds %s -o %t.lds
# RUN: llvm-mc -filetype=obj -triple=x86_64 %t.s -o %t.o
# RUN: ld.lld -o %t --script %t.lds %t.o
# RUN: llvm-readelf -S -l %t | FileCheck %s

# CHECK: Name Type Address Off Size
Expand All @@ -16,6 +12,7 @@
# CHECK: Type Offset VirtAddr PhysAddr
# CHECK-NEXT: LOAD 0x001000 0x0000000000020000 0x0000000000020000

#--- asm
.section .text,"ax",@progbits
nop

Expand All @@ -24,3 +21,11 @@

.section .data_noload_b,"aw",@progbits
.zero 4096

#--- lds
SECTIONS {
.data_noload_a (NOLOAD) : { *(.data_noload_a) }
.data_noload_b (0x10000) (NOLOAD) : { *(.data_noload_b) }
.no_input_sec_noload (NOLOAD) : { . += 1; }
.text (0x20000) : { *(.text) }
}
8 changes: 4 additions & 4 deletions lld/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
llvm_config.use_lld()

tool_patterns = [
'llc', 'llvm-as', 'llvm-mc', 'llvm-nm', 'llvm-objdump', 'llvm-pdbutil',
'llvm-dwarfdump', 'llvm-readelf', 'llvm-readobj', 'obj2yaml', 'yaml2obj',
'opt', 'llvm-dis']
'extract', 'llc', 'llvm-as', 'llvm-mc', 'llvm-nm', 'llvm-objdump',
'llvm-pdbutil', 'llvm-dwarfdump', 'llvm-readelf', 'llvm-readobj',
'obj2yaml', 'yaml2obj', 'opt', 'llvm-dis']

llvm_config.add_tool_substitutions(tool_patterns)

Expand Down Expand Up @@ -87,7 +87,7 @@
# Indirectly check if the mt.exe Microsoft utility exists by searching for
# cvtres, which always accompanies it. Alternatively, check if we can use
# libxml2 to merge manifests.
if (lit.util.which('cvtres', config.environment['PATH']) or
if (lit.util.which('cvtres', config.environment['PATH']) or
config.llvm_libxml2_enabled):
config.available_features.add('manifest_tool')

Expand Down
23 changes: 21 additions & 2 deletions llvm/docs/TestingGuide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,27 @@ adding your code there instead of creating a new file.
Extra files
-----------

If your test requires extra files besides the file containing the ``RUN:``
lines, the idiomatic place to put them is in a subdirectory ``Inputs``.
If your test requires extra files besides the file containing the ``RUN:`` lines
and the extra files are small, consider specifying them in the same file and
using ``extract`` to extract them. For example,

.. code-block:: llvm
; RUN: extract b %s -o %tb.ll
; RUN: extract a %s | llvm-link - %tb.ll -S | FileCheck %s
; CHECK: ...
;--- a
...
;--- b
...
The parts are separated by the regex ``^(.|//)--- <part>``. By default the
extracted content has leading empty lines to preserve line numbers. Specify
``--no-leading-lines`` to drop leading lines.

If the extra files are large, the idiomatic place to put them is in a subdirectory ``Inputs``.
You can then refer to the extra files as ``%S/Inputs/foo.bar``.

For example, consider ``test/Linker/ident.ll``. The directory structure is
Expand Down
27 changes: 12 additions & 15 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4912,7 +4912,8 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVectorImpl<SDValue> &LdChain,

int LdWidth = LdVT.getSizeInBits();
int WidthDiff = WidenWidth - LdWidth;
// Allow wider loads.
// Allow wider loads if they are sufficiently aligned to avoid memory faults
// and if the original load is simple.
unsigned LdAlign = (!LD->isSimple()) ? 0 : LD->getAlignment();

// Find the vector type that can load from.
Expand Down Expand Up @@ -4964,19 +4965,6 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVectorImpl<SDValue> &LdChain,
LD->getPointerInfo().getWithOffset(Offset),
LD->getOriginalAlign(), MMOFlags, AAInfo);
LdChain.push_back(L.getValue(1));
if (L->getValueType(0).isVector() && NewVTWidth >= LdWidth) {
// Later code assumes the vector loads produced will be mergeable, so we
// must pad the final entry up to the previous width. Scalars are
// combined separately.
SmallVector<SDValue, 16> Loads;
Loads.push_back(L);
unsigned size = L->getValueSizeInBits(0);
while (size < LdOp->getValueSizeInBits(0)) {
Loads.push_back(DAG.getUNDEF(L->getValueType(0)));
size += L->getValueSizeInBits(0);
}
L = DAG.getNode(ISD::CONCAT_VECTORS, dl, LdOp->getValueType(0), Loads);
}
} else {
L = DAG.getLoad(NewVT, dl, Chain, BasePtr,
LD->getPointerInfo().getWithOffset(Offset),
Expand Down Expand Up @@ -5017,8 +5005,17 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVectorImpl<SDValue> &LdChain,
EVT NewLdTy = LdOps[i].getValueType();
if (NewLdTy != LdTy) {
// Create a larger vector.
unsigned NumOps = NewLdTy.getSizeInBits() / LdTy.getSizeInBits();
assert(NewLdTy.getSizeInBits() % LdTy.getSizeInBits() == 0);
SmallVector<SDValue, 16> WidenOps(NumOps);
unsigned j = 0;
for (; j != End-Idx; ++j)
WidenOps[j] = ConcatOps[Idx+j];
for (; j != NumOps; ++j)
WidenOps[j] = DAG.getUNDEF(LdTy);

ConcatOps[End-1] = DAG.getNode(ISD::CONCAT_VECTORS, dl, NewLdTy,
makeArrayRef(&ConcatOps[Idx], End - Idx));
WidenOps);
Idx = End - 1;
LdTy = NewLdTy;
}
Expand Down
1 change: 1 addition & 0 deletions llvm/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ set(LLVM_TEST_DEPENDS
UnitTests
bugpoint
count
extract
llc
lli
lli-child-target
Expand Down
47 changes: 47 additions & 0 deletions llvm/test/CodeGen/X86/pr46820.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=avx512f | FileCheck %s

; The alignment of 16 causes type legalization to split this as 3 loads,
; v16f32, v4f32, and v4f32. This loads 24 elements, but the load is aligned
; to 16 bytes so this i safe. There was an issue with type legalization building
; the proper concat_vectors for this because the two v4f32s don't add up to
; v16f32 and require padding.

define <23 x float> @load23(<23 x float>* %p) {
; CHECK-LABEL: load23:
; CHECK: # %bb.0:
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: vmovups 64(%rsi), %ymm0
; CHECK-NEXT: vmovups (%rsi), %zmm1
; CHECK-NEXT: vmovaps 64(%rsi), %xmm2
; CHECK-NEXT: vmovss {{.*#+}} xmm3 = mem[0],zero,zero,zero
; CHECK-NEXT: vmovss %xmm3, 88(%rdi)
; CHECK-NEXT: vmovaps %xmm2, 64(%rdi)
; CHECK-NEXT: vmovaps %zmm1, (%rdi)
; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm0
; CHECK-NEXT: vmovlps %xmm0, 80(%rdi)
; CHECK-NEXT: vzeroupper
; CHECK-NEXT: retq
%t0 = load <23 x float>, <23 x float>* %p, align 16
ret <23 x float> %t0
}

; Same test as above with minimal alignment just to demonstrate the different
; codegen.
define <23 x float> @load23_align_1(<23 x float>* %p) {
; CHECK-LABEL: load23_align_1:
; CHECK: # %bb.0:
; CHECK-NEXT: movq %rdi, %rax
; CHECK-NEXT: vmovups (%rsi), %zmm0
; CHECK-NEXT: vmovups 64(%rsi), %xmm1
; CHECK-NEXT: movq 80(%rsi), %rcx
; CHECK-NEXT: vmovss {{.*#+}} xmm2 = mem[0],zero,zero,zero
; CHECK-NEXT: vmovss %xmm2, 88(%rdi)
; CHECK-NEXT: movq %rcx, 80(%rdi)
; CHECK-NEXT: vmovaps %xmm1, 64(%rdi)
; CHECK-NEXT: vmovaps %zmm0, (%rdi)
; CHECK-NEXT: vzeroupper
; CHECK-NEXT: retq
%t0 = load <23 x float>, <23 x float>* %p, align 1
ret <23 x float> %t0
}
1 change: 1 addition & 0 deletions llvm/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def get_asan_rtlib():
config.llvm_locstats_used = os.path.exists(llvm_locstats_tool)

tools = [
ToolSubst('%extract', FindTool('extract')),
ToolSubst('%lli', FindTool('lli'), post='.', extra_args=lli_args),
ToolSubst('%llc_dwarf', FindTool('llc'), extra_args=llc_args),
ToolSubst('%go', config.go_executable, unresolved='ignore'),
Expand Down
6 changes: 6 additions & 0 deletions llvm/test/tools/extract/Inputs/basic-aa.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@



aa
; BB-NOT: {{.}}
; BB: {{^}}bb{{$}}
10 changes: 10 additions & 0 deletions llvm/test/tools/extract/Inputs/basic-bb.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@







bb

// CC: // Comments are preserved.
32 changes: 32 additions & 0 deletions llvm/test/tools/extract/basic.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# AA-NOT: {{.}}
# AA: {{^}}aa{{$}}
#--- aa
aa
; BB-NOT: {{.}}
; BB: {{^}}bb{{$}}
;--- bb
bb

// CC: // Comments are preserved.
//--- cc
cc
// Comments are preserved.
;--- dup
;--- dup

# RUN: extract aa %s | diff %S/Inputs/basic-aa.txt -
# RUN: extract bb - < %s | diff %S/Inputs/basic-bb.txt -
# RUN: extract cc %s -o %t
# RUN: FileCheck %s --check-prefix=CC < %t

# RUN: not %extract aa 2>&1 | FileCheck %s --check-prefix=NO_INPUT

# NO_INPUT: extract: error: input filename is not specified

# RUN: not %extract dup %s 2>&1 | FileCheck %s --check-prefix=DUP

# DUP: extract: error: {{.*}}.test: ';--- dup' occurs more than once

# RUN: not %extract not_exist %s 2>&1 | FileCheck %s --check-prefix=NOT_EXIST

# NOT_EXIST: extract: error: {{.*}}.test: ';--- not_exist' was not found
5 changes: 5 additions & 0 deletions llvm/test/tools/extract/help.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RUN: extract --help 2>&1 | FileCheck --implicit-check-not='General Options:' %s
CHECK: OVERVIEW: Split input {{.*}}
CHECK: Generic Options:
CHECK: extract Options:
CHECK: -o
10 changes: 10 additions & 0 deletions llvm/test/tools/extract/no-leading-lines.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## With --no-leading-lines, don't add leading lines (which is used to preserve line numbers).

# RUN: extract --no-leading-lines input %s -o %t
# RUN: count 1 < %t
# RUN: FileCheck %s < %t

# CHECK: input

#--- input
input
14 changes: 9 additions & 5 deletions llvm/test/tools/gold/X86/multiple-sections.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
; RUN: echo ".text.tin" > %t_order_lto.txt
; RUN: echo ".text._start" >> %t_order_lto.txt
; RUN: echo ".text.pat" >> %t_order_lto.txt
; RUN: llvm-as %s -o %t.o
; RUN: extract order %s -o %t.order
; RUN: extract ir %s | llvm-as -o %t.o
; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \
; RUN: -m elf_x86_64 -o %t.exe %t.o \
; RUN: --section-ordering-file=%t_order_lto.txt
; RUN: --section-ordering-file=%t.order
; RUN: llvm-readelf -s %t.exe | FileCheck %s

; Check that the order of the sections is tin -> _start -> pat.
Expand All @@ -13,6 +11,12 @@
; CHECK: 00000000004000b0 1 FUNC LOCAL DEFAULT 1 tin
; CHECK: 00000000004000c0 15 FUNC GLOBAL DEFAULT 1 _start

;--- order
.text.tin
.text._start
.text.pat

;--- ir
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

Expand Down
19 changes: 12 additions & 7 deletions llvm/test/tools/llvm-objcopy/ELF/strip-symbol.test
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# RUN: yaml2obj %s -o %t
# RUN: extract yaml %s | yaml2obj - -o %t
# RUN: llvm-objcopy --strip-symbol baz -N bar %t %t2
# RUN: llvm-readobj --symbols --sections %t2 | FileCheck %s
# RUN: llvm-strip --strip-symbol baz -N bar %t -o %t3
# RUN: cmp %t2 %t3
# RUN: llvm-strip --regex --strip-symbol '^b.*' -N bar %t -o %t4
# RUN: cmp %t3 %t4
# RUN: echo " bar # bar" > %t-list.txt
# RUN: echo " baz # baz" >> %t-list.txt
# RUN: echo " # no symbol" >> %t-list.txt
# RUN: llvm-objcopy --strip-symbols %t-list.txt %t %t5
# RUN: extract list1 %s -o %t-list.txt && llvm-objcopy --strip-symbols %t-list.txt %t %t5
# RUN: cmp %t3 %t5
# RUN: echo "b.* # bar & baz" > %t-list2.txt
# RUN: llvm-objcopy --regex --strip-symbols %t-list2.txt %t %t6
# RUN: extract list2 %s -o %t-list2.txt && llvm-objcopy --regex --strip-symbols %t-list2.txt %t %t6
# RUN: cmp %t3 %t6

#--- list1
bar # bar
baz # baz
# no symbol

#--- list2
b.* # bar & baz

#--- yaml
!ELF
FileHeader:
Class: ELFCLASS64
Expand Down
23 changes: 13 additions & 10 deletions llvm/test/tools/llvm-strings/radix.test
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
## Show that llvm-strings can handle the -t/--radix switch properly.

RUN: echo one > %t
RUN: echo two >> %t
RUN: echo three >> %t
RUN: echo four >> %t
RUN: echo five >> %t
RUN: echo six >> %t
RUN: echo seven >> %t
RUN: echo eight >> %t
RUN: echo nine >> %t
RUN: echo ten >> %t
RUN: extract --no-leading-lines input %s -o %t
#--- input
one
two
three
four
five
six
seven
eight
nine
ten
#--- end

RUN: llvm-strings %t | FileCheck %s -check-prefix CHECK-NONE --implicit-check-not={{.}}
RUN: llvm-strings -t d %t | FileCheck %s -check-prefix CHECK-DEC --strict-whitespace --implicit-check-not={{.}}
Expand Down
19 changes: 19 additions & 0 deletions llvm/tools/extract/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- key: readability-identifier-naming.UnionCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
7 changes: 7 additions & 0 deletions llvm/tools/extract/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set(LLVM_LINK_COMPONENTS
Support
)

add_llvm_tool(extract
extract.cpp
)
Loading

0 comments on commit 0d6feb7

Please sign in to comment.