platform/upstream/llvm.git
8 years agoRemove unnecessary cast.
Rafael Espindola [Mon, 21 Dec 2015 20:50:51 +0000 (20:50 +0000)]
Remove unnecessary cast.

llvm-svn: 256196

8 years agoRemove simple uses of Base::.
Rafael Espindola [Mon, 21 Dec 2015 20:47:33 +0000 (20:47 +0000)]
Remove simple uses of Base::.

They have a tendency to get out of date and obscure where the value/type
is from.

llvm-svn: 256195

8 years ago[X86][SSE] Transform truncations between vectors of integers into X86ISD::PACKUS...
Cong Hou [Mon, 21 Dec 2015 20:42:43 +0000 (20:42 +0000)]
[X86][SSE] Transform truncations between vectors of integers into X86ISD::PACKUS/PACKSS operations during DAG combine.

This patch transforms truncation between vectors of integers into
X86ISD::PACKUS/PACKSS operations during DAG combine. We don't do it in
lowering phase because after type legalization, the original truncation
will be turned into a BUILD_VECTOR with each element that is extracted
from a vector and then truncated, and from them it is difficult to do
this optimization. This greatly improves the performance of truncations
on some specific types.

Cost table is updated accordingly.

Differential revision: http://reviews.llvm.org/D14588

llvm-svn: 256194

8 years ago[PGO] Fix profile var comdat generation problem with COFF
Xinliang David Li [Mon, 21 Dec 2015 20:41:20 +0000 (20:41 +0000)]
[PGO] Fix profile var comdat generation problem with COFF

When targeting COFF, it is required that a comdat section to
have a global obj with the same name as the comdat (except for
comdats with select kind to be associative). This fix makes
sure that the comdat is keyed on the data variable for COFF.

Also improved test coverage for this.

llvm-svn: 256193

8 years ago[ValueTracking] Properly handle non-sized types in isAligned function.
Michael Zolotukhin [Mon, 21 Dec 2015 20:38:18 +0000 (20:38 +0000)]
[ValueTracking] Properly handle non-sized types in isAligned function.

Reviewers: apilipenko, reames, sanjoy, hfinkel

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15597

llvm-svn: 256192

8 years agoTweak myriad-toolchain test.
James Y Knight [Mon, 21 Dec 2015 20:30:49 +0000 (20:30 +0000)]
Tweak myriad-toolchain test.

The test failed when run on a SPARC host, since it was finding the
native gcc installation by accident.

llvm-svn: 256191

8 years agoReapply "[CodeGen] Fix assignments of inline layouts into the byref structure"
Vedant Kumar [Mon, 21 Dec 2015 20:21:15 +0000 (20:21 +0000)]
Reapply "[CodeGen] Fix assignments of inline layouts into the byref structure"

When using blocks, a byref structure is created to represent the
closure. The "byref.layout" field of this structure is an i8*. However,
some 'inline' layouts are represented as i64's, not i8*'s.

Prior to r246985 we cast the i64 'inline' layout to an i8* before
assigning it into the byref structure. This patch brings the cast back
and adds a regression test.

The original version of this patch was too invasive. This version only adds the
cast to BuildByrefLayout.

Differential Revision: http://reviews.llvm.org/D15674

rdar://23713871

llvm-svn: 256190

8 years agoRemove unnecessary cast.
Rafael Espindola [Mon, 21 Dec 2015 20:18:04 +0000 (20:18 +0000)]
Remove unnecessary cast.

llvm-svn: 256189

8 years agoFix PR24563 (LiveDebugVariables unconditionally propagates all DBG_VALUEs)
Adrian Prantl [Mon, 21 Dec 2015 20:03:00 +0000 (20:03 +0000)]
Fix PR24563 (LiveDebugVariables unconditionally propagates all DBG_VALUEs)

LiveDebugVariables unconditionally propagates all DBG_VALUE down the
dominator tree, which happens to work fine if there already is another
DBG_VALUE or the DBG_VALUE happends to describe a single-assignment vreg
but is otherwise wrong if the DBG_VALUE is coming from only one of the
predecessors.

In r255759 we introduced a proper data flow analysis scheduled after
LiveDebugVariables that correctly propagates DBG_VALUEs across basic block
boundaries. With the new pass in place, the incorrect propagation in
LiveDebugVariables can be retired witout loosing any of the benefits
where LiveDebugVariables happened to do the right thing.

llvm-svn: 256188

8 years agoConvert the CodeGen/ARM/sched-it-debug-nodes.ll testcase from IR -> MIR.
Adrian Prantl [Mon, 21 Dec 2015 19:44:42 +0000 (19:44 +0000)]
Convert the CodeGen/ARM/sched-it-debug-nodes.ll testcase from IR -> MIR.
NFC
PR24563

llvm-svn: 256187

8 years agoRevert "[CodeGen] Fix assignments of inline layouts into the byref structure"
Vedant Kumar [Mon, 21 Dec 2015 19:43:25 +0000 (19:43 +0000)]
Revert "[CodeGen] Fix assignments of inline layouts into the byref structure"

This reverts commit r256185. It breaks CodeGenObjC/fragile-arc.m.

llvm-svn: 256186

