platform/upstream/llvm.git
9 years agoEliminate unnecessary namespace to prevent conflicts.
Tyler Nowicki [Mon, 8 Jun 2015 23:27:35 +0000 (23:27 +0000)]
Eliminate unnecessary namespace to prevent conflicts.

llvm-svn: 239365

9 years ago[asan] Fixup to r239134. This test does pass on darwin.
Anna Zaks [Mon, 8 Jun 2015 23:24:55 +0000 (23:24 +0000)]
[asan] Fixup to r239134. This test does pass on darwin.

This should restore the darwin buildbot.

llvm-svn: 239364

9 years agoCorrect Loop Hint Diagnostic Message
Tyler Nowicki [Mon, 8 Jun 2015 23:13:43 +0000 (23:13 +0000)]
Correct Loop Hint Diagnostic Message

When pragma clang loop unroll() is specified without an argument the diagnostic message should inform that user that 'full' and 'disable' are valid arguments (not 'enable').

llvm-svn: 239363

9 years agoMoved CPP CodeGen tests into CodeGenCXX.
Tyler Nowicki [Mon, 8 Jun 2015 22:53:36 +0000 (22:53 +0000)]
Moved CPP CodeGen tests into CodeGenCXX.

llvm-svn: 239362

9 years ago[WinEH] Cache declarations of frame intrinsics
Reid Kleckner [Mon, 8 Jun 2015 22:43:32 +0000 (22:43 +0000)]
[WinEH] Cache declarations of frame intrinsics

llvm-svn: 239361

9 years agoIntroduce a TypeSystem interface to support adding non-clang languages.
Pavel Labath [Mon, 8 Jun 2015 22:27:10 +0000 (22:27 +0000)]
Introduce a TypeSystem interface to support adding non-clang languages.

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D8712
Original Author: Ryan Brown <ribrdb@google.com>

llvm-svn: 239360

9 years agoSkip TestInferiorChanged if host platform is windows.
Chaoren Lin [Mon, 8 Jun 2015 22:13:28 +0000 (22:13 +0000)]
Skip TestInferiorChanged if host platform is windows.

Summary: Opened files on Windows cannot be modified, so this test doesn't make sense.

Reviewers: ovyalov, zturner, flackr, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 239359

9 years agoFix TestSymbolContext for remote Windows to Android.
Chaoren Lin [Mon, 8 Jun 2015 22:12:58 +0000 (22:12 +0000)]
Fix TestSymbolContext for remote Windows to Android.

Summary: Denormalize path returned by SBFileSpec::GetDirectory().

Reviewers: zturner, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 239358

9 years ago[MC] Use unsigned for the Kind bitfield in MCSymbol
Reid Kleckner [Mon, 8 Jun 2015 22:12:44 +0000 (22:12 +0000)]
[MC] Use unsigned for the Kind bitfield in MCSymbol

Fixes most of the test suite on Windows with clang-cl.

I'm not sure why the test suite was passing with MSVC 2013. Maybe they
changed their behavior and we are emulating their old sign extension
behavior. I think this deserves more investigation, but I want to green
the bot first.

llvm-svn: 239357

9 years agoConsider unsigned long for non-u/U decimal literals (C90/C++03)
Hubert Tong [Mon, 8 Jun 2015 21:59:59 +0000 (21:59 +0000)]
Consider unsigned long for non-u/U decimal literals (C90/C++03)

Summary:
This modifies Clang to reflect that under pre-C99 ISO C, decimal
constants may have type `unsigned long` even if they do not contain `u`
or `U` in their suffix (C90 subclause 6.1.3.2 paragraph 5). The same is
done for C++ without C++11 which--because of undefined behaviour--allows
for behaviour compatible with ISO C90 in the case of an unsuffixed
decimal literal and is otherwise identical to C90 in its treatment of
integer literals (C++03 subclause 2.13.1 [lex.icon] paragraph 2).

Messages are added to the `c99-compat` and `c++11-compat` groups to warn
on such literals, since they behave differently under the newer
standards.

Fixes PR 16678.

Test Plan:
A new test file is added to exercise both pre-C99/C++11 and C99/C++11-up
on decimal literals with no suffix or suffixes `l`/`L` for both 32-bit
and 64-bit `long`.

In the file, 2^31 (being `INT_MAX+1`) is tested for the expected type
using `__typeof__` and multiple declarations of the same entity. 2^63
is similarly tested when it is within the range of `unsigned long`.

