platform/upstream/llvm.git
9 years agoFix assertion failure in global-merge with unused ConstantExpr
Oliver Stannard [Mon, 8 Jun 2015 16:55:31 +0000 (16:55 +0000)]
Fix assertion failure in global-merge with unused ConstantExpr

The global-merge pass was crashing because it assumes that all ConstantExprs
(reached via the global variables that they use) have at least one user.

I haven't worked out a way to test this, as an unused ConstantExpr cannot be
represented by serialised IR, and global-merge can only be run in llc, which
does not run any passes which can make a ConstantExpr dead.

This (reduced to the point of silliness) C code triggers this bug when compiled
for arm-none-eabi at -O1:

  static a = 7;
  static volatile b[10] = {&a};

  c;
  main() {
    c = 0;
    for (; c < 10;)
      printf(b[c]);
  }

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

llvm-svn: 239308

9 years ago[Hexagon] Adding functionality for searching for compound instruction pairs. Compoun...
Colin LeMahieu [Mon, 8 Jun 2015 16:34:47 +0000 (16:34 +0000)]
[Hexagon] Adding functionality for searching for compound instruction pairs.  Compound instructions reduce slot resource requirements freeing those packet slots up for more instructions.

llvm-svn: 239307

9 years agoRevert "Add NVIDIA vprintf printing to RuntimeDebugBuilder"
Tobias Grosser [Mon, 8 Jun 2015 16:24:49 +0000 (16:24 +0000)]
Revert "Add NVIDIA vprintf printing to RuntimeDebugBuilder"

This reverts commit 239219 which requires some LLVM changes I forgot to commit.

Reported-by: Marshall Clow
llvm-svn: 239306

9 years ago[DAGCombiner] Added CTLZ vector constant folding support.
Simon Pilgrim [Mon, 8 Jun 2015 16:19:00 +0000 (16:19 +0000)]
[DAGCombiner] Added CTLZ vector constant folding support.

llvm-svn: 239305

9 years agofix typos; NFC
Sanjay Patel [Mon, 8 Jun 2015 15:21:38 +0000 (15:21 +0000)]
fix typos; NFC

llvm-svn: 239303

9 years agoARM]: Add support for MMFR4_EL1 in assembler
Javed Absar [Mon, 8 Jun 2015 15:01:11 +0000 (15:01 +0000)]
ARM]: Add support for MMFR4_EL1 in assembler

This patch adds support for system register MMFR4_EL1 (memory model feature register) in the assembler.
This register provides information about the implemented memory model and memory management support.

llvm-svn: 239302

9 years ago[Mips64][mcjit] Add R_MIPS_PC32 relocation
Petar Jovanovic [Mon, 8 Jun 2015 14:10:23 +0000 (14:10 +0000)]
[Mips64][mcjit] Add R_MIPS_PC32 relocation

This patch adds R_MIPS_PC32 relocation for Mips64.

Patch by Vladimir Radosavljevic.

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

llvm-svn: 239301

9 years agoAVX-512: Implemented 256/128bit VALIGND/Q instructions for SKX and KNL
Igor Breger [Mon, 8 Jun 2015 14:03:17 +0000 (14:03 +0000)]
AVX-512: Implemented 256/128bit VALIGND/Q instructions for SKX and KNL
Implemented DAG lowering for all these forms.
Added tests for DAG lowering and encoding.

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

llvm-svn: 239300

9 years agoMinor refactoring of GEP handling in isDereferenceablePointer
Artur Pilipenko [Mon, 8 Jun 2015 11:58:13 +0000 (11:58 +0000)]
Minor refactoring of GEP handling in isDereferenceablePointer

For GEP instructions isDereferenceablePointer checks that all indices are constant and within bounds. Replace this index calculation logic to a call to accumulateConstantOffset. Separated from the http://reviews.llvm.org/D9791

Reviewed By: sanjoy

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

llvm-svn: 239299

9 years agoUpdate test with target flag and amended results
Leny Kholodov [Mon, 8 Jun 2015 11:39:16 +0000 (11:39 +0000)]
Update test with target flag and amended results

llvm-svn: 239298

9 years ago[LLDB-MI] Properly detect missing mandatory arguments to MI commands
Bruce Mitchener [Mon, 8 Jun 2015 11:15:09 +0000 (11:15 +0000)]
[LLDB-MI] Properly detect missing mandatory arguments to MI commands

