platform/upstream/llvm.git
8 years ago[WebAssembly] Remove the -target command-line flag from the ld commandline.
Dan Gohman [Mon, 21 Dec 2015 23:30:41 +0000 (23:30 +0000)]
[WebAssembly] Remove the -target command-line flag from the ld commandline.

This flag isn't needed, or permitted, with the "ld" flavor of lld.

Also, add a basic ld commandline test.

llvm-svn: 256216

8 years ago[Support] Timer: simplify the init() method
Vedant Kumar [Mon, 21 Dec 2015 23:27:44 +0000 (23:27 +0000)]
[Support] Timer: simplify the init() method

llvm-svn: 256215

8 years ago[AVR] Added configuration file and machine function information class
Dylan McKay [Mon, 21 Dec 2015 23:13:15 +0000 (23:13 +0000)]
[AVR] Added configuration file and machine function information class

This commit adds the 'AVRMachineFunctionInfo' class, which simply stores
basic properties about generated machine functions.

llvm-svn: 256213

8 years agoReduce code duplication
Enrico Granata [Mon, 21 Dec 2015 23:10:17 +0000 (23:10 +0000)]
Reduce code duplication

llvm-svn: 256212

8 years agoFix line endings after r256155. NFC.
Eric Christopher [Mon, 21 Dec 2015 23:04:27 +0000 (23:04 +0000)]
Fix line endings after r256155. NFC.

llvm-svn: 256211

8 years agoScopInfo: Small improvement to schedule construction [NFC]
Tobias Grosser [Mon, 21 Dec 2015 23:01:53 +0000 (23:01 +0000)]
ScopInfo: Small improvement to schedule construction [NFC]

We clarify that certain code is only executed if LSchedule is != nullptr.
Previously some of these functions have been executed, but they only passed
a nullptr through. This caused some confusion when reading the code.

llvm-svn: 256209

8 years agoScopInfo: Polish the implementation of mapToDimension
Tobias Grosser [Mon, 21 Dec 2015 22:45:53 +0000 (22:45 +0000)]
ScopInfo: Polish the implementation of mapToDimension

Besides improving the documentation and the code we now assert in case the input
is invalid (N < 0) and also do not any more return a nullptr in case USet is
empty. This should make the code more readable.

llvm-svn: 256208

8 years ago[asan] Add mincore test.
Evgeniy Stepanov [Mon, 21 Dec 2015 22:35:03 +0000 (22:35 +0000)]
[asan] Add mincore test.

ASan does not really do anything interesting with mincore, but this
test verifies that the function still works correctly.

llvm-svn: 256207

8 years agoFix test case comment (NFC)
Xinliang David Li [Mon, 21 Dec 2015 22:26:49 +0000 (22:26 +0000)]
Fix test case comment (NFC)

llvm-svn: 256206

8 years ago[cfi] Fix LowerBitSets on 32-bit targets.
Evgeniy Stepanov [Mon, 21 Dec 2015 22:14:04 +0000 (22:14 +0000)]
[cfi] Fix LowerBitSets on 32-bit targets.

This code attempts to truncate IntPtrTy to i32, which may be the same
type.

llvm-svn: 256205

8 years ago[clang-cl] Add support for /Brepro
David Majnemer [Mon, 21 Dec 2015 22:09:34 +0000 (22:09 +0000)]
[clang-cl] Add support for /Brepro

The /Brepro flag controls whether or not the compiler should embed
timestamps into the object file.  Object files which do not embed
timestamps are not suitable for incremental linking but are suitable for
hermetic build systems and staged self-hosts of clang.

A normal clang spelling of this flag has been added,
-mincremental-linker-compatible.

llvm-svn: 256204

8 years ago[MC, COFF] Support link /incremental conditionally
David Majnemer [Mon, 21 Dec 2015 22:09:27 +0000 (22:09 +0000)]
[MC, COFF] Support link /incremental conditionally

Today, we always take into account the possibility that object files
produced by MC may be consumed by an incremental linker.  This results
in us initialing fields which vary with time (TimeDateStamp) which harms
hermetic builds (e.g. verifying a self-host went well) and produces
sub-optimal code because we cannot assume anything about the relative
position of functions within a section (call sites can get redirected
through incremental linker thunks).

Let's provide an MCTargetOption which controls this behavior so that we
can disable this functionality if we know a-priori that the build will
not rely on /incremental.

llvm-svn: 256203

8 years agoEnhance BranchProbabilityInfo::calcUnreachableHeuristics for InvokeInst
Jun Bum Lim [Mon, 21 Dec 2015 22:00:51 +0000 (22:00 +0000)]
Enhance BranchProbabilityInfo::calcUnreachableHeuristics for InvokeInst

This is recommit of r256028 with minor fixes in unittests:
  CodeGen/Mips/eh.ll
  CodeGen/Mips/insn-zero-size-bb.ll

Original commit message:

When identifying blocks post-dominated by an unreachable-terminated block
in BranchProbabilityInfo, consider only the edge to the normal destination
block if the terminator is InvokeInst and let calcInvokeHeuristics() decide
edge weights for the InvokeInst.

llvm-svn: 256202

8 years agoResubmit r256193 with test fix: assertion failure analyzed
Xinliang David Li [Mon, 21 Dec 2015 21:52:27 +0000 (21:52 +0000)]
Resubmit r256193 with test fix: assertion failure analyzed

llvm-svn: 256201

8 years agoDrop remaining uses of the Base typedef idiom.
Rafael Espindola [Mon, 21 Dec 2015 21:07:31 +0000 (21:07 +0000)]
Drop remaining uses of the Base typedef idiom.

llvm-svn: 256200

8 years agoAdd option to assume single-loop scops with sufficient compute are profitable
Tobias Grosser [Mon, 21 Dec 2015 21:00:43 +0000 (21:00 +0000)]
Add option to assume single-loop scops with sufficient compute are profitable

If a loop has a sufficiently large amount of compute instruction in its loop
body, it is unlikely that our rewrite of the loop iterators introduces large
performance changes. As Polly can also apply beneficical optimizations (such
as parallelization) to such loop nests, we mark them as profitable.

This option is currently "disabled" by default, but can be used to run
experiments. If enabled by setting it e.g. to 40 instructions, we currently
see some compile-time increases on LNT without any significant run-time
changes.

llvm-svn: 256199

8 years agoRevert r256193: build bot failure triggered
Xinliang David Li [Mon, 21 Dec 2015 21:00:33 +0000 (21:00 +0000)]
Revert r256193: build bot failure triggered

llvm-svn: 256198

8 years agoSimplify types. NFC.
Rafael Espindola [Mon, 21 Dec 2015 20:59:29 +0000 (20:59 +0000)]
Simplify types. NFC.

llvm-svn: 256197

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