Preprocessor arithmetic tests are added to ensure consistency given
that Clang (like GCC) uses greater than 32 bits for preprocessor
arithmetic even when `long` and `unsigned long` is 32 bits and a
pre-C99/C++11 mode is in effect.

Tests added:
  test/Sema/PR16678.c

Reviewers: fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 239356

9 years agoFix clang-cl self-host -Wc++11-narrowing bug
Reid Kleckner [Mon, 8 Jun 2015 21:57:57 +0000 (21:57 +0000)]
Fix clang-cl self-host -Wc++11-narrowing bug

Use unsigned as the underlying storage type of the AMDGPU address space
enum.

llvm-svn: 239355

9 years agoIf we have a MachO file loaded from memory, make sure we can always get the symbol...
Greg Clayton [Mon, 8 Jun 2015 21:53:11 +0000 (21:53 +0000)]
If we have a MachO file loaded from memory, make sure we can always get the symbol table even if we don't have the __LINKEDIT load address set in the target.

<rdar://problem/21208168>

llvm-svn: 239354

9 years ago[AArch64] AsmParser should be case insensitive about accepting vector register names.
Ranjeet Singh [Mon, 8 Jun 2015 21:32:16 +0000 (21:32 +0000)]
[AArch64] AsmParser should be case insensitive about accepting vector register names.

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

llvm-svn: 239353

9 years ago[asan] Disable asan for aarch64.
Evgeniy Stepanov [Mon, 8 Jun 2015 21:07:24 +0000 (21:07 +0000)]
[asan] Disable asan for aarch64.