8 years ago[CodeGen] Fix assignments of inline layouts into the byref structure
Vedant Kumar [Mon, 21 Dec 2015 19:30:37 +0000 (19:30 +0000)]
[CodeGen] Fix assignments of inline layouts into the byref structure

When using blocks, a byref structure is created to represent the
closure. The "byref.layout" field of this structure is an i8*. However,
some 'inline' layouts are represented as i64's, not i8*'s.

Prior to r246985 we cast the i64 'inline' layout to an i8* before
assigning it into the byref structure. This patch brings the cast back
and adds a regression test.

rdar://23713871

llvm-svn: 256185

8 years ago[compiler-rt] [tsan] Add support for PIE build on AArch64
Adhemerval Zanella [Mon, 21 Dec 2015 19:27:57 +0000 (19:27 +0000)]
[compiler-rt] [tsan] Add support for PIE build on AArch64

This patch adds PIE executable support for aarch64-linux.  It adds
two more segments:

- 0x05500000000-0x05600000000: 39-bits PIE program segments
- 0x2aa00000000-0x2ab00000000: 42-bits PIE program segments

Fortunately it is possible to use the same transformation formula for
the new segments range with some adjustments in shadow to memory
formula (it adds a constant offset based on the VMA size).

A simple testcase is also added, however it is disabled on x86 due the
fact it might fail on newer kernels [1].

[1] https://git.kernel.org/linus/d1fd836dcf00d2028c700c7e44d2c23404062c90

llvm-svn: 256184

8 years agoTeach ARMLoadStoreOptimizer to ignore DBG_VALUE instructions when merging
Adrian Prantl [Mon, 21 Dec 2015 19:25:03 +0000 (19:25 +0000)]
Teach ARMLoadStoreOptimizer to ignore DBG_VALUE instructions when merging
instructions.

As noted in PR24563.
rdar://problem/23963293

llvm-svn: 256183

8 years ago[asan] fix fopen interceptor to not crash if path is NULL
Kostya Serebryany [Mon, 21 Dec 2015 19:22:26 +0000 (19:22 +0000)]
[asan] fix fopen interceptor to not crash if path is NULL

llvm-svn: 256182

8 years agoDelete dead typedefs.
Rafael Espindola [Mon, 21 Dec 2015 19:10:27 +0000 (19:10 +0000)]
Delete dead typedefs.

llvm-svn: 256181

8 years agoRefactor duplicated code. NFC.
Rafael Espindola [Mon, 21 Dec 2015 19:09:19 +0000 (19:09 +0000)]
Refactor duplicated code. NFC.

llvm-svn: 256180

8 years agofix leak in a test, make the sanitizer bot green
Kostya Serebryany [Mon, 21 Dec 2015 19:09:01 +0000 (19:09 +0000)]
fix leak in a test, make the sanitizer bot green

llvm-svn: 256179

8 years agoAMDGPU/SI: Fix encoding for FLAT_SCRATCH registers on VI
Tom Stellard [Mon, 21 Dec 2015 18:44:27 +0000 (18:44 +0000)]
AMDGPU/SI: Fix encoding for FLAT_SCRATCH registers on VI

Summary:
These register has different encodings on CI and VI, so we add pseudo
FLAT_SCRACTH registers to be used before MC, and subtarget specific
registers to be used by the MC layer.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D15661

llvm-svn: 256178

8 years agoAMDGPU/SI: Change assembly name for flat scratch registers to flat_scratch
Tom Stellard [Mon, 21 Dec 2015 18:44:21 +0000 (18:44 +0000)]
AMDGPU/SI: Change assembly name for flat scratch registers to flat_scratch

This matches what the assembler accepts.

llvm-svn: 256177

8 years ago[AArch64] Add additional extract-extend patterns for smov
Matthew Simpson [Mon, 21 Dec 2015 18:31:25 +0000 (18:31 +0000)]
[AArch64] Add additional extract-extend patterns for smov

This patch adds to the target description two additional patterns for matching
extract-extend operations to SMOV. The patterns catch the v16i8-to-i64 and
v8i16-to-i64 cases. The existing patterns miss these cases because the
extracted elements must first be legalized to i32, resulting in any_extend
nodes.

This was originally implemented as a DAG combine (r255895), but was reverted
due to failing out-of-tree tests.

llvm-svn: 256176

8 years agoclang-format: Properly set the BlockKind for more blocks.
Daniel Jasper [Mon, 21 Dec 2015 18:31:15 +0000 (18:31 +0000)]
clang-format: Properly set the BlockKind for more blocks.

Before:
  void f() { struct Dummy { };
    f();
  }

After:
  void f() {
    struct Dummy {};
    f();
  }

llvm-svn: 256175

8 years agoAdd testcase for r256161 (PR25907)
Teresa Johnson [Mon, 21 Dec 2015 18:24:35 +0000 (18:24 +0000)]
Add testcase for r256161 (PR25907)

llvm-svn: 256174

8 years agoRemove extra whitespace. NFC.
Chad Rosier [Mon, 21 Dec 2015 18:08:05 +0000 (18:08 +0000)]
Remove extra whitespace. NFC.

llvm-svn: 256173

8 years ago[ELF][MIPS] Support some of R_MIPS_PCxxx relocations
Simon Atanasyan [Mon, 21 Dec 2015 17:36:40 +0000 (17:36 +0000)]
[ELF][MIPS] Support some of R_MIPS_PCxxx relocations

