platform/upstream/llvm.git
8 years ago[LTO] Discard names for values that are not global by default.
Davide Italiano [Thu, 21 Apr 2016 17:46:38 +0000 (17:46 +0000)]
[LTO] Discard names for values that are not global by default.

Rafael reported on the mailing list that this reduces peak memory
usage while linking llvm-as by 15%. It makes sense to make it
the default, and introduce an inverse knob -lto-no-discard-value-names
for those who want to restore the old behavior.

llvm-svn: 267020

8 years ago[unordered] unordered loads from null are still unreachable
Philip Reames [Thu, 21 Apr 2016 17:45:05 +0000 (17:45 +0000)]
[unordered] unordered loads from null are still unreachable

llvm-svn: 267019

8 years agoReduce templating. NFC.
Rafael Espindola [Thu, 21 Apr 2016 17:37:11 +0000 (17:37 +0000)]
Reduce templating. NFC.

llvm-svn: 267018

8 years ago[PowerPC] [SSP] Fix stack guard load for 32-bit.
Marcin Koscielnicki [Thu, 21 Apr 2016 17:36:05 +0000 (17:36 +0000)]
[PowerPC] [SSP] Fix stack guard load for 32-bit.

r266809 incorrectly used LD to load the stack guard, it should be LWZ.

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

llvm-svn: 267017

8 years ago[LoopUtils] Fix typo in comment
Adam Nemet [Thu, 21 Apr 2016 17:33:22 +0000 (17:33 +0000)]
[LoopUtils] Fix typo in comment

llvm-svn: 267016

8 years ago[LoopUtils] Add asserts to findStringMetadataForLoop. NFC
Adam Nemet [Thu, 21 Apr 2016 17:33:20 +0000 (17:33 +0000)]
[LoopUtils] Add asserts to findStringMetadataForLoop. NFC

These ensure that operand array has at least one element and it is the
self-reference.

llvm-svn: 267015

8 years ago[LoopUtils] Move def of findStringMetadataForLoop to LoopUtils.cpp. NFC
Adam Nemet [Thu, 21 Apr 2016 17:33:17 +0000 (17:33 +0000)]
[LoopUtils] Move def of findStringMetadataForLoop to LoopUtils.cpp. NFC

The decl is in LoopUtils.h.  I think that this was added to
LoopVersioningLICM.cpp by mistake.

llvm-svn: 267014

8 years ago[LoopUtils] Rename {check->find}StringMetadata{Into->For}Loop. NFC
Adam Nemet [Thu, 21 Apr 2016 17:33:12 +0000 (17:33 +0000)]
[LoopUtils] Rename {check->find}StringMetadata{Into->For}Loop. NFC

"Into" was misleading.  I am also planning to use this helper to look
for loop metadata and return the argument, so find seems like a better
name.

llvm-svn: 267013

8 years agoDelete the needsPlt target hook.
Rafael Espindola [Thu, 21 Apr 2016 17:30:24 +0000 (17:30 +0000)]
Delete the needsPlt target hook.

It can be made redundant with getRelExpr.

llvm-svn: 267012

8 years ago[clang-tidy] New checker to detect suspicious string constructor.
Etienne Bergeron [Thu, 21 Apr 2016 17:28:08 +0000 (17:28 +0000)]
[clang-tidy] New checker to detect suspicious string constructor.

Summary:
Checker to validate string constructor parameters.

A common mistake is to swap parameter for the fill-constructor.
```
  std::string str('x', 4);
  std::string str('4', x);
```

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 267011

8 years agoFix builds broken in r267008.
Eugene Zelenko [Thu, 21 Apr 2016 17:27:04 +0000 (17:27 +0000)]
Fix builds broken in r267008.

llvm-svn: 267010

8 years ago[clang-tidy] Add new checker for comparison with runtime string functions.
Etienne Bergeron [Thu, 21 Apr 2016 17:19:36 +0000 (17:19 +0000)]
[clang-tidy] Add new checker for comparison with runtime string functions.

Summary:
This checker is validating suspicious usage of string compare functions.

Example:
```
  if (strcmp(...))       // Implicitly compare to zero
  if (!strcmp(...))      // Won't warn
  if (strcmp(...) != 0)  // Won't warn
```

This patch was checked over large amount of code.
There is three checks:
  [*] Implicit comparator to zero (coding-style, many warnings found),
  [*] Suspicious implicit cast to non-integral (bugs!?, almost none found),
  [*] Comparison to suspicious constant (bugs!?, found two cases),