Summary:
Previously if an MI command had **X** mandatory and **Y** optional arguments you could provide **X** or more optional arguments without providing any of the mandatory arguments, and the argument validation code wouldn't complain.

For example this would pass argument validation even though the mandatory **address** and **count** arguments are missing:

-data-read-memory-bytes --thread 1 --frame 0

Part of the problem was that an empty string was considered a valid value for a mandatory argument, which didn't make much sense.

Patch by Vadim Macagon. Thanks!

Test Plan:
./dotest.py -A x86_64 -C clang --executable $BUILDDIR/bin/lldb tools/lldb-mi/

No unexpected failures on my Ubuntu 14.10 64bit Virtualbox VM.

Reviewers: domipheus, ki.stfu, abidh

Reviewed By: ki.stfu, abidh

Subscribers: brucem, lldb-commits

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

llvm-svn: 239297

9 years agoFix for temporary variable names in stack reuse tests in revision 239294
Leny Kholodov [Mon, 8 Jun 2015 11:06:59 +0000 (11:06 +0000)]
Fix for temporary variable names in stack reuse tests in revision 239294

llvm-svn: 239296

9 years ago[LAA] Fix estimation of number of memchecks
Silviu Baranga [Mon, 8 Jun 2015 10:27:06 +0000 (10:27 +0000)]
[LAA] Fix estimation of number of memchecks

Summary:
We need to add a runtime memcheck for pair of accesses (x,y) where at least one of x and y
are writes.

Assuming we have w writes and r reads, currently this number is  estimated as being
w* (w+r-1). This estimation will count (write,write) pairs twice and will overestimate
the number of checks required.

This change adds a getNumberOfChecks method to RuntimePointerCheck, which
will count the number of runtime checks needed (similar in implementation to
needsAnyChecking) and uses it to produce the correct number of runtime checks.

Test Plan:
llvm test suite
spec2k
spec2k6

Performance results: no changes observed (not surprising since the formula for 1 writer is basically the same, which would covers most cases - at least with the current check limit).

Reviewers: anemet

Reviewed By: anemet

Subscribers: mzolotukhin, llvm-commits

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

llvm-svn: 239295