The patch adds support for R_MIPS_PC16, R_MIPS_PC19_S2, R_MIPS_PC21_S2,
R_MIPS_PC26_S2, R_MIPS_PCHI16, R_MIPS_PCLO16 relocations handling.

llvm-svn: 256172

8 years ago[ThinLTO] Rename variable to reflect bulk importing change (NFC)
Teresa Johnson [Mon, 21 Dec 2015 17:33:24 +0000 (17:33 +0000)]
[ThinLTO] Rename variable to reflect bulk importing change (NFC)

llvm-svn: 256171

8 years agoclang-format: Only consider the first #include that looks right to be
Daniel Jasper [Mon, 21 Dec 2015 17:28:24 +0000 (17:28 +0000)]
clang-format: Only consider the first #include that looks right to be
the main #include.

llvm-svn: 256170

8 years ago[WebAssembly] Convert a regular for loop to a range-based for loop.
Dan Gohman [Mon, 21 Dec 2015 17:22:02 +0000 (17:22 +0000)]
[WebAssembly] Convert a regular for loop to a range-based for loop.

llvm-svn: 256169

8 years ago[WebAssembly] Clean up comments and fix a missing #include dependency.
Dan Gohman [Mon, 21 Dec 2015 17:19:31 +0000 (17:19 +0000)]
[WebAssembly] Clean up comments and fix a missing #include dependency.

llvm-svn: 256168

8 years ago[WebAssembly] Remove an unneeded empty destructor.
Dan Gohman [Mon, 21 Dec 2015 17:12:40 +0000 (17:12 +0000)]
[WebAssembly] Remove an unneeded empty destructor.

llvm-svn: 256167

8 years ago[WebAssembly] Enclose the operand variables for load and store instructions in braces.
Dan Gohman [Mon, 21 Dec 2015 16:58:49 +0000 (16:58 +0000)]
[WebAssembly] Enclose the operand variables for load and store instructions in braces.

This allows the AsmMatcherEmitter to properly tokenize the AsmStrings for
load and store instructions. This is a step towards asm parsing.

llvm-svn: 256166

8 years ago[WebAssembly] Mark the ARGUMENT pseudo-instructions as CodeGenOnly.
Dan Gohman [Mon, 21 Dec 2015 16:53:29 +0000 (16:53 +0000)]
[WebAssembly] Mark the ARGUMENT pseudo-instructions as CodeGenOnly.

llvm-svn: 256165

8 years ago[WebAssembly] Add some comments and make some minor source cleanups.
Dan Gohman [Mon, 21 Dec 2015 16:50:41 +0000 (16:50 +0000)]
[WebAssembly] Add some comments and make some minor source cleanups.

llvm-svn: 256164

8 years agoTeach MCOperand::print how to print FPImm operands.
Dan Gohman [Mon, 21 Dec 2015 16:47:10 +0000 (16:47 +0000)]
Teach MCOperand::print how to print FPImm operands.

llvm-svn: 256163

8 years agoRemove unused functions from ModuleLinker (NFC)
Teresa Johnson [Mon, 21 Dec 2015 15:49:59 +0000 (15:49 +0000)]
Remove unused functions from ModuleLinker (NFC)

Remove a couple ModuleLinker methods and a related static function that
are no longer used after the linker split.

llvm-svn: 256162

8 years agoRemove overly strict new assert in BitcodeReader.
Teresa Johnson [Mon, 21 Dec 2015 15:38:13 +0000 (15:38 +0000)]
Remove overly strict new assert in BitcodeReader.

This fixes a bug introduced by the ThinLTO metadata linking patch
r255909. The assert is overly-strict and while useful in development of
the patch, doesn't seem interesting to keep.

Fixes PR25907.

llvm-svn: 256161

8 years agoRevert "[AArch64] Promote loads from stores"
Jun Bum Lim [Mon, 21 Dec 2015 15:36:49 +0000 (15:36 +0000)]
Revert "[AArch64] Promote loads from stores"

This reverts commit r256004 due to a failure in cortex-a53.

llvm-svn: 256160

8 years ago[LIR] Refactor code to enable future patch. NFC.
Chad Rosier [Mon, 21 Dec 2015 14:49:32 +0000 (14:49 +0000)]
[LIR] Refactor code to enable future patch. NFC.

llvm-svn: 256159

8 years ago[AArch64] Enable PostRAScheduler for AArch64 generic build.
Chad Rosier [Mon, 21 Dec 2015 14:43:45 +0000 (14:43 +0000)]
[AArch64] Enable PostRAScheduler for AArch64 generic build.

Disable post-ra scheduler for perturbed tests to appease the bots and to
preserve the history of the tests.

http://reviews.llvm.org/D15652

llvm-svn: 256158

8 years agoAVX512BW: Enable AND/OR/XOR vector byte/word paked operation by promoting to qword...
Igor Breger [Mon, 21 Dec 2015 14:40:36 +0000 (14:40 +0000)]
AVX512BW: Enable AND/OR/XOR vector byte/word paked operation by promoting to qword that natively suppored.

llvm-svn: 256157