Example:
[[https://github.com/kylepjohnson/sigma/blob/master/sigma/native-installers/debian/dependencies/files/opt/sigma/E/HEURISTICS/che_to_precgen.c |
https://github.com/kylepjohnson/sigma/blob/master/sigma/native-installers/debian/dependencies/files/opt/sigma/E/HEURISTICS/che_to_precgen.c]]

```
      else if(strcmp(id, "select") == 0)
      {
         array->array[i].key1 = 25;
      }
      else if(strcmp(id, "sk") == 28)      // BUG!?
      {
         array->array[i].key1 = 20;
      }
```

Reviewers: alexfh

Subscribers: Eugene.Zelenko, cfe-commits

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

llvm-svn: 267009

8 years agoFix Clang-tidy misc-unused-using-decls and Include What You Use warnings.
Eugene Zelenko [Thu, 21 Apr 2016 17:14:10 +0000 (17:14 +0000)]
Fix Clang-tidy misc-unused-using-decls and Include What You Use warnings.

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

llvm-svn: 267008

8 years ago[LTO] An interesting case which shows up how we handle common symbols.
Davide Italiano [Thu, 21 Apr 2016 17:11:39 +0000 (17:11 +0000)]
[LTO] An interesting case which shows up how we handle common symbols.

The gold plugin logic for common symbols is a little bit convoluted
as the plugin API has not an explicit way to update the alignment.
In gold, then, we need to keep the bitcode symbol @a around because
that's the only way to get the alignment right in the final object.

In lld, this is not true. We already have all the informations we
need about common symbols (size/alignment) so we don't have to
keep the existing symbol and pass it to the mover.

llvm-svn: 267007

8 years ago[instcombine][unordered] Implement *-load forwarding for unordered atomics
Philip Reames [Thu, 21 Apr 2016 17:03:33 +0000 (17:03 +0000)]
[instcombine][unordered] Implement *-load forwarding for unordered atomics

This builds on 266999 which made FindAvailableValue do the right thing.  Tests included show the newly enabled transforms and those which disabled either due to conservatism or correctness requirements.

llvm-svn: 267006

8 years agoDon't recompute getRelExpr. NFC.
Rafael Espindola [Thu, 21 Apr 2016 16:59:25 +0000 (16:59 +0000)]
Don't recompute getRelExpr. NFC.

llvm-svn: 267005

8 years agoFixed Dwarf debug info emission to skip DILexicalBlockFile entries.
Amjad Aboud [Thu, 21 Apr 2016 16:58:49 +0000 (16:58 +0000)]
Fixed Dwarf debug info emission to skip DILexicalBlockFile entries.
Before this fix, DILexicalBlockFile entries were skipped only in some cases and were not in other cases.

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

llvm-svn: 267004

8 years ago[clang-tidy] Cleanup some ast-matchers and lift some to utils.
Etienne Bergeron [Thu, 21 Apr 2016 16:57:56 +0000 (16:57 +0000)]
[clang-tidy] Cleanup some ast-matchers and lift some to utils.

Summary:
Little cleanup to lift-out and to remove some frequently used
ast-matchers.

Some of theses matchers are candidates to be lifted to ASTMatchers.h.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 267003

8 years agoMoves needsPlt to Writer.cpp.
Rafael Espindola [Thu, 21 Apr 2016 16:57:32 +0000 (16:57 +0000)]
Moves needsPlt to Writer.cpp.

It was only used there.

llvm-svn: 267002

8 years agoAPI: fix a -Wunused-variable warning
Saleem Abdulrasool [Thu, 21 Apr 2016 16:56:02 +0000 (16:56 +0000)]
API: fix a -Wunused-variable warning

expr_log is only conditionally used via preprocessing.  Ensure that we guard the
definition accordingly.  NFC.

llvm-svn: 267001

8 years agoHost: fix some -Wformat-pedantic warnings
Saleem Abdulrasool [Thu, 21 Apr 2016 16:55:58 +0000 (16:55 +0000)]
Host: fix some -Wformat-pedantic warnings

Add explicit casts for function pointer to void * for %p conversion.  NFC.

llvm-svn: 267000

8 years ago[unordered] Add tests and conservative handling in support of future changes [NFCI]
Philip Reames [Thu, 21 Apr 2016 16:51:08 +0000 (16:51 +0000)]
[unordered] Add tests and conservative handling in support of future changes [NFCI]

This change adds a couple of test cases to make sure FindAvailableLoadedValue does the right thing.  At the moment, the code added is dead, but separating it makes follow on changes far more obvious.

llvm-svn: 266999

8 years agoAddress Philip's post-commit feedback for r266987. NFC.
Chad Rosier [Thu, 21 Apr 2016 16:18:02 +0000 (16:18 +0000)]
Address Philip's post-commit feedback for r266987. NFC.

llvm-svn: 266998

8 years agoMinor comment cleanup [NFC]
Philip Reames [Thu, 21 Apr 2016 16:15:19 +0000 (16:15 +0000)]
Minor comment cleanup [NFC]

llvm-svn: 266997

8 years agoFix test to run everywhere.
Rafael Espindola [Thu, 21 Apr 2016 15:51:28 +0000 (15:51 +0000)]
Fix test to run everywhere.

Because of X86 instead of x86 is was masked as unsupported everywhere.

llvm-svn: 266996

8 years agoFix recursive -only-needed.
Rafael Espindola [Thu, 21 Apr 2016 14:56:33 +0000 (14:56 +0000)]
Fix recursive -only-needed.

We were assuming that only linkonce_odr GVs were lazy linked.

llvm-svn: 266995

8 years ago[tsan] Rename ReportThread->pid to ReportThread->os_id
Kuba Brecka [Thu, 21 Apr 2016 14:49:25 +0000 (14:49 +0000)]
[tsan] Rename ReportThread->pid to ReportThread->os_id

The field "pid" in ReportThread is used to store the OS-provided thread ID (pthread_self or gettid). The name "pid" suggests it's a process ID, which it isn't. Let's rename it.

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

llvm-svn: 266994

8 years ago[x86] Force mixes asm syntax test to check for x86
Renato Golin [Thu, 21 Apr 2016 14:40:06 +0000 (14:40 +0000)]
[x86] Force mixes asm syntax test to check for x86

llvm-svn: 266993

8 years ago[Clang-tidy] Fix for crash in modernize-raw-string-literal check
Alexander Kornienko [Thu, 21 Apr 2016 14:39:12 +0000 (14:39 +0000)]
[Clang-tidy] Fix for crash in modernize-raw-string-literal check

Summary:
Clang-tidy modernize-raw-string-literal check crashes on run-time assert while it is evaluating compiler predefined identifiers such as
- __FUNCTION__
- __func__
- __PRETTY_FUNCTION__

Check is asserting because it cannot find opening quote for such string literal. It occurs only on debug build config.
I think that it would be good to prune such cases by crossing off predefined expressions - there is no need to evaluate such matches.

Reviewers: LegalizeAdulthood, alexfh

Subscribers: cfe-commits

Patch by Marek Jenda!

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

llvm-svn: 266992

8 years ago[sanitizer] Use pthread_threadid_np as thread ID on OS X
Kuba Brecka [Thu, 21 Apr 2016 14:38:41 +0000 (14:38 +0000)]
[sanitizer] Use pthread_threadid_np as thread ID on OS X

Let's use pthread_threadid_np which returns a more reasonable ID than pthread_self (which is actually a stack pointer). The numbers from pthread_threadid_np are already used in other tools, e.g. in LLDB, and often appear in logs, so it's much more useful than pthread_self.

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

llvm-svn: 266991

8 years ago[mips][microMIPS] Implement ldpc instruction
Zoran Jovanovic [Thu, 21 Apr 2016 14:32:12 +0000 (14:32 +0000)]
[mips][microMIPS] Implement ldpc instruction

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

llvm-svn: 266990

8 years ago[Hexagon] Define architecture version macros for hexagonv55
Krzysztof Parzyszek [Thu, 21 Apr 2016 14:30:04 +0000 (14:30 +0000)]
[Hexagon] Define architecture version macros for hexagonv55

llvm-svn: 266989

8 years ago[mips][microMIPS] Add R_MICROMIPS_PC19_S2 relocation
Zoran Jovanovic [Thu, 21 Apr 2016 14:09:35 +0000 (14:09 +0000)]
[mips][microMIPS] Add R_MICROMIPS_PC19_S2 relocation

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

llvm-svn: 266988

8 years agoRefactor implied condition logic from ValueTracking directly into CmpInst. NFC.
Chad Rosier [Thu, 21 Apr 2016 14:04:54 +0000 (14:04 +0000)]
Refactor implied condition logic from ValueTracking directly into CmpInst. NFC.

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

llvm-svn: 266987

8 years agoClarify memory ownership semantics; NFC.
Aaron Ballman [Thu, 21 Apr 2016 13:51:07 +0000 (13:51 +0000)]
Clarify memory ownership semantics; NFC.

Patch by Clement Courbet

llvm-svn: 266986

8 years ago[mips][microMIPS] Add R_MICROMIPS_PC26_S1 relocation
Zoran Jovanovic [Thu, 21 Apr 2016 13:43:26 +0000 (13:43 +0000)]
[mips][microMIPS] Add R_MICROMIPS_PC26_S1 relocation

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

llvm-svn: 266985

8 years ago[AMDGPU] Assembler: prevent parseDPPCtrlOps from eating invalid tokens
Sam Kolton [Thu, 21 Apr 2016 13:14:24 +0000 (13:14 +0000)]
[AMDGPU] Assembler: prevent parseDPPCtrlOps from eating invalid tokens

Reviewers: nhaustov, tstellarAMD

Subscribers: arsenm

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

llvm-svn: 266984

8 years ago[Clang][AVX512][BuiltIn] Adding intrinsics of VGATHER{DPS|DPD} , VPGATHER{QD|QQ|DD...
Michael Zuckerman [Thu, 21 Apr 2016 12:47:27 +0000 (12:47 +0000)]
[Clang][AVX512][BuiltIn] Adding intrinsics of VGATHER{DPS|DPD} , VPGATHER{QD|QQ|DD|DQ} and VGATHERPF{0|1}{DPS|QPS|DPD|QPD} instruction set .

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

llvm-svn: 266983

8 years agoUse llvm::CachedHash.
Rafael Espindola [Thu, 21 Apr 2016 12:21:06 +0000 (12:21 +0000)]
Use llvm::CachedHash.

llvm-svn: 266982

8 years agoAdd a CachedHash structure.
Rafael Espindola [Thu, 21 Apr 2016 12:16:21 +0000 (12:16 +0000)]
Add a CachedHash structure.

A DenseMap doesn't store the hashes, so it needs to recompute them when
the table is resized.

In some applications the hashing cost is noticeable. That is the case
for example in lld for symbol names (StringRef).

This patch adds a templated structure that can wraps any value that can
go in a DenseMap and caches the hash.

llvm-svn: 266981

8 years ago[mips][microMIPS] Implement TLBP, TLBR, TLBWI and TLBWR instructions
Zlatko Buljan [Thu, 21 Apr 2016 11:32:40 +0000 (11:32 +0000)]
[mips][microMIPS] Implement TLBP, TLBR, TLBWI and TLBWR instructions
Differential Revision: http://reviews.llvm.org/D18855

llvm-svn: 266980

8 years ago[ELF] - Make LinkerScript::getSectionOrder private. NFC.
George Rimar [Thu, 21 Apr 2016 11:28:11 +0000 (11:28 +0000)]
[ELF] - Make LinkerScript::getSectionOrder private. NFC.

llvm-svn: 266979

8 years ago[ELF] - Use ArrayRef instead of std::vector& for LinkerScript module. NFC.
George Rimar [Thu, 21 Apr 2016 11:21:48 +0000 (11:21 +0000)]
[ELF] - Use ArrayRef instead of std::vector& for LinkerScript module. NFC.

llvm-svn: 266978

8 years ago[mips][microMIPS] Implement LL, SC, MOVEP, ROTR, ROTRV and SYSCALL instructions and...
Zlatko Buljan [Thu, 21 Apr 2016 11:01:51 +0000 (11:01 +0000)]
[mips][microMIPS] Implement LL, SC, MOVEP, ROTR, ROTRV and SYSCALL instructions and add tests for LWM32 and SWM32
Differential Revision: http://reviews.llvm.org/D19150

llvm-svn: 266977

8 years agoCorrectly parse GCC-style asm line following MS-style asm line.
Denis Zobnin [Thu, 21 Apr 2016 10:59:18 +0000 (10:59 +0000)]
Correctly parse GCC-style asm line following MS-style asm line.

Quit parsing MS-style inline assembly if the following statement has GCC style.
Enables compilation of code like

void f() {
  __asm mov ebx, ecx
  __asm__("movl %ecx, %edx");
}

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

llvm-svn: 266976

8 years agoBack out the test case for r266973 for now.
Benjamin Kramer [Thu, 21 Apr 2016 10:46:14 +0000 (10:46 +0000)]
Back out the test case for r266973 for now.

It breaks on windows, need to investigate. It's not testing the
important part of that change anyways.

llvm-svn: 266975

8 years ago[ELF] - Get rid of SectionOrder array.
George Rimar [Thu, 21 Apr 2016 10:22:02 +0000 (10:22 +0000)]
[ELF] - Get rid of SectionOrder array.

SectionOrder vector was a part of LinkerScript class.

It can be removed because Commands vector contains the
same information and SectiorOrder is just a subset.

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

llvm-svn: 266974

8 years ago[Tooling] Inject -resource-dir instead of overwriting argv[0].
Benjamin Kramer [Thu, 21 Apr 2016 10:18:18 +0000 (10:18 +0000)]
[Tooling] Inject -resource-dir instead of overwriting argv[0].

This allows using a different standard library (the one from argv[0] in
the compilation database) with the correct builtins.

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

llvm-svn: 266973

8 years agoCompilation for Intel MCU (Part 1/3)
Andrey Turetskiy [Thu, 21 Apr 2016 10:16:48 +0000 (10:16 +0000)]
Compilation for Intel MCU (Part 1/3)

Add -miamcu option which:
  * Sets IAMCU triple
  * Sets IAMCU ABI
  * Enforces static compilation

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

llvm-svn: 266972

8 years agoUpdated a test not to produce an empty s-file.
Evgeny Astigeevich [Thu, 21 Apr 2016 09:36:49 +0000 (09:36 +0000)]
Updated a test not to produce an empty s-file.

llvm-svn: 266971

8 years agoFix cast compiler warning message in include-fixer.
Haojian Wu [Thu, 21 Apr 2016 09:16:32 +0000 (09:16 +0000)]
Fix cast compiler warning message in include-fixer.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 266970

8 years ago[AArch64][CodeGen] Fix of PR27158: incorrect peephole optimization in AArch64InstrInf...
Evgeny Astigeevich [Thu, 21 Apr 2016 08:54:08 +0000 (08:54 +0000)]
[AArch64][CodeGen] Fix of PR27158: incorrect peephole optimization in AArch64InstrInfo::optimizeCompareInstr

AArch64InstrInfo::optimizeCompareInstr has bug PR27158 which causes generation of incorrect code.
A compare instruction is substituted with another instruction which does not
produce the same flags as the original compare instruction.
This patch contains:
1. Fix of the bug.
2. A regression test in MIR.
3. A new test to check that SUBS is replaced by SUB.

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

llvm-svn: 266969

8 years ago[AVX512] Add CTTZ support for v8i64 and v16i32 vectors.
Craig Topper [Thu, 21 Apr 2016 07:30:06 +0000 (07:30 +0000)]
[AVX512] Add CTTZ support for v8i64 and v16i32 vectors.

llvm-svn: 266968

8 years ago[X86] Fix vector-tzcnt-512 test to disable CDI while enabling BWI for one of the...
Craig Topper [Thu, 21 Apr 2016 07:30:03 +0000 (07:30 +0000)]
[X86] Fix vector-tzcnt-512 test to disable CDI while enabling BWI for one of the runs. Update check patterns accordingly.

llvm-svn: 266967

8 years agoFix test command line to explicitly disable CDI instructions for one test.
Craig Topper [Thu, 21 Apr 2016 07:29:59 +0000 (07:29 +0000)]
Fix test command line to explicitly disable CDI instructions for one test.

llvm-svn: 266966

8 years agoCachePruning: early exit if no path supplied
Mehdi Amini [Thu, 21 Apr 2016 06:43:45 +0000 (06:43 +0000)]
CachePruning: early exit if no path supplied

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

8 years agoThinLTO: initialize variables
Mehdi Amini [Thu, 21 Apr 2016 06:43:41 +0000 (06:43 +0000)]
ThinLTO: initialize variables

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

8 years ago[AVX512] Add support for lowering CTTZ v64i8 and v32i16 with BWI instructions.
Craig Topper [Thu, 21 Apr 2016 06:39:34 +0000 (06:39 +0000)]
[AVX512] Add support for lowering CTTZ v64i8 and v32i16 with BWI instructions.

llvm-svn: 266963

8 years ago[X86] Remove redundant calls to setOperationAction for EXTRACT_VECTOR_ELT/INSERT_VECT...
Craig Topper [Thu, 21 Apr 2016 06:39:32 +0000 (06:39 +0000)]
[X86] Remove redundant calls to setOperationAction for EXTRACT_VECTOR_ELT/INSERT_VECTOR_ELT from SSE41 block. They were already done in an earlier block. NFC

llvm-svn: 266962

8 years ago[X86] Remove some operations from the default Expand all vector ops loop. Instead...
Craig Topper [Thu, 21 Apr 2016 06:39:29 +0000 (06:39 +0000)]
[X86] Remove some operations from the default Expand all vector ops loop. Instead let them stay Legal and mark them Expand for specific types where needed. Reduces overall number of calls to setOperationAction. NFC

llvm-svn: 266961

8 years ago[X86] Remove old leftover MMX code that sets various 64-bit vector operations to...
Craig Topper [Thu, 21 Apr 2016 06:39:26 +0000 (06:39 +0000)]
[X86] Remove old leftover MMX code that sets various 64-bit vector operations to Expand. These vector types aren't legal so these operations would never make it far enough to need to expand. NFC

llvm-svn: 266960

8 years agoThinLTO: add module caching handling.
Mehdi Amini [Thu, 21 Apr 2016 05:54:23 +0000 (05:54 +0000)]
ThinLTO: add module caching handling.

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

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

8 years agoThinLTO: Resolve linkonce_odr aliases just like functions
Mehdi Amini [Thu, 21 Apr 2016 05:47:17 +0000 (05:47 +0000)]
ThinLTO: Resolve linkonce_odr aliases just like functions

This help to streamline the process of handling importing since
we don't need to special case alias everywhere: just like
linkonce_odr function, make sure at least one alias is emitted
by turning it weak.

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

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

8 years ago[LTO/Test] Make x86_64-darwin bot happy again.
Davide Italiano [Thu, 21 Apr 2016 05:30:32 +0000 (05:30 +0000)]
[LTO/Test] Make x86_64-darwin bot happy again.

llvm-svn: 266957

8 years ago[libc++] fix macro redef warning when exception is disabled
Weiming Zhao [Thu, 21 Apr 2016 05:28:18 +0000 (05:28 +0000)]
[libc++] fix macro redef warning when exception is disabled

Summary:
 when setting LIBCXX_ENABLE_EXCEPTIONS=false, _LIBCPP_NO_EXCEPTIONS wil be defined in both commandline and _config

Reviewers: bcraig, EricWF

Subscribers: cfe-commits

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

llvm-svn: 266956

8 years ago[SimplifyCFG] Fold `llvm.guard(false)` to unreachable
Sanjoy Das [Thu, 21 Apr 2016 05:09:12 +0000 (05:09 +0000)]
[SimplifyCFG] Fold `llvm.guard(false)` to unreachable

Summary:
`llvm.guard(false)` always bails out of the current compilation unit, so
we can prune any control flow following it.

Reviewers: hfinkel, pcc, reames

Subscribers: majnemer, reames, mcrosier, llvm-commits

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

llvm-svn: 266955

8 years ago[LTO] Another couple of tests for cases we already get right.
Davide Italiano [Thu, 21 Apr 2016 04:50:08 +0000 (04:50 +0000)]
[LTO] Another couple of tests for cases we already get right.

-> Drop linkage when converting to decl
-> Handling of unnamed_addr.

llvm-svn: 266954

8 years ago[LTO] Discard names for Values that are not global.
Davide Italiano [Thu, 21 Apr 2016 04:46:22 +0000 (04:46 +0000)]
[LTO] Discard names for Values that are not global.

This is not on by default (but it might be in the future).
The knob to enable the optimization is -lto-discard-value-names.

llvm-svn: 266953

8 years ago[X86] Remove unnecessary setting of CTTZ_ZERO_UNDEF to Custom for vector types where...
Craig Topper [Thu, 21 Apr 2016 04:44:00 +0000 (04:44 +0000)]
[X86] Remove unnecessary setting of CTTZ_ZERO_UNDEF to Custom for vector types where we can't do any better than the Custom lowering of CTTZ. LegalizeVectorOps will expand to CTTZ since its marked Custom.

CTTZ_ZERO_UNDEF can be custom lowered specially if CTLZ is supported. Otherwise CTTZ and CTTZ_ZERO_UNDEF are handled the same way by using CTPOP and bitmath.

llvm-svn: 266952

8 years ago[SelectionDAG] Teach LegalizeVectorOps to directly Expand CTTZ_ZERO_UNDEF/CTLZ_ZERO_U...
Craig Topper [Thu, 21 Apr 2016 04:43:57 +0000 (04:43 +0000)]
[SelectionDAG] Teach LegalizeVectorOps to directly Expand CTTZ_ZERO_UNDEF/CTLZ_ZERO_UNDEF to CTTZ/CTLZ directly if those ops are Legal/Custom instead of deferring it to LegalizeOps.

This is needed to support CTTZ/CTLZ Custom correctly since LegalizeOps would be too late to do the custom lowering.

llvm-svn: 266951

8 years ago[AVX512] Add support for popcount of v8i64 and v16i32 with and without BWI instructions.
Craig Topper [Thu, 21 Apr 2016 03:57:24 +0000 (03:57 +0000)]
[AVX512] Add support for popcount of v8i64 and v16i32 with and without BWI instructions.

Without BWI we have to split the vectors into 256-bit vectors so we can use AVX2 pshufb and then concatenate the results.

llvm-svn: 266950

8 years agoValueMapper: Map uniqued nodes in post-order
Duncan P. N. Exon Smith [Thu, 21 Apr 2016 02:34:36 +0000 (02:34 +0000)]
ValueMapper: Map uniqued nodes in post-order

The iteratitive algorithm from r265456 claimed but failed to create a
post-order traversal.  It had the same error that was fixed in the
ValueEnumerator in r266947: now, instead of pushing all operands on the
worklist at once, we pause whenever an operand gets pushed in order to
go depth-first (I know, it sounds obvious).

Sadly, I have no idea how to observe this from outside the algorithm and
so I haven't written a test.  The output should be the same; it should
just use fewer temporary nodes now.  I've added some comments that I
hope make the current logic clear enough it's unlikely to regress.

llvm-svn: 266949

8 years agoThinLTO/ModuleLinker: add a flag to not always pull-in linkonce when performing importing
Mehdi Amini [Thu, 21 Apr 2016 01:59:39 +0000 (01:59 +0000)]
ThinLTO/ModuleLinker: add a flag to not always pull-in linkonce when performing importing

Summary:
The function importer already decided what symbols need to be pulled
in. Also these magically added ones will not be in the export list
for the source module, which can confuse the internalizer for
instance.

Reviewers: tejohnson, rafael

Subscribers: joker.eph, llvm-commits

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

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

8 years agoBitcodeWriter: Emit metadata in post-order (again)
Duncan P. N. Exon Smith [Thu, 21 Apr 2016 01:55:12 +0000 (01:55 +0000)]
BitcodeWriter: Emit metadata in post-order (again)

Emit metadata nodes in post-order.  The iterative algorithm from r266709
failed to maintain this property.  After understanding my mistake, it
wasn't too hard to write a test with llvm-bcanalyzer (and I've actually
made this change once before: see r220340).

This also reverts the "noisy" testcase change from r266709.  That should
have been more of a red flag :/.

Note: The same bug crept into the ValueMapper in r265456.  I'm still
working on the fix.

llvm-svn: 266947

8 years agoMachineSched: Cleanup; NFC
Matthias Braun [Thu, 21 Apr 2016 01:54:13 +0000 (01:54 +0000)]
MachineSched: Cleanup; NFC

llvm-svn: 266946

8 years ago[modules] Make the tweak to avoid circular inclusion of emmintrin.h and
Richard Smith [Thu, 21 Apr 2016 01:46:37 +0000 (01:46 +0000)]
[modules] Make the tweak to avoid circular inclusion of emmintrin.h and
xmmintrin.h a bit more directed. If for whatever reason modules are enabled but
we textually include one of these headers, don't deploy the special case for
modules. To make this work cleanly, extend __building_module to be defined
even when modules is disabled.

llvm-svn: 266945

8 years agoExpressions can run without a process.
Jim Ingham [Thu, 21 Apr 2016 01:46:11 +0000 (01:46 +0000)]
Expressions can run without a process.

Code was added in ClangExpressionParser::ClangExpressionParser that was calling through
the process w/o checking that it was good.  Also, we were pretending that we could do something
reasonable if we had no target, but that's actually not true, so I check for a target at the
beginning of the constructor and don't make a compiler in that case.

<rdar://problem/25841198>

llvm-svn: 266944

8 years agoReland test change.
Nico Weber [Thu, 21 Apr 2016 01:33:04 +0000 (01:33 +0000)]
Reland test change.

llvm-svn: 266943

8 years agoRevert unintentionally commited bits in r266935.
Nico Weber [Thu, 21 Apr 2016 01:31:37 +0000 (01:31 +0000)]
Revert unintentionally commited bits in r266935.

llvm-svn: 266942

8 years agoCorrected wording of REPL not available messaging (contained a repeated word and...
Kate Stone [Thu, 21 Apr 2016 00:56:08 +0000 (00:56 +0000)]
Corrected wording of REPL not available messaging (contained a repeated word and lacked clarity.)

llvm-svn: 266941

8 years agoAdded command prefix to new help messages to ensure that they're correctly words...
Kate Stone [Thu, 21 Apr 2016 00:55:20 +0000 (00:55 +0000)]
Added command prefix to new help messages to ensure that they're correctly words in REPL mode.

llvm-svn: 266940

8 years agoAdd optimization for 'icmp slt (or A, B), A' and some related idioms based on knowled...
Nick Lewycky [Thu, 21 Apr 2016 00:53:14 +0000 (00:53 +0000)]
Add optimization for 'icmp slt (or A, B), A' and some related idioms based on knowledge of the sign bit for A and B.

No matter what value you OR in to A, the result of (or A, B) is going to be UGE A. When A and B are positive, it's SGE too. If A is negative, OR'ing a value into it can't make it positive, but can increase its value closer to -1, therefore (or A, B) is SGE A. Working through all possible combinations produces this truth table:

```
A is
+, -, +/-
F  F   F   +    B is
T  F   ?   -
?  F   ?   +/-
```

The related optimizations are flipping the 'slt' for 'sge' which always NOTs the result (if the result is known), and swapping the LHS and RHS while swapping the comparison predicate.

There are more idioms left to implement (aren't there always!) but I've stopped here because any more would risk becoming unreasonable for reviewers.

llvm-svn: 266939

8 years agoRemove the (ignored) -Wreceived-is-weak diagnostic.
Bob Wilson [Thu, 21 Apr 2016 00:11:24 +0000 (00:11 +0000)]
Remove the (ignored) -Wreceived-is-weak diagnostic.

We kept this around for a while since Xcode 6 and earlier had a build
setting for this warning. It was removed in Xcode 7 so there should be
no need for this warning now.

llvm-svn: 266938

8 years agoModule Debugging: Emit the canonical debug info for Objective-C classes
Adrian Prantl [Wed, 20 Apr 2016 23:59:32 +0000 (23:59 +0000)]
Module Debugging: Emit the canonical debug info for Objective-C classes
in the compile unit that contains their implementation even if their
interface is declared in a module.

The private @implementation of an @interface may have additional
hidden ivars so we should not defer to the public version of the
type that is found in the module.

<rdar://problem/25541798>

llvm-svn: 266937

8 years agoRefine instruction weight annotation algorithm for sample profiler.
Dehao Chen [Wed, 20 Apr 2016 23:36:23 +0000 (23:36 +0000)]
Refine instruction weight annotation algorithm for sample profiler.

Summary:
This patch refined the instruction weight anootation algorithm:
1. Do not use dbg_value intrinsics for annotation.
2. Annotate cold calls if the call is inlined in profile, but not inlined before preparation. This indicates that the annotation preparation step found no sample for the inlined callsite, thus the call should be very cold.

Reviewers: dnovillo, davidxl

Subscribers: mgrang, llvm-commits

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

llvm-svn: 266936

8 years agounbreak COFF/out.test after r266929
Nico Weber [Wed, 20 Apr 2016 23:30:14 +0000 (23:30 +0000)]
unbreak COFF/out.test after r266929

llvm-svn: 266935

8 years ago[sanitizer] update the sanitizer_allocator_testlib
Kostya Serebryany [Wed, 20 Apr 2016 23:28:06 +0000 (23:28 +0000)]
[sanitizer] update the sanitizer_allocator_testlib

llvm-svn: 266934

8 years agoFix another compilation error from r266919 for clang-atom-d525-fedora-rel which
Kevin Enderby [Wed, 20 Apr 2016 23:10:14 +0000 (23:10 +0000)]
Fix another compilation error from r266919 for clang-atom-d525-fedora-rel which
is another place that libObject’s getName() for symbols returns Expected<...>
that needed to be updated.

llvm-svn: 266933

8 years ago[asan] Increase LocatePcInTrace threshold.
Evgeniy Stepanov [Wed, 20 Apr 2016 22:45:25 +0000 (22:45 +0000)]
[asan] Increase LocatePcInTrace threshold.

Not sure what changed, but on my machine this is literally one byte
short. Only happens when malloc_context_size <= 2 due to the special
case in GET_STACK_TRACE definition (see asan_stack.h):
StackTrace::GetCurrentPc() on the right (context size > 2) branch
returns the address that is 200-something bytes from the return
address it is later matched to, while the same call on the left
branch is 321 bytes away from it.

This fixes the double-free test on my machine.

llvm-svn: 266932

8 years ago[asan] Add __strdup interceptor.
Evgeniy Stepanov [Wed, 20 Apr 2016 22:45:23 +0000 (22:45 +0000)]
[asan] Add __strdup interceptor.

This happens on Linux when building as C (not C++) with optimization.

llvm-svn: 266931

8 years agoFix compilation error in r266919.
Evgeniy Stepanov [Wed, 20 Apr 2016 22:44:40 +0000 (22:44 +0000)]
Fix compilation error in r266919.

lib/Object/MachOObjectFile.cpp:53:44: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
  return malformedError(Obj.getFileName(), std::move(Msg.str()), ECOverride);

llvm-svn: 266930

8 years agolld-link: Fix default output name with /dll flag.
Nico Weber [Wed, 20 Apr 2016 22:34:15 +0000 (22:34 +0000)]
lld-link: Fix default output name with /dll flag.

If /dll is passed, the default output filename should be foo.dll,
not foo.exe.
http://reviews.llvm.org/D19321

llvm-svn: 266929

8 years ago[test/PGOProfile] Make tests independent of the raw profile version (NFC)
Vedant Kumar [Wed, 20 Apr 2016 22:24:01 +0000 (22:24 +0000)]
[test/PGOProfile] Make tests independent of the raw profile version (NFC)

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

llvm-svn: 266928

8 years agounwind: remove another instance of -Wexpansion-to-defined
Saleem Abdulrasool [Wed, 20 Apr 2016 22:18:50 +0000 (22:18 +0000)]
unwind: remove another instance of -Wexpansion-to-defined

Remove the use of undefined behaviour in the c preprocessor by always defining
the value according to the state that was being checked.  NFC.

llvm-svn: 266927

8 years agounwind: unify the definition of _LIBUNWIND_SUPPORT_FRAME_APIS
Saleem Abdulrasool [Wed, 20 Apr 2016 22:18:47 +0000 (22:18 +0000)]
unwind: unify the definition of _LIBUNWIND_SUPPORT_FRAME_APIS

Unify the definition of the _LIBUNWIND_SUPPORT_FRAME_APIS macro.  This is in
preparation to remove another instance of -Wexpansion-to-defined.  NFC.

llvm-svn: 266926

8 years ago[Tooling] Fix getting fully qualified names of template alias types.
Chaoren Lin [Wed, 20 Apr 2016 22:12:07 +0000 (22:12 +0000)]
[Tooling] Fix getting fully qualified names of template alias types.

Reviewers: rsmith, rnk

Subscribers: cfe-commits, klimek

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

llvm-svn: 266925

8 years agoRemoved extraneous print() in decorator for enabling module debugging
Kate Stone [Wed, 20 Apr 2016 21:59:43 +0000 (21:59 +0000)]
Removed extraneous print() in decorator for enabling module debugging

llvm-svn: 266924

8 years ago[ELF][MIPS] Treat R_MIPS_TLS_{D}TPREL_HI16/LO16 as relative relocations
Simon Atanasyan [Wed, 20 Apr 2016 21:57:51 +0000 (21:57 +0000)]
[ELF][MIPS] Treat R_MIPS_TLS_{D}TPREL_HI16/LO16 as relative relocations

These relocations are calculated as S + A - DTPREL or S + A - TPREL,
where DTPREL = TlsVA - 0x8000, TPREL = TlsVA - 0x7000. So the result
is relative to the TLS output section and is not an absolut value
The fix allows to escape creation of unnecessary dynamic relocations
in case of DSO linking.

llvm-svn: 266923

8 years agoWhen making an array or stuct/union/class elements, make sure the type is complete...
Greg Clayton [Wed, 20 Apr 2016 21:47:56 +0000 (21:47 +0000)]
When making an array or stuct/union/class elements, make sure the type is complete. If the type isn't complete, complete the type so that clang won't assert and kill your program. Since the DWARF assists in doing layout, it won't show the array or struct/unions/class elements correctly, but it will stop you from crashing if you have a struct/union/class that contains one of these arrays.

<rdar://problem/25057391>

llvm-svn: 266922

8 years ago[ELF][MIPS] Create GOT entries for R_MIPS_REL32 dynamic relocations
Simon Atanasyan [Wed, 20 Apr 2016 21:40:33 +0000 (21:40 +0000)]
[ELF][MIPS] Create GOT entries for R_MIPS_REL32 dynamic relocations

MIPS ABI turns using of GOT and dynamic relocations inside out. While
regular ABI uses dynamic relocations to fill up GOT entries MIPS ABI
requires dynamic linker to fills up GOT entries using specially sorted
dynamic symbol table. This affects even dynamic relocations against
symbols which do not require GOT entries creation explicitly, i.e. do
not have any GOT-relocations. So if a preemptible symbol has a dynamic
relocation we anyway have to create a GOT entry for it.

If a non-preemptible symbol has a dynamic relocation against it, dynamic
linker takes it st_value, adds offset and writes down result of the
dynamic relocation. In case of preemptible symbol dynamic linker
performs symbol resolution, writes the symbol value to the GOT entry and
reads the GOT entry when it needs to perform a dynamic relocation.

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

llvm-svn: 266921