9 years ago[CodeGen] Reuse stack space from unused function results (with more accurate unused...
Leny Kholodov [Mon, 8 Jun 2015 10:23:49 +0000 (10:23 +0000)]
[CodeGen] Reuse stack space from unused function results (with more accurate unused result detection)

This patch fixes issues with unused result detection which were found in patch http://reviews.llvm.org/D9743.

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

llvm-svn: 239294

9 years ago[DAGCombiner] Added CTTZ vector constant folding support.
Simon Pilgrim [Mon, 8 Jun 2015 09:57:09 +0000 (09:57 +0000)]
[DAGCombiner] Added CTTZ vector constant folding support.

llvm-svn: 239293

9 years agoCOFF: Avoid callign stable_sort.
Rui Ueyama [Mon, 8 Jun 2015 08:26:28 +0000 (08:26 +0000)]
COFF: Avoid callign stable_sort.

MSVC profiler reported that this stable_sort takes 7% time
when self-linking. As a result, createSection was taking 10% time.
Now createSection takes 3%. This small change actually makes
the linker a bit but perceptibly faster.

llvm-svn: 239292

9 years ago[LoopVectorize] Teach Loop Vectorizor about interleaved memory accesses.
Hao Liu [Mon, 8 Jun 2015 06:39:56 +0000 (06:39 +0000)]
[LoopVectorize] Teach Loop Vectorizor about interleaved memory accesses.
Interleaved memory accesses are grouped and vectorized into vector load/store and shufflevector.
E.g. for (i = 0; i < N; i+=2) {
       a = A[i];         // load of even element
       b = A[i+1];       // load of odd element
       ...               // operations on a, b, c, d
       A[i] = c;         // store of even element
       A[i+1] = d;       // store of odd element
     }

  The loads of even and odd elements are identified as an interleave load group, which will be transfered into vectorized IRs like:
     %wide.vec = load <8 x i32>, <8 x i32>* %ptr
     %vec.even = shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
     %vec.odd = shufflevector <8 x i32> %wide.vec, <8 x i32> undef, <4 x i32> <i32 1, i32 3, i32 5, i32 7>

  The stores of even and odd elements are identified as an interleave store group, which will be transfered into vectorized IRs like:
     %interleaved.vec = shufflevector <4 x i32> %vec.even, %vec.odd, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
     store <8 x i32> %interleaved.vec, <8 x i32>* %ptr

This optimization is currently disabled by defaut. To try it by adding '-enable-interleaved-mem-accesses=true'.

llvm-svn: 239291

9 years agoCOFF: Use the empty string as the current directory instead of ".".
Rui Ueyama [Mon, 8 Jun 2015 06:13:12 +0000 (06:13 +0000)]
COFF: Use the empty string as the current directory instead of ".".

This is NFC but makes log message a bit nicer because it doesn't
append .\ (or ./ on Unix) to files in the current directory.

llvm-svn: 239290

9 years agoCOFF: Add more log messages.
Rui Ueyama [Mon, 8 Jun 2015 06:00:10 +0000 (06:00 +0000)]
COFF: Add more log messages.

llvm-svn: 239289

9 years agoCOFF: Print out log messages to stdout.
Rui Ueyama [Mon, 8 Jun 2015 05:43:50 +0000 (05:43 +0000)]
COFF: Print out log messages to stdout.

llvm-svn: 239288

9 years agoCOFF: Check for auxiliary symbol's type.
Rui Ueyama [Mon, 8 Jun 2015 05:00:42 +0000 (05:00 +0000)]
COFF: Check for auxiliary symbol's type.

We forgot to check for auxiliary symbol's type. So we sometimes read
garbage as associative section definitions.

Associative sections are considered as not live themselves by the
garbage collector because they are live only when associaited sections
are live.

By reading more data (or garbage) as associative section definitions,
we treated more sections as non-GC-roots, that caused the linker to
discard too many sections by mistake. That caused another mysterious
bug (such as some global constructors don't run at all for some reason.)

llvm-svn: 239287

9 years ago[llvm-readobj] Use the new symbol API.
Davide Italiano [Mon, 8 Jun 2015 04:55:29 +0000 (04:55 +0000)]
[llvm-readobj] Use the new symbol API.

llvm-svn: 239286

9 years ago[LoopAccessAnalysis] Teach LAA to check the memory dependence between strided accesses.
Hao Liu [Mon, 8 Jun 2015 04:48:37 +0000 (04:48 +0000)]
[LoopAccessAnalysis] Teach LAA to check the memory dependence between strided accesses.

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

llvm-svn: 239285

9 years agoSilence warning on Windows.
Chaoren Lin [Mon, 8 Jun 2015 04:39:24 +0000 (04:39 +0000)]
Silence warning on Windows.

llvm-svn: 239284

9 years agoDo not build LLD from tools/Makefile, as LLD no longer has a Makefile build.
Peter Collingbourne [Mon, 8 Jun 2015 04:04:13 +0000 (04:04 +0000)]
Do not build LLD from tools/Makefile, as LLD no longer has a Makefile build.

llvm-svn: 239283

9 years agoRemove SCEVCache and FindConstantPointers from complete loop unrolling heuristic.
Michael Zolotukhin [Mon, 8 Jun 2015 03:28:06 +0000 (03:28 +0000)]
Remove SCEVCache and FindConstantPointers from complete loop unrolling heuristic.

Summary:
Using some SCEV functionality helped to entirely remove SCEVCache class and FindConstantPointers SCEV visitor.
Also, this makes the code more universal - I'll take advandate of it in next patches where I start handling additional types of instructions.

Test Plan: Tests would be submitted in subsequent patches.

Reviewers: atrick, chandlerc

Reviewed By: atrick, chandlerc

Subscribers: atrick, llvm-commits

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

llvm-svn: 239282

9 years agoCOFF: Simplify InputFile class.
Rui Ueyama [Mon, 8 Jun 2015 03:27:57 +0000 (03:27 +0000)]
COFF: Simplify InputFile class.

Now that all InputFile subclasses have MemoryBufferRefs and
provides the same set of functions. Implement that in the base class.

llvm-svn: 239281

9 years agoCOFF: Set non-1 alignment to common chunks.
Rui Ueyama [Mon, 8 Jun 2015 03:17:07 +0000 (03:17 +0000)]
COFF: Set non-1 alignment to common chunks.

I don't know what the right thing to do here, but at least 1 does
not seem like a correct value. If we do not align common chunks at
all, a small program which calls puts() from global dtors crashes
mysteriously in a kernel32's function.

I believe the crash was caused by symbols overlapping each other,
and my guess is that alignment has something to do with that, but
I am not 100% sure. Needs investigating.

llvm-svn: 239280

9 years agoFix Windows build.
Peter Collingbourne [Mon, 8 Jun 2015 02:43:32 +0000 (02:43 +0000)]
Fix Windows build.

llvm-svn: 239279

9 years agollvm-ar: Move archive writer to Object.
Peter Collingbourne [Mon, 8 Jun 2015 02:32:01 +0000 (02:32 +0000)]
llvm-ar: Move archive writer to Object.

No functional change intended, other than some minor changes to certain
diagnostics.

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

llvm-svn: 239278

9 years ago[TableGen] Remove unnecessary default constructed SMLoc that just existed to return...
Craig Topper [Mon, 8 Jun 2015 01:35:45 +0000 (01:35 +0000)]
[TableGen] Remove unnecessary default constructed SMLoc that just existed to return. Instead just call the default constructor in the return.

llvm-svn: 239277

9 years ago[TableGen] Use range-based for loop. NFC
Craig Topper [Mon, 8 Jun 2015 01:35:43 +0000 (01:35 +0000)]
[TableGen] Use range-based for loop. NFC

llvm-svn: 239276

9 years ago[TableGen] Remove unnecessary extern declaration that's already in an included header...
Craig Topper [Mon, 8 Jun 2015 01:35:42 +0000 (01:35 +0000)]
[TableGen] Remove unnecessary extern declaration that's already in an included header file.

llvm-svn: 239275

9 years ago[TableGen] Use the SMLoc header file instead of SourceMgr header file in a couple...
Craig Topper [Mon, 8 Jun 2015 01:35:40 +0000 (01:35 +0000)]
[TableGen] Use the SMLoc header file instead of SourceMgr header file in a couple places. NFC

llvm-svn: 239274

9 years ago[Driver] Inject the MSVC compatibility version into the triple
David Majnemer [Mon, 8 Jun 2015 00:22:46 +0000 (00:22 +0000)]
[Driver] Inject the MSVC compatibility version into the triple

Encoding the version into the triple will allow us to communicate to
LLVM what functions it can expect to depend upon in the implementation.

llvm-svn: 239273

9 years agoCOFF: Fix memory leak.
Rui Ueyama [Mon, 8 Jun 2015 00:09:25 +0000 (00:09 +0000)]
COFF: Fix memory leak.

llvm-svn: 239272

9 years agoCOFF: Fix typo.
Rui Ueyama [Sun, 7 Jun 2015 23:10:50 +0000 (23:10 +0000)]
COFF: Fix typo.

This change doesn't change its functionality since the value
passed here is converted to uint16_t immediately.

llvm-svn: 239271

9 years agoCOFF: Simplify. NFC.
Rui Ueyama [Sun, 7 Jun 2015 23:02:50 +0000 (23:02 +0000)]
COFF: Simplify. NFC.

llvm-svn: 239270

9 years agoCOFF: Use llvm::cl::ExpandReponseFiles.
Rui Ueyama [Sun, 7 Jun 2015 23:00:29 +0000 (23:00 +0000)]
COFF: Use llvm::cl::ExpandReponseFiles.

llvm-svn: 239269

9 years agoCOFF: Add a glossary to README.
Rui Ueyama [Sun, 7 Jun 2015 22:42:52 +0000 (22:42 +0000)]
COFF: Add a glossary to README.

llvm-svn: 239268

9 years agoCOFF: Use named constants instead of sizeof().
Rui Ueyama [Sun, 7 Jun 2015 22:00:28 +0000 (22:00 +0000)]
COFF: Use named constants instead of sizeof().

llvm-svn: 239267

9 years agoCOFF: Remove dead code.
Rui Ueyama [Sun, 7 Jun 2015 21:58:34 +0000 (21:58 +0000)]
COFF: Remove dead code.

/include'ed symbols are already added to Config->GCRoots.
Marking symbols twice doesn't have any effect.

llvm-svn: 239266

9 years ago[objdump] Moving PrintImmHex out of MachODump and in to llvm-objdump and setting...
Colin LeMahieu [Sun, 7 Jun 2015 21:07:17 +0000 (21:07 +0000)]
[objdump] Moving PrintImmHex out of MachODump and in to llvm-objdump and setting instprinter appropriately.

llvm-svn: 239265

9 years ago[X86] Added tzcnt vector tests.
Simon Pilgrim [Sun, 7 Jun 2015 21:01:34 +0000 (21:01 +0000)]
[X86] Added tzcnt vector tests.

llvm-svn: 239264

9 years ago[MC] Function naming NFC.
Colin LeMahieu [Sun, 7 Jun 2015 20:29:37 +0000 (20:29 +0000)]
[MC] Function naming NFC.

llvm-svn: 239263

9 years agoSeparateConstOffsetFromGEP: Pass address space to isLegalAddressingMode
Matt Arsenault [Sun, 7 Jun 2015 20:17:44 +0000 (20:17 +0000)]
SeparateConstOffsetFromGEP: Pass address space to isLegalAddressingMode

llvm-svn: 239262

9 years agoMake NaryReassociate pass the address space to isLegalAddressingMode
Matt Arsenault [Sun, 7 Jun 2015 20:17:42 +0000 (20:17 +0000)]
Make NaryReassociate pass the address space to isLegalAddressingMode

No test since the kinds of transforms this prevents seem to not really
be relevant for SI's different addressing modes.

llvm-svn: 239261

9 years agoAdd isLegalAddressingMode address space argument to TTI
Matt Arsenault [Sun, 7 Jun 2015 20:12:03 +0000 (20:12 +0000)]
Add isLegalAddressingMode address space argument to TTI

Update to match the TLI version, and remove the TLI version's
default argument.

llvm-svn: 239260

9 years ago[cmake] [OCaml] Make ocamldoc targets depend on output files
Peter Zotov [Sun, 7 Jun 2015 19:22:22 +0000 (19:22 +0000)]
[cmake] [OCaml] Make ocamldoc targets depend on output files

OCaml doc builds fail without .cmi files, and .cmi files are collected
in ocaml_outputs. Therefore, make doc targets depend on ocaml_outputs as
well.

Fixes: https://llvm.org/bugs/show_bug.cgi?id=23777

Patch by MichaÅ‚ Górny <mgorny@gentoo.org>

llvm-svn: 239259

9 years agoUpdate dosep to display dotest command invoked on failure.
Chaoren Lin [Sun, 7 Jun 2015 18:50:40 +0000 (18:50 +0000)]
Update dosep to display dotest command invoked on failure.

llvm-svn: 239258

9 years ago[X86] Added BitScanForward/BitScanReverse memory folding + tests
Simon Pilgrim [Sun, 7 Jun 2015 18:34:25 +0000 (18:34 +0000)]
[X86] Added BitScanForward/BitScanReverse memory folding + tests

llvm-svn: 239257

9 years agoRemove global std::string. NFC.
Benjamin Kramer [Sun, 7 Jun 2015 16:36:28 +0000 (16:36 +0000)]
Remove global std::string. NFC.

llvm-svn: 239254

9 years agoFixed line endings
Simon Pilgrim [Sun, 7 Jun 2015 16:09:48 +0000 (16:09 +0000)]
Fixed line endings

llvm-svn: 239253

9 years ago[DAGCombiner] Added CTPOP vector constant folding support.
Simon Pilgrim [Sun, 7 Jun 2015 15:37:14 +0000 (15:37 +0000)]
[DAGCombiner] Added CTPOP vector constant folding support.

Added tests to the existing SSE/AVX test files.

llvm-svn: 239252

9 years ago[AsmWriter] Rewrite module asm printing using StringRef::split.
Benjamin Kramer [Sun, 7 Jun 2015 13:59:33 +0000 (13:59 +0000)]
[AsmWriter] Rewrite module asm printing using StringRef::split.

No change in output intended.

llvm-svn: 239251

9 years agoFix doxygen comments. NFC
Filipe Cabecinhas [Sun, 7 Jun 2015 06:40:24 +0000 (06:40 +0000)]
Fix doxygen comments. NFC

llvm-svn: 239250

9 years ago[TableGen] Remove unnecessary include. NFC.
Craig Topper [Sun, 7 Jun 2015 06:01:22 +0000 (06:01 +0000)]
[TableGen] Remove unnecessary include. NFC.

llvm-svn: 239249

9 years ago[TableGen] Remove unnecessary forward declaration. NFC
Craig Topper [Sun, 7 Jun 2015 06:01:19 +0000 (06:01 +0000)]
[TableGen] Remove unnecessary forward declaration. NFC

llvm-svn: 239248

9 years ago[TableGen] Write one of the Record constructors in terms of the other constructor...
Craig Topper [Sun, 7 Jun 2015 06:01:17 +0000 (06:01 +0000)]
[TableGen] Write one of the Record constructors in terms of the other constructor to reduce code duplication. NFC

llvm-svn: 239247

9 years ago[TableGen] Remove unused function. NFC
Craig Topper [Sun, 7 Jun 2015 06:01:15 +0000 (06:01 +0000)]
[TableGen] Remove unused function. NFC

llvm-svn: 239246

9 years ago[TableGen] Use 'isa' to check if something is an UnsetInit rather than getting the...
Craig Topper [Sun, 7 Jun 2015 06:01:13 +0000 (06:01 +0000)]
[TableGen] Use 'isa' to check if something is an UnsetInit rather than getting the UnsetInit singleton and comparing pointers. NFC.

llvm-svn: 239245

9 years agoCOFF: Make local variables local.
Rui Ueyama [Sun, 7 Jun 2015 03:55:28 +0000 (03:55 +0000)]
COFF: Make local variables local.

llvm-svn: 239244

9 years agoCOFF: Add /opt:noref option.
Rui Ueyama [Sun, 7 Jun 2015 03:17:42 +0000 (03:17 +0000)]
COFF: Add /opt:noref option.

This option disables dead-stripping.

llvm-svn: 239243

9 years agoCOFF: Support resonpse files.
Rui Ueyama [Sun, 7 Jun 2015 02:55:19 +0000 (02:55 +0000)]
COFF: Support resonpse files.

llvm-svn: 239242

9 years ago[Object/ELF] Don't confuse isDefined() and isCommon.
Davide Italiano [Sun, 7 Jun 2015 02:45:19 +0000 (02:45 +0000)]
[Object/ELF] Don't confuse isDefined() and isCommon.

Reported by Rafael Espindola. Pointy-hat to me.

llvm-svn: 239241

9 years agoTeaching llvm-mc how to understand the defsym command line option. This allows integ...
Colin LeMahieu [Sun, 7 Jun 2015 01:46:24 +0000 (01:46 +0000)]
Teaching llvm-mc how to understand the defsym command line option.  This allows integer-constant symbols to be defined on the command line and used during assembly.

llvm-svn: 239240

9 years agoCOFF: Move Windows-specific code from Chunk.{cpp,h} to DLL.{cpp,h}.
Rui Ueyama [Sun, 7 Jun 2015 01:15:04 +0000 (01:15 +0000)]
COFF: Move Windows-specific code from Chunk.{cpp,h} to DLL.{cpp,h}.

llvm-svn: 239239

9 years agoCOFF: Fix default output file path.
Rui Ueyama [Sun, 7 Jun 2015 00:20:32 +0000 (00:20 +0000)]
COFF: Fix default output file path.

Default output filename is the same as the first object file's
name with its extension replaced with ".exe".

llvm-svn: 239238

9 years agoCOFF: Add comments and move main function to the top. NFC.
Rui Ueyama [Sat, 6 Jun 2015 23:32:08 +0000 (23:32 +0000)]
COFF: Add comments and move main function to the top. NFC.

llvm-svn: 239237

9 years agoCOFF: Rename writeHeader -> writeHeaderTo.
Rui Ueyama [Sat, 6 Jun 2015 23:19:38 +0000 (23:19 +0000)]
COFF: Rename writeHeader -> writeHeaderTo.

Chunk has writeTo function which takes uint8_t *Buf.
writeHeaderTo feels more consistent with that because this member
function also takes uint8_t *Buf.

llvm-svn: 239236

9 years agoCOFF: Inline a constant that is used only once.
Rui Ueyama [Sat, 6 Jun 2015 23:19:36 +0000 (23:19 +0000)]
COFF: Inline a constant that is used only once.

llvm-svn: 239235

9 years agoRemove redundant `using namespace`.
Rui Ueyama [Sat, 6 Jun 2015 23:11:39 +0000 (23:11 +0000)]
Remove redundant `using namespace`.

llvm-svn: 239234

9 years agoCOFF: Add .didat section.
Rui Ueyama [Sat, 6 Jun 2015 23:07:01 +0000 (23:07 +0000)]
COFF: Add .didat section.

llvm-svn: 239233

9 years agoCOFF: Update comments.
Rui Ueyama [Sat, 6 Jun 2015 22:56:55 +0000 (22:56 +0000)]
COFF: Update comments.

llvm-svn: 239232

9 years ago[Object/ELF] Provide helpers for symbol types.
Davide Italiano [Sat, 6 Jun 2015 22:54:09 +0000 (22:54 +0000)]
[Object/ELF] Provide helpers for symbol types.

These were, originally, in a different form in lld.
They can be reused for other tools, e.g. llvm-readobj.

llvm-svn: 239231

9 years agoCOFF: Move .idata constructor from Writer to Chunk.
Rui Ueyama [Sat, 6 Jun 2015 22:46:15 +0000 (22:46 +0000)]
COFF: Move .idata constructor from Writer to Chunk.

Previously, half of the constructor for .idata contents was in Chunks.cpp
and the rest was in Writer.cpp. This patch moves the latter to Chunks.cpp.
Now IdataContents class manages everything for .idata section.

llvm-svn: 239230

9 years ago[InstCombine, InstSimplify] Move xforms from Combine to Simplify
David Majnemer [Sat, 6 Jun 2015 22:40:21 +0000 (22:40 +0000)]
[InstCombine, InstSimplify] Move xforms from Combine to Simplify

There were several SelectInst combines that always returned an existing
instruction instead of modifying an old one or creating a new one.
These are prime candidates for moving to InstSimplify.

llvm-svn: 239229

9 years agoUse early return idiom. NFC
Filipe Cabecinhas [Sat, 6 Jun 2015 20:44:53 +0000 (20:44 +0000)]
Use early return idiom. NFC

llvm-svn: 239228

9 years ago[MC] Common symbols weren't being checked for redeclaration which allowed an assembly...
Colin LeMahieu [Sat, 6 Jun 2015 20:12:40 +0000 (20:12 +0000)]
[MC] Common symbols weren't being checked for redeclaration which allowed an assembly file to generate an assertion in setCommon(): !isCommon().  This change allows redeclaration as long as the size and alignment match exactly, otherwise report a fatal error.

llvm-svn: 239227

9 years ago[Mips] Factor out some bit manipulation code into separate routines
Simon Atanasyan [Sat, 6 Jun 2015 17:26:35 +0000 (17:26 +0000)]
[Mips] Factor out some bit manipulation code into separate routines

No functional changes.

llvm-svn: 239226

9 years ago[Mips] Check symbol alignment for some MIPS relocations.
Simon Atanasyan [Sat, 6 Jun 2015 17:26:28 +0000 (17:26 +0000)]
[Mips] Check symbol alignment for some MIPS relocations.

llvm-svn: 239225

9 years ago[Mips] Perform an overflow checking for relocations results
Simon Atanasyan [Sat, 6 Jun 2015 17:26:18 +0000 (17:26 +0000)]
[Mips] Perform an overflow checking for relocations results

llvm-svn: 239224

9 years ago[Mips] Rearrange relocation related cases in the `switch` operator
Simon Atanasyan [Sat, 6 Jun 2015 17:26:09 +0000 (17:26 +0000)]
[Mips] Rearrange relocation related cases in the `switch` operator

No functional changes.

llvm-svn: 239223

9 years ago[Mips] Use signed/unsigned types in relocation calculations consistently
Simon Atanasyan [Sat, 6 Jun 2015 17:26:04 +0000 (17:26 +0000)]
[Mips] Use signed/unsigned types in relocation calculations consistently

No functional changes.

llvm-svn: 239222

9 years ago[Mips] Handle all grouped relocations in a uniform way
Simon Atanasyan [Sat, 6 Jun 2015 17:25:58 +0000 (17:25 +0000)]
[Mips] Handle all grouped relocations in a uniform way

No functional changes.

llvm-svn: 239221

9 years agoUse skipIf instead of skipUnless in TestTerminal for better readability.
Chaoren Lin [Sat, 6 Jun 2015 14:51:34 +0000 (14:51 +0000)]
Use skipIf instead of skipUnless in TestTerminal for better readability.

llvm-svn: 239220

9 years agoAdd NVIDIA vprintf printing to RuntimeDebugBuilder
Tobias Grosser [Sat, 6 Jun 2015 08:43:22 +0000 (08:43 +0000)]
Add NVIDIA vprintf printing to RuntimeDebugBuilder

llvm-svn: 239219

9 years ago[LoopUnroll] Fix truncation bug in canUnrollCompletely.
Sanjoy Das [Sat, 6 Jun 2015 05:24:10 +0000 (05:24 +0000)]
[LoopUnroll] Fix truncation bug in canUnrollCompletely.

Summary:
canUnrollCompletely takes `unsigned` values for `UnrolledCost` and
`RolledDynamicCost` but is passed in `uint64_t`s that are silently
truncated.  Because of this, when `UnrolledSize` is a large integer
that has a small remainder with UINT32_MAX, LLVM tries to completely
unroll loops with high trip counts.

Reviewers: mzolotukhin, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 239218

9 years ago[CVP] Don't assume Constants of type i1 can be known to be true or false
David Majnemer [Sat, 6 Jun 2015 04:56:51 +0000 (04:56 +0000)]
[CVP] Don't assume Constants of type i1 can be known to be true or false

CVP wants to analyze the condition operand of a select along an edge.
It succeeds in getting back a Constant but not a ConstantInt.  Instead,
it gets a ConstantExpr.  It then assumes that the Constant must be equal
to false because it isn't equal to true.

Instead, perform an additional comparison.

This fixes PR23752.

llvm-svn: 239217

9 years agoCOFF: Merge Chunk::applyRelocations with Chunk::writeTo.
Rui Ueyama [Sat, 6 Jun 2015 04:07:39 +0000 (04:07 +0000)]
COFF: Merge Chunk::applyRelocations with Chunk::writeTo.

In this design, Chunk is the only thing that knows how to write
its contents to output file as well as how to apply relocations
there. The writer shouldn't know about the details.

llvm-svn: 239216

9 years ago[InstCombine] Don't miscompile select to poison
David Majnemer [Sat, 6 Jun 2015 02:30:43 +0000 (02:30 +0000)]
[InstCombine] Don't miscompile select to poison

If we have (select a, b, c), it is sometimes valid to simplify this to a
single select operand.  However, doing so is only valid if the
computation doesn't inject poison into the computation.

It might be helpful to consider the following example:
  (select (icmp ne %i, INT_MAX), (add nsw %i, 1), INT_MIN)

The select is equivalent to (add %i, 1) but not (add nsw %i, 1).

Self hosting on x86_64 revealed that this occurs very, very rarely so
bailing out is hopefully pretty reasonable.

llvm-svn: 239215

9 years agoHandle 16 bit PC relative relocations.
Rafael Espindola [Sat, 6 Jun 2015 02:29:56 +0000 (02:29 +0000)]
Handle 16 bit PC relative relocations.

Fixes pr23771.

llvm-svn: 239214

9 years agoclang-cl: Implement /GL in terms of -flto.
Peter Collingbourne [Sat, 6 Jun 2015 02:09:34 +0000 (02:09 +0000)]
clang-cl: Implement /GL in terms of -flto.

No documentation yet; the linker needs more work.

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

llvm-svn: 239213

9 years agoCOFF: Read linker directives from bitcode files.
Peter Collingbourne [Sat, 6 Jun 2015 02:00:45 +0000 (02:00 +0000)]
COFF: Read linker directives from bitcode files.

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

llvm-svn: 239212

9 years agoTargetParser: Fix comments in enum(s) introduced in r239150. [-Wdocumentation]
NAKAMURA Takumi [Sat, 6 Jun 2015 01:41:35 +0000 (01:41 +0000)]
TargetParser: Fix comments in enum(s) introduced in r239150. [-Wdocumentation]

llvm-svn: 239211

9 years ago[TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers...
Craig Topper [Sat, 6 Jun 2015 01:34:04 +0000 (01:34 +0000)]
[TableGen] Change OpInit::getNumOperands and getOperand to use unsigned integers. NFC

llvm-svn: 239210

9 years ago[TableGen] Remove trailing whitespace, add space between 'if' and paren, other format...
Craig Topper [Sat, 6 Jun 2015 01:34:01 +0000 (01:34 +0000)]
[TableGen] Remove trailing whitespace, add space between 'if' and paren, other formatting fixes. NFC

llvm-svn: 239209

9 years ago[TableGen] Remove unnecessary temporary. NFC
Craig Topper [Sat, 6 Jun 2015 01:34:00 +0000 (01:34 +0000)]
[TableGen] Remove unnecessary temporary. NFC

llvm-svn: 239208

9 years ago[TableGen] Fold variable declaration/initialization into if condition for a couple...
Craig Topper [Sat, 6 Jun 2015 01:33:58 +0000 (01:33 +0000)]
[TableGen] Fold variable declaration/initialization into if condition for a couple short lived variables. NFC

llvm-svn: 239207

9 years ago[TableGen] Remove unnecessary outer 'if' and merge it's conditions into the inner...
Craig Topper [Sat, 6 Jun 2015 01:33:55 +0000 (01:33 +0000)]
[TableGen] Remove unnecessary outer 'if' and merge it's conditions into the inner 'if's. NFC

llvm-svn: 239206