8 years ago[llvm-objdump] Use appropriate helper. NFC.
Davide Italiano [Mon, 21 Dec 2015 14:10:54 +0000 (14:10 +0000)]
[llvm-objdump] Use appropriate helper. NFC.

llvm-svn: 256156

8 years agoImplemented Support of IA interrupt and exception handlers:
Amjad Aboud [Mon, 21 Dec 2015 14:07:14 +0000 (14:07 +0000)]
Implemented Support of IA interrupt and exception handlers:
http://lists.llvm.org/pipermail/cfe-dev/2015-September/045171.html

Differential Revision: http://reviews.llvm.org/D15567

llvm-svn: 256155

8 years agoclang-format: [JS] Change Google-style default for aligning operands.
Daniel Jasper [Mon, 21 Dec 2015 13:52:19 +0000 (13:52 +0000)]
clang-format: [JS] Change Google-style default for aligning operands.

The style guide allows both, but apparently, this is the more dominant use.

llvm-svn: 256154

8 years agoclang-format: Only try to find the "main" include in the first block of
Daniel Jasper [Mon, 21 Dec 2015 13:40:49 +0000 (13:40 +0000)]
clang-format: Only try to find the "main" include in the first block of
includes.

llvm-svn: 256153

8 years ago[mips][microMIPS] Implement DERET and DI instructions and check size operand for...
Zlatko Buljan [Mon, 21 Dec 2015 13:08:58 +0000 (13:08 +0000)]
[mips][microMIPS] Implement DERET and DI instructions and check size operand for EXT and DEXT* instructions
Differential Revision: http://reviews.llvm.org/D15570

llvm-svn: 256152

8 years agoAdjust formatting to clang-format changes in 256149
Tobias Grosser [Mon, 21 Dec 2015 12:38:56 +0000 (12:38 +0000)]
Adjust formatting to clang-format changes in 256149

llvm-svn: 256151

8 years ago[scan-view] replace deprecated optparse with argparse
Alexander Kornienko [Mon, 21 Dec 2015 12:19:13 +0000 (12:19 +0000)]
[scan-view] replace deprecated optparse with argparse

Summary: scan-view migrated from optparse deprecated Python module to its replacement (argparse) and resolved few conflicts with pep8

Reviewers: ddunbar, aaron.ballman, dcoughlin, jroelofs, zaks.anna

Subscribers: cfe-commits

Patch by Kirill Bobyrev!

Differential Revision: http://reviews.llvm.org/D15370

llvm-svn: 256150

8 years agoScopDetect: Extract profitability check into subfunction
Tobias Grosser [Mon, 21 Dec 2015 12:14:48 +0000 (12:14 +0000)]
ScopDetect: Extract profitability check into subfunction

.. and add some documentation. We also simplify the code by dropping an early
check that is also covered by the the later checks. This might have a small
compile time impact, but as the scops that are skipped are small we should
probably only add this back in the unlikely case that this has a notable
compile-time cost.

No functional change intended.

llvm-svn: 256149

8 years agoclang-format: Extend detection of the "main" #include to use the filename
Daniel Jasper [Mon, 21 Dec 2015 12:14:17 +0000 (12:14 +0000)]
clang-format: Extend detection of the "main" #include to use the filename

Before, the first (non-system) header in a file was considered to be
the main include. This is conservative as it makes clang-format change
the #include order less often. Instead implement some basic usage of
the filename itself. With this patch, clang-format considers every
header to be a main include if the header file's basename is a prefix
to the filename the #include is in.

llvm-svn: 256148

8 years agoFix emulation of the thumb str instruction
Tamas Berghammer [Mon, 21 Dec 2015 12:06:36 +0000 (12:06 +0000)]
Fix emulation of the thumb str instruction

llvm-svn: 256147

8 years ago[Driver] Pass -O* to the gold plugin via -plugin-opt
James Molloy [Mon, 21 Dec 2015 10:44:36 +0000 (10:44 +0000)]
[Driver] Pass -O* to the gold plugin via -plugin-opt

The gold plugin understands -O0..-O3, but these are not currently being passed to it.

llvm-svn: 256146

8 years ago[ELF] - fixed not properly handled @GOTTPOFF relocation against local symbols
George Rimar [Mon, 21 Dec 2015 10:37:33 +0000 (10:37 +0000)]
[ELF] - fixed not properly handled @GOTTPOFF relocation against local symbols

This patch changes sequence of applying relocations, moving tls optimized relocation handling code before code for other locals.
Without that change relocation @GOTTPOFF against local symbol caused runtime error ("unrecognized reloc ...").
That change also should fix other tls optimized relocations, but I did not check them, that's a field for another patch.

R_X86_64_GOTTPOFF relocations against locals can be found when linking against libc.a(malloc.o):
000000000036 000600000016 R_X86_64_GOTTPOFF 0000000000000000 libc_tsd_MALLOC - 4
000000000131 000600000016 R_X86_64_GOTTPOFF 0000000000000000 libc_tsd_MALLOC - 4

Differential revision: http://reviews.llvm.org/D15581

llvm-svn: 256145

8 years ago[ELF] - Implemented R_*_IRELATIVE relocations for x86, x64 targets.
George Rimar [Mon, 21 Dec 2015 10:12:06 +0000 (10:12 +0000)]
[ELF] - Implemented R_*_IRELATIVE relocations for x86, x64 targets.