lib/Target/AArch64/AArch64FrameLowering.cpp:370: virtual void llvm::AArch64FrameLowering::emitPrologue(llvm::MachineFunction&, llvm::MachineBasicBlock&) const: Assertion `!(NeedsRealignment && NumBytes==0) && "NumBytes should never be 0 when realignment is needed"' failed.

llvm-svn: 239352

9 years agoCOFF: Skip internal symbols in bitcode files.
Peter Collingbourne [Mon, 8 Jun 2015 20:21:28 +0000 (20:21 +0000)]
COFF: Skip internal symbols in bitcode files.

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

llvm-svn: 239338

9 years agoRemove unused variables '__kmp_build_check_*'
Jonathan Peyton [Mon, 8 Jun 2015 20:18:10 +0000 (20:18 +0000)]
Remove unused variables '__kmp_build_check_*'

As an ongoing effort to sanitize the openmp code, this one word change
eliminates creating 1 byte arrays named __kmp_build_check_* and instead
creates one byte array types.  The KMP_BUILD_ASSERT macro still offers the same
functionality; array types with negative number of elements is illegal
and will cause a compiler failure.

llvm-svn: 239337

9 years ago[InstrInfo] Refactor foldOperandImpl to thread through InsertPt. NFC
Keno Fischer [Mon, 8 Jun 2015 20:09:58 +0000 (20:09 +0000)]
[InstrInfo] Refactor foldOperandImpl to thread through InsertPt. NFC

Summary:
This was a longstanding FIXME and is a necessary precursor to cases
where foldOperandImpl may have to create more than one instruction
(e.g. to constrain a register class). This is the split out NFC changes from
D6262.

Reviewers: pete, ributzka, uweigand, mcrosier

Reviewed By: mcrosier

Subscribers: mcrosier, ted, llvm-commits

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

llvm-svn: 239336

9 years agoFix a regression in .pop_section.
Rafael Espindola [Mon, 8 Jun 2015 20:08:55 +0000 (20:08 +0000)]
Fix a regression in .pop_section.

It was calling ChangeSection with the wrong current section, eventually leading
to a crash.

llvm-svn: 239335

9 years agoRemove unused variable warnings by deletion.
Jonathan Peyton [Mon, 8 Jun 2015 20:01:14 +0000 (20:01 +0000)]
Remove unused variable warnings by deletion.

As an ongoing effort to sanitize the openmp code, these changes delete
variables that aren't used at all.
http://lists.cs.uiuc.edu/pipermail/openmp-dev/2015-June/000701.html

Patch by Jack Howarth

llvm-svn: 239334

9 years ago[X86][SSE] Added lzcnt vector tests.
Simon Pilgrim [Mon, 8 Jun 2015 19:58:43 +0000 (19:58 +0000)]
[X86][SSE] Added lzcnt vector tests.

llvm-svn: 239333

9 years agoCOFF: Read symbol names lazily.
Rui Ueyama [Mon, 8 Jun 2015 19:43:59 +0000 (19:43 +0000)]
COFF: Read symbol names lazily.

This change seems to make the linker about 10% faster.
Reading symbol name is not very cheap because it needs strlen()
on the string table. We were wasting time on reading non-external
symbol names that would never be used by the linker.

llvm-svn: 239332

9 years agoRemove unused variable warnings by moving variables.
Jonathan Peyton [Mon, 8 Jun 2015 19:39:07 +0000 (19:39 +0000)]
Remove unused variable warnings by moving variables.

As an ongoing effort to sanitize the openmp code, these changes move
variables under already existing macro guards.

Patch by Jack Howarth

llvm-svn: 239331

9 years agoRemove unused variable warnings by adding proper macro guards.
Jonathan Peyton [Mon, 8 Jun 2015 19:25:25 +0000 (19:25 +0000)]
Remove unused variable warnings by adding proper macro guards.

As an ongoing effort to sanitize the openmp code, these changes remove unused variables
by adding proper macros around both variables and functions.

Patch by Jack Howarth

llvm-svn: 239330

9 years agoInclude header file <functional>.
Akira Hatanaka [Mon, 8 Jun 2015 19:03:32 +0000 (19:03 +0000)]
Include header file <functional>.

This is a follow-up to r239325.

llvm-svn: 239329

9 years agoPrefer copy init over direct init. NFC.
Benjamin Kramer [Mon, 8 Jun 2015 18:58:57 +0000 (18:58 +0000)]
Prefer copy init over direct init. NFC.

llvm-svn: 239327

9 years agoRemove unused variable warnings by fooling compiler.
Jonathan Peyton [Mon, 8 Jun 2015 18:56:33 +0000 (18:56 +0000)]
Remove unused variable warnings by fooling compiler.

Some variables are convenient to keep around even if they aren't
really used in a release build.  This is often seen in DEBUG guarded code where the variable
is only used in a DEBUG build.

Patch by Jack Howarth

llvm-svn: 239326

9 years ago[ARM] Pass a callback to FunctionPass constructors to enable skipping execution
Akira Hatanaka [Mon, 8 Jun 2015 18:50:43 +0000 (18:50 +0000)]
[ARM] Pass a callback to FunctionPass constructors to enable skipping execution
on a per-function basis.

Previously some of the passes were conditionally added to ARM's pass pipeline
based on the target machine's subtarget. This patch makes changes to add those
passes unconditionally and execute them conditonally based on the predicate
functor passed to the pass constructors. This enables running different sets of
passes for different functions in the module.

rdar://problem/20542263

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

llvm-svn: 239325

9 years agoUse a PointerUnion in MCSymbol for Section and Fragment. NFC.
Pete Cooper [Mon, 8 Jun 2015 18:41:57 +0000 (18:41 +0000)]
Use a PointerUnion in MCSymbol for Section and Fragment.  NFC.

The Fragment and Section, and a bool for HasFragment were all used to create
a PointerUnion.  Just use a pointer union instead.

llvm-svn: 239324

9 years agoRemoved unused functions.
Jonathan Peyton [Mon, 8 Jun 2015 18:38:23 +0000 (18:38 +0000)]
Removed unused functions.

As an ongoing effort to sanitize the openmp code, these changes remove unused functions.
The unused functions are:
__kmp_fini_allocator_thread(), __kmp_env_isDefined(), __kmp_strip_quotes(),
__kmp_convert_to_seconds(), and __kmp_convert_to_nanoseconds().

Patch by Jack Howarth

llvm-svn: 239323

9 years ago[asan] Enable AArch64 build of ASan runtime and tests.
Evgeniy Stepanov [Mon, 8 Jun 2015 18:19:26 +0000 (18:19 +0000)]
[asan] Enable AArch64 build of ASan runtime and tests.

llvm-svn: 239322

9 years ago[asan] Fix Android build for API >= 21.
Evgeniy Stepanov [Mon, 8 Jun 2015 18:15:52 +0000 (18:15 +0000)]
[asan] Fix Android build for API >= 21.

/code/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:971:8: error: address of function 'dl_iterate_phdr' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
  if (!dl_iterate_phdr)
      ~^~~~~~~~~~~~~~~
/code/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:971:8: note: prefix with the address-of operator to silence this warning
  if (!dl_iterate_phdr)
       ^
       &

llvm-svn: 239321

9 years ago[asan] Fix build of AsanNoinstTest on Android.
Evgeniy Stepanov [Mon, 8 Jun 2015 18:03:33 +0000 (18:03 +0000)]
[asan] Fix build of AsanNoinstTest on Android.

Some of the asan-ubsan build changes were not replicated in the android branch in CMakeLists.

llvm-svn: 239320

9 years agoRemove includes of MCMachOSymbolFlags.h after it was deleted
Pete Cooper [Mon, 8 Jun 2015 17:25:57 +0000 (17:25 +0000)]
Remove includes of MCMachOSymbolFlags.h after it was deleted

llvm-svn: 239318

9 years agoMake flags get/set method protected so that all flags have to be managed by subclasses.
Pete Cooper [Mon, 8 Jun 2015 17:17:30 +0000 (17:17 +0000)]
Make flags get/set method protected so that all flags have to be managed by subclasses.

All of ELF, COFF and MachO now manipulate the flags in helpers so we don't need
anyone to read the flags directly, but instead via those helpers.

Reviewed by Rafael Espíndola.

llvm-svn: 239317

9 years agoMove all flags logic to MCSymbolMachO.
Pete Cooper [Mon, 8 Jun 2015 17:17:28 +0000 (17:17 +0000)]
Move all flags logic to MCSymbolMachO.

Also delete the now unused MCMachOSymbolFlags.h header as the only enum in there was moved to MCSymbolMachO.

Similarly to ELF and COFF, manipulating the flags is now done via helpers instead of spread
throughout the codebase.

Reviewed by Rafael Espíndola.

llvm-svn: 239316

9 years agoAdd MCSymbolMachO which will be used to hide the MCSymbolMachO flags.
Pete Cooper [Mon, 8 Jun 2015 17:17:23 +0000 (17:17 +0000)]
Add MCSymbolMachO which will be used to hide the MCSymbolMachO flags.

Reviewed by Rafael Espíndola.

llvm-svn: 239315

9 years agoMove all of the MCSymbol COFF flags logic in to MCSymbolCOFF.
Pete Cooper [Mon, 8 Jun 2015 17:17:19 +0000 (17:17 +0000)]
Move all of the MCSymbol COFF flags logic in to MCSymbolCOFF.

All flags setting/getting is now done in the class with helper methods instead
of users having to get the bits in the correct order.

Reviewed by Rafael Espíndola.

llvm-svn: 239314

9 years agoMove COFF Type in to the MCSymbolCOFF class.
Pete Cooper [Mon, 8 Jun 2015 17:17:16 +0000 (17:17 +0000)]
Move COFF Type in to the MCSymbolCOFF class.

The flags field in MCSymbol only needs to be 16-bits on ELF and MachO.
This moves the 16-bit Type out of there so that it can be reduced in size in a future commit.

Reviewed by Rafael Espíndola.

llvm-svn: 239313

9 years agoAdd MCSymbolCOFF class and use it to get and set the COFF type field.
Pete Cooper [Mon, 8 Jun 2015 17:17:12 +0000 (17:17 +0000)]
Add MCSymbolCOFF class and use it to get and set the COFF type field.

Reviewed by Rafael Espíndola.

llvm-svn: 239312

9 years agoChange MCSymbol IsELF to an enum to support future MCSymbolCOFF and MCSymbolMachO.
Pete Cooper [Mon, 8 Jun 2015 17:17:09 +0000 (17:17 +0000)]
Change MCSymbol IsELF to an enum to support future MCSymbolCOFF and MCSymbolMachO.

Reviewed by Rafael Espíndola.

llvm-svn: 239311

9 years agoSwitch from setPrintImmHex to setPrintHexStyle to follow changes from r239263.
Oleksiy Vyalov [Mon, 8 Jun 2015 17:10:27 +0000 (17:10 +0000)]
Switch from setPrintImmHex to setPrintHexStyle to follow changes from r239263.

llvm-svn: 239310

9 years agoX86: Reject register operands with obvious type mismatches.
Matthias Braun [Mon, 8 Jun 2015 16:56:23 +0000 (16:56 +0000)]
X86: Reject register operands with obvious type mismatches.

While we have some code to transform specification like {ax} into
{eax}/{rax} if the operand type isn't 16bit, we should reject cases
where there is no sane way to do this, like the i128 type in the
example.

Related to rdar://21042280

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

llvm-svn: 239309

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