This relocation is similar to R_*_RELATIVE except that the value used in this relocation is the program address returned by the function, which takes no arguments, at the address of
the result of the corresponding R_*_RELATIVE relocation as specified in the processor-specific ABI. The purpose of this relocation to avoid name lookup for locally defined STT_GNU_IFUNC symbols at load-time.

More info can be found in ifunc.txt from https://sites.google.com/site/x32abi/documents.

Differential revision: http://reviews.llvm.org/D15235

llvm-svn: 256144

8 years ago[ELF] - R_386_GOTOFF relocation implemented.
George Rimar [Mon, 21 Dec 2015 10:00:12 +0000 (10:00 +0000)]
[ELF] - R_386_GOTOFF relocation implemented.

R_386_GOTOFF is calculated as S + A - GOT, where:
S - Represents the value of the symbol whose index resides in the relocation entry.
A - Represents the addend used to compute the value of the relocatable field.
GOT - Represents the address of the global offset table.

Differential revision: http://reviews.llvm.org/D15383

llvm-svn: 256143

8 years agoFix a false positive case in ContainerSizeEmpty check (PR25893).
Gabor Horvath [Mon, 21 Dec 2015 09:43:52 +0000 (09:43 +0000)]
Fix a false positive case in ContainerSizeEmpty check (PR25893).

llvm-svn: 256142

8 years ago[ELF] - Fixed padding for CIE/FDE entries of .eh_frame section
George Rimar [Mon, 21 Dec 2015 09:38:59 +0000 (09:38 +0000)]
[ELF] - Fixed padding for CIE/FDE entries of .eh_frame section

Spec says both CIE/FDE has "Padding
Extra bytes to align the CIE structure to an addressing unit size boundary."
https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehframechpt.html

Patch aligns CIE/FDE entries to the size of platform pointer.

Differential revision: http://reviews.llvm.org/D15637

llvm-svn: 256141

8 years agoScopInfo: Return immediately if scop is unprofitable and marked invalid
Tobias Grosser [Mon, 21 Dec 2015 09:09:44 +0000 (09:09 +0000)]
ScopInfo: Return immediately if scop is unprofitable and marked invalid

As we already log an error when calling invalid, scops unprofitable scops are in
any case marked invalid, but returning immediately safes (a tiny bit of) compile
time and is consistent with our use of 'invalid' in the remainder of the file.

Found by inspection.

llvm-svn: 256140

8 years agoScopInfo: Return in case we found an invalid array size
Tobias Grosser [Mon, 21 Dec 2015 09:09:39 +0000 (09:09 +0000)]
ScopInfo: Return in case we found an invalid array size

Without this return we still log the incorrect array size (and do not detect
this scop), but we would unnecessarily continue to verify that access functions
are affine. As we do not need to do this, we can return right ahead and
consequently safe compile time.

This issue was found by inspection.

llvm-svn: 256139

8 years agocheck-llvm: Tweak the feature "timestamps" for autoconf.
NAKAMURA Takumi [Mon, 21 Dec 2015 08:46:12 +0000 (08:46 +0000)]
check-llvm: Tweak the feature "timestamps" for autoconf.

Note, ENABLE_TIMESTAMPS is either 1 or 0 in Makefile.config.

llvm-svn: 256138

8 years ago[MC, COFF] Unbreak support for COFF timestamps
David Majnemer [Mon, 21 Dec 2015 08:03:07 +0000 (08:03 +0000)]
[MC, COFF] Unbreak support for COFF timestamps

Support for COFF timestamps was unintentionally broken in r246905 when
it was conditionally available depending on whether or not LLVM was
configured with LLVM_ENABLE_TIMESTAMPS.  However, Config/config.h was
never included which essentially broke the feature.  Due to lax testing,
the breakage was never identified until we observed strange failures
during incremental links of Chromium.

This issue is resolved by simply including Config/config.h in
WinCOFFObjectWriter and teaching lit that the MC/COFF/timestamp.s test
is conditionally supported depending on LLVM_ENABLE_TIMESTAMPS.  With
this in place, we can strengthen the test to ensure that it will not
accidentally get broken in the future.

This fixes PR25891.

llvm-svn: 256137

8 years agoScopInfo: Check for the existance of a single memory accesses
Tobias Grosser [Mon, 21 Dec 2015 07:10:39 +0000 (07:10 +0000)]
ScopInfo: Check for the existance of a single memory accesses

Instead of counting all array memory accesses associated with a load
instruction, we now explicitly check that the single array access that could
(potentially) be associated with a load instruction does not exist. This helps
to document the current behavior of Polly where load instructions can indeed
have at most one associated array access. In the unlikely case this changes
in the future, we add an assert for the case where two load accesses would
prevent us to return a single memory access, but we still should communicate
that not all array memory accesses have been removed.

This addresses post-commit comments from Johannes Doerfert for commit 255776.

llvm-svn: 256136

8 years ago[Sema] Use range-based for loops. NFC
Craig Topper [Mon, 21 Dec 2015 06:35:56 +0000 (06:35 +0000)]
[Sema] Use range-based for loops. NFC

llvm-svn: 256135

8 years ago[Cygwin] Enable TLS as emutls.
NAKAMURA Takumi [Mon, 21 Dec 2015 02:37:23 +0000 (02:37 +0000)]
[Cygwin] Enable TLS as emutls.

It resolves clang selfhosting with std::once() for Cygwin.

FIXME: It may be EmulatedTLS-generic also for X86-Android.
FIXME: Pass EmulatedTLS to LLVM CodeGen from Clang with -femulated-tls.
llvm-svn: 256134

8 years agocheck-clang-tools requires clang-headers due to test/clang-tidy.
NAKAMURA Takumi [Mon, 21 Dec 2015 01:35:28 +0000 (01:35 +0000)]
check-clang-tools requires clang-headers due to test/clang-tidy.

clang-modernize provided clang-headers but it was removed.

llvm-svn: 256133

8 years ago[RS4GC] Add an assert which fails if there is a (yet unsupported) addrspacecast.
Manuel Jacob [Mon, 21 Dec 2015 01:26:46 +0000 (01:26 +0000)]
[RS4GC] Add an assert which fails if there is a (yet unsupported) addrspacecast.

The slightly strange indentation comes from clang-format.

llvm-svn: 256132

8 years ago[InstCombine] Fix indentation. NFC.
Craig Topper [Mon, 21 Dec 2015 01:02:28 +0000 (01:02 +0000)]
[InstCombine] Fix indentation. NFC.

llvm-svn: 256131

8 years ago[AVR] Added AVRCallingConv.td
Dylan McKay [Sun, 20 Dec 2015 23:17:44 +0000 (23:17 +0000)]
[AVR] Added AVRCallingConv.td

llvm-svn: 256130

8 years ago[PGO] testing _WIN64 instead of _WIN32
Xinliang David Li [Sun, 20 Dec 2015 19:55:15 +0000 (19:55 +0000)]
[PGO] testing _WIN64 instead of _WIN32

llvm-svn: 256129

8 years ago[PGO] Implement BOOL_CMPXCHG for Windows
Xinliang David Li [Sun, 20 Dec 2015 19:11:44 +0000 (19:11 +0000)]
[PGO] Implement BOOL_CMPXCHG for Windows

llvm-svn: 256128

8 years ago[X86] Use range-based for loop. NFC
Craig Topper [Sun, 20 Dec 2015 18:41:57 +0000 (18:41 +0000)]
[X86] Use range-based for loop. NFC

llvm-svn: 256127

8 years ago[X86] Prevent constant hoisting for a couple compare immediates that the selection...
Craig Topper [Sun, 20 Dec 2015 18:41:54 +0000 (18:41 +0000)]
[X86] Prevent constant hoisting for a couple compare immediates that the selection DAG knows how to optimize into a shift.

This allows "icmp ugt %a, 4294967295" and "icmp uge %a, 4294967296" to be optimized into right shifts by 32 which can fold the immediate into the shift instruction. These patterns show up with some regularity in real code.

Unfortunately, since getImmCost can't see the icmp predicate we can't be tell if we're only catching these specific cases.

llvm-svn: 256126

8 years ago[FIX] Schedule generation for block exiting multiple loops.
Johannes Doerfert [Sun, 20 Dec 2015 17:12:22 +0000 (17:12 +0000)]
[FIX] Schedule generation for block exiting multiple loops.

  This fixes bug PR25604.

llvm-svn: 256125

8 years agoCompile fix: Use "&&" operator instead of "and"
Michael Kruse [Sun, 20 Dec 2015 14:42:32 +0000 (14:42 +0000)]
Compile fix: Use "&&" operator instead of "and"

llvm-svn: 256124

8 years agoScopInfo: Bail out in case of complex branch structures
Tobias Grosser [Sun, 20 Dec 2015 13:31:48 +0000 (13:31 +0000)]
ScopInfo: Bail out in case of complex branch structures

Scops that contain many complex branches are likely to result in complex domain
conditions that consist of a large (> 100) number of conjucts.  Transforming
such domains is expensive and unlikely to result in efficient code.  To avoid
long compile times we detect this case and skip such scops. In the future we may
improve this by either using non-affine subregions to hide such complex
condition structures or by exploiting in certain cases properties (e.g.,
dominance) that allow us to construct the domains of a scop in a way that
results in a smaller number improving conjuncts.

Example of a code that results in complex iteration spaces:

      loop.header
     /    |    \ \
   A0    A2    A4 \
     \  /  \  /    \
      A1    A3      \
     /  \  /  \     |
   B0    B2    B4   |
     \  /  \  /     |
      B1    B3      ^
     /  \  /  \     |
   C0    C2    C4   |
     \  /  \  /    /
      C1    C3    /
       \   /     /
    loop backedge

llvm-svn: 256123

8 years ago[X86] Add missing m64/int64 conversions
Michael Kuperstein [Sun, 20 Dec 2015 12:37:18 +0000 (12:37 +0000)]
[X86] Add missing m64/int64 conversions

Define the 64-bit equivalents of _m_to_int and _m_from_int.

Differential Revision: http://reviews.llvm.org/D15572

llvm-svn: 256122

8 years ago[X86] Add signed aliases for popcnt intrinsics
Michael Kuperstein [Sun, 20 Dec 2015 12:35:35 +0000 (12:35 +0000)]
[X86] Add signed aliases for popcnt intrinsics

The Intel manual documents both an unsigned form (_mm_popcnt_u32)
and a signed form (_popcnt32) of the intrinsic. Add the missing signed form.

Differential Revision: http://reviews.llvm.org/D15568

llvm-svn: 256121

8 years agoAdd AVR.td and AVRRegisterInfo.td
Dylan McKay [Sun, 20 Dec 2015 12:16:20 +0000 (12:16 +0000)]
Add AVR.td and AVRRegisterInfo.td

Summary:
This adds the core AVR TableGen file, along with the register descriptions.

Lines in AVR.td which require other TableGen files which haven't been committed
yet are commented out.

This is a fairly trivial patch, and should only require a quick review.

I kept the line width smaller than 80 columns, but there are a few exceptions
because I'm not sure how to split a string over several lines.

Reviewers: stoklund

Subscribers: dylanmckay, agnat

Differential Revision: http://reviews.llvm.org/D14684

llvm-svn: 256120

8 years ago[ELF][MIPS] MIPS .reginfo sections handling
Simon Atanasyan [Sun, 20 Dec 2015 10:57:34 +0000 (10:57 +0000)]
[ELF][MIPS] MIPS .reginfo sections handling

MIPS .reginfo section provides information on the registers used by
the code in the object file. Linker should collect this information and
write .reginfo section in the output file. This section contains a union
of used registers masks taken from input .reginfo sections and final
value of the `_gp` symbol.

For details see the "Register Information" section in Chapter 4 in the
following document:
ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf

The patch implements .reginfo sections handling with a couple missed
features: a) it does not put output .reginfo section into the separate
REGINFO segment; b) it does not merge `ri_cprmask` masks from input
section. These features will be implemented later.

Differential Revision: http://reviews.llvm.org/D15669

llvm-svn: 256119

8 years ago[llvm-objdump] Move COFF function to where it belongs.
Davide Italiano [Sun, 20 Dec 2015 09:54:34 +0000 (09:54 +0000)]
[llvm-objdump] Move COFF function to where it belongs.

Ideally much more stuff should be moved out of llvm-objdump.cpp, but that
will happen later.

llvm-svn: 256118

8 years agoFix a bug in test case -- duplicate entries
Xinliang David Li [Sun, 20 Dec 2015 08:49:31 +0000 (08:49 +0000)]
Fix a bug in test case -- duplicate entries

llvm-svn: 256117

8 years agoFix a latent UAF bug in profwriter
Xinliang David Li [Sun, 20 Dec 2015 08:46:18 +0000 (08:46 +0000)]
Fix a latent UAF bug in profwriter

llvm-svn: 256116

8 years agoFix mapping of @llvm.arm.ssat/usat intrinsics to ssat/usat instructions for Thumb2
Weiming Zhao [Sun, 20 Dec 2015 06:41:44 +0000 (06:41 +0000)]
Fix mapping of @llvm.arm.ssat/usat intrinsics to ssat/usat instructions for Thumb2

Summary:
r250697 fixed the mapping for ARM mode. We have to do the same for Thumb2 otherwise the same llvm.arm.ssat() will generate different saturating amount for ARM and Thumb.

r250697: http://reviews.llvm.org/rL250697

Reviewers: rmaprath

Subscribers: aemerson, llvm-commits, rengolin

Differential Revision: http://reviews.llvm.org/D15653

llvm-svn: 256115

8 years ago[PGO] Improve Indexed Profile Reader efficiency
Xinliang David Li [Sun, 20 Dec 2015 06:22:13 +0000 (06:22 +0000)]
[PGO] Improve Indexed Profile Reader efficiency

With the support of value profiling added, the Indexed prof
reader gets less efficient. The prof reader initialization
used to be just reading the file header, but with VP support
added, initialization needs to walk through all profile keys
of ondisk hash table resulting in very poor locality and large
memory increase (keys are stored together with the profile data
in the mapped profile buffer). Even worse, when the reader is
used by the compiler (not llvm-profdata too), the penalty becomes
very high as compilation of each single module requires touching
profile data buffer for the whole program.

In this patch, the icall target values (MD5hash) are no longer eargerly
converted back to name strings when the data is read into memory. New
interface is added to to profile reader so that InstrProfSymtab can be
lazily created for Indexed profile reader on-demand. Creating of the
symtab is intended to be used by llvm-profdata tool for symbolic dumping
of  VP data. It can be used with compiler (for legacy out of tree uses)
too but not recommended due to compile time and memory reasons
mentioned above.

Some other cleanups are also included: Function Addr to md5 map is now
consolated into InstrProfSymtab. InstrProfStringtab is no longer used and
eliminated.

llvm-svn: 256114

8 years agoMinor clean up -- move large single use method out of header(NFC)
Xinliang David Li [Sun, 20 Dec 2015 05:15:45 +0000 (05:15 +0000)]
Minor clean up -- move large single use method out of header(NFC)

llvm-svn: 256113

8 years agoRevert r219171, "llvm/test/lit.cfg: Suppress dwarf stuff for targeting x86_64-mingw32...
NAKAMURA Takumi [Sun, 20 Dec 2015 03:48:23 +0000 (03:48 +0000)]
Revert r219171, "llvm/test/lit.cfg: Suppress dwarf stuff for targeting x86_64-mingw32 while investigating since r219108."

It has been fixed since r219280 by David Majnemer.

llvm-svn: 256112

8 years agoThreadPool unittests: do not hold mutex when calling condition_variable:notify()
Mehdi Amini [Sat, 19 Dec 2015 22:56:24 +0000 (22:56 +0000)]
ThreadPool unittests: do not hold mutex when calling condition_variable:notify()

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 256111

8 years agoNonnull elements in OperandBundleCallSites are not all Instructions
Sanjoy Das [Sat, 19 Dec 2015 22:40:28 +0000 (22:40 +0000)]
Nonnull elements in OperandBundleCallSites are not all Instructions

`CloneAndPruneIntoFromInst` sometimes RAUW's dead instructions with
`undef` before erasing them (to avoid deleting instructions that still
have uses).  This changes the `WeakVH` in `OperandBundleCallSites` to
hold an `undef`, and we need to guard for this situation in eventuality
in `llvm::InlineFunction`.

llvm-svn: 256110

8 years ago[Deopt bundles] Fix a test case
Sanjoy Das [Sat, 19 Dec 2015 22:40:22 +0000 (22:40 +0000)]
[Deopt bundles] Fix a test case

The `CHECK-NOT` line was incorrect, and would not have caught a
breakage.

llvm-svn: 256109

8 years ago[llvm-objdump] Fail early if we can't parse the object header.
Davide Italiano [Sat, 19 Dec 2015 22:09:40 +0000 (22:09 +0000)]
[llvm-objdump] Fail early if we can't parse the object header.

llvm-svn: 256108

8 years agoDelete APIs that have been deprecated since 2010.
Rafael Espindola [Sat, 19 Dec 2015 21:42:07 +0000 (21:42 +0000)]
Delete APIs that have been deprecated since 2010.

llvm-svn: 256107

8 years agoThe PS4 baton passes.
Paul Robinson [Sat, 19 Dec 2015 20:04:03 +0000 (20:04 +0000)]
The PS4 baton passes.

llvm-svn: 256106

8 years agoAssert that we have all use/users in the getters.
Rafael Espindola [Sat, 19 Dec 2015 20:03:23 +0000 (20:03 +0000)]
Assert that we have all use/users in the getters.

An error that is pretty easy to make is to use the lazy bitcode reader
and then do something like

if (V.use_empty())

The problem is that uses in unmaterialized functions are not accounted
for.

This patch adds asserts that all uses are known.

llvm-svn: 256105

8 years agoDriver part of debugger tuning.
Paul Robinson [Sat, 19 Dec 2015 19:41:48 +0000 (19:41 +0000)]
Driver part of debugger tuning.

Adds driver options named -glldb and -gsce to mean -g plus tuning for
lldb and SCE debuggers respectively; the existing -ggdb option does
the same for gdb. Existing options -ggdb0, -ggdb1 etc. unpack into
-ggdb -g<N>.  (There will not be -glldb<N> or -gsce<N> options.) The
tuning gets a target-specific default in the driver, and is passed
into cc1 with the new -debugger-tuning option.

As fallout, fixes where '-gsplit-dwarf -g0' would ignore the -g0 part
on Linux.

Differential Revision: http://reviews.llvm.org/D15651

llvm-svn: 256104

8 years ago[PGO] Fix build failure with MSVC
Xinliang David Li [Sat, 19 Dec 2015 19:16:32 +0000 (19:16 +0000)]
[PGO] Fix build failure with MSVC

llvm-svn: 256103

8 years agoWebAssembly: add vtable test
JF Bastien [Sat, 19 Dec 2015 18:55:18 +0000 (18:55 +0000)]
WebAssembly: add vtable test

The test will mainly be useful to check that the .s file assembles and relocates properly because vtables reference functions in their data section.

llvm-svn: 256102

8 years agoRemove unnecessary casts. NFC.
Manuel Jacob [Sat, 19 Dec 2015 18:38:42 +0000 (18:38 +0000)]
Remove unnecessary casts.  NFC.

llvm-svn: 256101

8 years agoRemove double blanks. NFC.
Manuel Jacob [Sat, 19 Dec 2015 18:26:53 +0000 (18:26 +0000)]
Remove double blanks.  NFC.

llvm-svn: 256100

8 years agoImprove InstrProfSymtab test coverage
Xinliang David Li [Sat, 19 Dec 2015 18:20:09 +0000 (18:20 +0000)]
Improve InstrProfSymtab test coverage

llvm-svn: 256099

8 years agoSelectionDAG: Cleanup integer bin op promotion functions.
Matt Arsenault [Sat, 19 Dec 2015 17:18:43 +0000 (17:18 +0000)]
SelectionDAG: Cleanup integer bin op promotion functions.

SDIV and UDIV had special handling, but this is the same handling
that min/max need.

llvm-svn: 256098

8 years ago[unittests] ThreadPool: Remove redundant loop, NFC
Vedant Kumar [Sat, 19 Dec 2015 09:54:27 +0000 (09:54 +0000)]
[unittests] ThreadPool: Remove redundant loop, NFC

llvm-svn: 256097