platform/upstream/llvm.git
8 years ago[utils] Add script to check for code coverage regressions
Vedant Kumar [Wed, 20 Jul 2016 22:44:16 +0000 (22:44 +0000)]
[utils] Add script to check for code coverage regressions

Differential Revision: https://reviews.llvm.org/D22544

llvm-svn: 276199

8 years agoSync up with llvm copy /NFC
Xinliang David Li [Wed, 20 Jul 2016 22:29:16 +0000 (22:29 +0000)]
Sync up with llvm copy /NFC

llvm-svn: 276198

8 years agoReapply r276185
Xinliang David Li [Wed, 20 Jul 2016 22:24:52 +0000 (22:24 +0000)]
Reapply r276185

Fix the test case that should not depend on dir iteration order.

llvm-svn: 276197

8 years ago[NVPTX] Enable the load-store vectorizer on nvptx.
Justin Lebar [Wed, 20 Jul 2016 22:11:36 +0000 (22:11 +0000)]
[NVPTX] Enable the load-store vectorizer on nvptx.

Reviewers: tra

Subscribers: jholewinski, arsenm, asbirlea

Differential Revision: https://reviews.llvm.org/D22592

llvm-svn: 276196

8 years ago[sanitizers] split sanitizer_allocator.h into a number of smaller .h files; NFC
Kostya Serebryany [Wed, 20 Jul 2016 22:06:41 +0000 (22:06 +0000)]
[sanitizers] split sanitizer_allocator.h into a number of smaller .h files; NFC

llvm-svn: 276195

8 years agoRevert r276185 -- build bot failure
Xinliang David Li [Wed, 20 Jul 2016 21:50:38 +0000 (21:50 +0000)]
Revert r276185 -- build bot failure

llvm-svn: 276194

8 years ago[AArch64] Register AArch64LoadStoreOptimizer so it can be run by llc -run-pass. NFCI.
Geoff Berry [Wed, 20 Jul 2016 21:45:58 +0000 (21:45 +0000)]
[AArch64] Register AArch64LoadStoreOptimizer so it can be run by llc -run-pass. NFCI.

llvm-svn: 276193

8 years ago[OptDiag,LV] Add hotness attribute to analysis remarks
Adam Nemet [Wed, 20 Jul 2016 21:44:26 +0000 (21:44 +0000)]
[OptDiag,LV] Add hotness attribute to analysis remarks

The earlier change added hotness attribute to missed-optimization
remarks.  This follows up with the analysis remarks (the ones explaining
the reason for the missed optimization).

llvm-svn: 276192

8 years ago[OptDiag] Take the IR Value as a const pointer
Adam Nemet [Wed, 20 Jul 2016 21:44:22 +0000 (21:44 +0000)]
[OptDiag] Take the IR Value as a const pointer

This helps because LoopAccessReport is passed around as a const
reference and we derive the basic block passed as the Value parameter
from the instruction in LoopAccessReport.

llvm-svn: 276191

8 years ago[OptDiag] Wrap a long line
Adam Nemet [Wed, 20 Jul 2016 21:44:18 +0000 (21:44 +0000)]
[OptDiag] Wrap a long line

llvm-svn: 276190

8 years ago[NVPTX] Renamed NVPTXLowerKernelArgs -> NVPTXLowerArgs. NFC.
Artem Belevich [Wed, 20 Jul 2016 21:44:07 +0000 (21:44 +0000)]
[NVPTX] Renamed NVPTXLowerKernelArgs -> NVPTXLowerArgs. NFC.

After r276153 the pass applies to both kernels and regular functions.

Differential Revision: https://reviews.llvm.org/D22583

llvm-svn: 276189

8 years agoFix memory leak introduced in r276159.
Richard Smith [Wed, 20 Jul 2016 21:38:26 +0000 (21:38 +0000)]
Fix memory leak introduced in r276159.

llvm-svn: 276188

8 years agorevert rL276179: [compiler-rt] Fix broken unittest related to 64-bit print format
Etienne Bergeron [Wed, 20 Jul 2016 21:38:02 +0000 (21:38 +0000)]
revert rL276179: [compiler-rt] Fix broken unittest related to 64-bit print format

llvm-svn: 276187

8 years agoRevert r276117 "[XRay] Basic initialization and flag definition for XRay runtime"
Hans Wennborg [Wed, 20 Jul 2016 21:37:38 +0000 (21:37 +0000)]
Revert r276117 "[XRay] Basic initialization and flag definition for XRay runtime"

and also the follow-up "[xray] Only build xray on Linux for now"

Two build errors were reported on the llvm-commits list:

[ 88%] Building CXX object lib/xray/CMakeFiles/clang_rt.xray-x86_64.dir/xray_flags.cc.o
/mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/lib/xray/xray_init.cc:23:10: fatal error: 'llvm/Support/ELF.h' file not found
  #include "llvm/Support/ELF.h"
 ^

and

In file included from /w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface.cc:16:
/w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface_internal.h:36:8: error:
no type named 'size_t' in namespace 'std'
std::size_t Entries;
~~~~~^

llvm-svn: 276186

8 years ago[Profile] support directory reading in profile merging
Xinliang David Li [Wed, 20 Jul 2016 21:31:29 +0000 (21:31 +0000)]
[Profile] support directory reading in profile merging

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

llvm-svn: 276185

8 years agoGlobalISel: implement Legalization querying framework.
Tim Northover [Wed, 20 Jul 2016 21:13:29 +0000 (21:13 +0000)]
GlobalISel: implement Legalization querying framework.

This adds an (incomplete, inefficient) framework for deciding what to do with
some operation on a given type.

llvm-svn: 276184

8 years ago[AArch64][FastISel] Select -O0 legal cmpxchg.
Ahmed Bougacha [Wed, 20 Jul 2016 21:12:32 +0000 (21:12 +0000)]
[AArch64][FastISel] Select -O0 legal cmpxchg.

At -O0, cmpxchg survives AtomicExpand: it's mostly straightforward
to select it in fast-isel, and let the pseudo be expanded later.

extractvalues on the result are the tricky part: the generic logic
only works for legal types (and it would be painful to make it
support illegal types), so we can only support i32/i64 cmpxchg.

llvm-svn: 276183

8 years ago[AArch64][FastISel] Select atomic stores into STLR.
Ahmed Bougacha [Wed, 20 Jul 2016 21:12:27 +0000 (21:12 +0000)]
[AArch64][FastISel] Select atomic stores into STLR.

llvm-svn: 276182

8 years ago[GVNHoist] Don't hoist PHI nodes
David Majnemer [Wed, 20 Jul 2016 21:05:01 +0000 (21:05 +0000)]
[GVNHoist] Don't hoist PHI nodes

We hoisted PHIs without respecting their special insertion point in the
block, leading to verfier errors.

This fixes PR28626.

llvm-svn: 276181

8 years agoWhen copying an array into a lambda, destroy temporaries from
John McCall [Wed, 20 Jul 2016 21:02:43 +0000 (21:02 +0000)]
When copying an array into a lambda, destroy temporaries from
the copy-constructor immediately and enter a partial array
cleanup for previously-copied elements.

Fixes PR28595.

llvm-svn: 276180

8 years ago[compiler-rt] Fix broken unittest related to 64-bit print format
Etienne Bergeron [Wed, 20 Jul 2016 20:55:02 +0000 (20:55 +0000)]
[compiler-rt] Fix broken unittest related to 64-bit print format

Summary:
The printf is not working correctly on 64-bit MSVC.

The portable way to print "size_t" is to use "%zx" (size_t in hexa).

Reviewers: rnk

Subscribers: kubabrecka, llvm-commits, wang0109, chrisha

Differential Revision: https://reviews.llvm.org/D22588

llvm-svn: 276179

8 years ago[OpenMP] Allow negative lower bound in array sections based on pointers
Kelvin Li [Wed, 20 Jul 2016 20:45:29 +0000 (20:45 +0000)]
[OpenMP] Allow negative lower bound in array sections based on pointers

OpenMP 4.5 removed the restriction that array section lower bound must be non negative.
This change is to allow negative values for array section based on pointers.
For array section based on array type there is still a restriction: "The array section must be a subset of the original array."

Patch by David S.

Differential Revision: https://reviews.llvm.org/D22481

llvm-svn: 276177

8 years ago[ELF][MIPS] Omit redundant arguments in the `getMipsEFlags` function. NFC
Simon Atanasyan [Wed, 20 Jul 2016 20:30:41 +0000 (20:30 +0000)]
[ELF][MIPS] Omit redundant arguments in the `getMipsEFlags` function.  NFC

llvm-svn: 276176

8 years agoDelete EhInputSection::getOffset.
Rafael Espindola [Wed, 20 Jul 2016 20:19:58 +0000 (20:19 +0000)]
Delete EhInputSection::getOffset.

We no longer need it for relocations in .eh_frame.

The only relocations that point to .eh_frame are the ones trying to
find the output .eh_frame.

This actually fixes a bug in the symbol value code. It was not
handling -1 as an indicator for a piece not being included in the
output.

llvm-svn: 276175

8 years ago[SCCP] Zap multiple return values.
Davide Italiano [Wed, 20 Jul 2016 20:17:13 +0000 (20:17 +0000)]
[SCCP] Zap multiple return values.

We can replace the return values with undef if we replaced all
the call uses with a constant/undef.

Differential Revision:  https://reviews.llvm.org/D22336

llvm-svn: 276174

8 years ago[ELF][MIPS] Create PLT entry specific for MIPS ABI version R6
Simon Atanasyan [Wed, 20 Jul 2016 20:15:33 +0000 (20:15 +0000)]
[ELF][MIPS] Create PLT entry specific for MIPS ABI version R6

llvm-svn: 276173

8 years ago[ELF][MIPS] Pick arch flag from the first input file.
Simon Atanasyan [Wed, 20 Jul 2016 20:15:24 +0000 (20:15 +0000)]
[ELF][MIPS] Pick arch flag from the first input file.

LLD still does not produce a correct combination of MIPS ELF flags if
input files have different sets of ELF flags (i.e. EF_MIPS_ARCH_32 and
EF_MIPS_ARCH_32R2). But now we do not stick to "R2" ABI version and can
emit EF_MIPS_ARCH_32R6 for example.

llvm-svn: 276172

8 years ago[LSV] Don't move stores across may-load instrs, and loosen restrictions on moving...
Justin Lebar [Wed, 20 Jul 2016 20:07:37 +0000 (20:07 +0000)]
[LSV] Don't move stores across may-load instrs, and loosen restrictions on moving loads.

Summary:
Previously we wouldn't move loads/stores across instructions that had
side-effects, where that was defined as may-write or may-throw.  But
this is not sufficiently restrictive: Stores can't safely be moved
across instructions that may load.

This patch also adds a DEBUG check that all instructions in our chain
are either loads or stores.

Reviewers: asbirlea

Subscribers: llvm-commits, jholewinski, arsenm, mzolotukhin

Differential Revision: https://reviews.llvm.org/D22547

llvm-svn: 276171

8 years ago[LSV] Vectorize up to side-effecting instructions.
Justin Lebar [Wed, 20 Jul 2016 20:07:34 +0000 (20:07 +0000)]
[LSV] Vectorize up to side-effecting instructions.

Summary:
Previously if we had a chain that contained a side-effecting
instruction, we wouldn't vectorize it at all.  Now we'll vectorize
everything that comes before the side-effecting instruction.

Reviewers: asbirlea

Subscribers: arsenm, jholewinski, llvm-commits, mzolotukhin

Differential Revision: https://reviews.llvm.org/D22536

llvm-svn: 276170

8 years ago[MSSA] Add an overload for getClobberingMemoryAccess.
George Burgess IV [Wed, 20 Jul 2016 19:51:34 +0000 (19:51 +0000)]
[MSSA] Add an overload for getClobberingMemoryAccess.

A seemingly common use for the walker's getClobberingMemoryAccess
function is:

```
MemoryAccess *getClobber(MemorySSAWalker *W, MemoryUseOrDef *MUD) {
  const Instruction *I = MUD->getMemoryInst();
  return W->getClobberingMemoryAccess(I);
}
```

Which is kind of redundant, since walkers will ultimately query MSSA to
find out which MemoryAccess `I` maps to (...which is always `MUD`).

So, this patch adds an overload of getClobberingMemoryAccess that
accepts MemoryAccesses directly. As a result, the Instruction overload
of getClobberingMemoryAccess becomes a lightweight wrapper around our
new overload.

Additionally, this patch un`virtual`izes the Instruction overload of
getClobberingMemoryAccess, since there doesn't seem to be a walker that
benefits from that being virtual, and I can't think of how else one
would implement it. Happy to make it virtual again if we would benefit
from doing so.

llvm-svn: 276169

8 years ago[pdbdump] Use the "flow" style to print out a sequence of uint32_t.
Rui Ueyama [Wed, 20 Jul 2016 19:41:47 +0000 (19:41 +0000)]
[pdbdump] Use the "flow" style to print out a sequence of uint32_t.

Summary: Lists can be written either with "-" or "[]" in YAML.

Differential Revision: https://reviews.llvm.org/D22579

llvm-svn: 276168

8 years ago[OpenMP] Ignore parens in atomic capture
Kelvin Li [Wed, 20 Jul 2016 19:41:17 +0000 (19:41 +0000)]
[OpenMP] Ignore parens in atomic capture

Clang misdiagnoses atomic captures cases that contains parens.
i.e.

  int v, int *p;
#pragma omp atomic capture
{ v = (*p); (*p)++; }

Patch by David S.

Differential Revision: https://reviews.llvm.org/D22487

llvm-svn: 276167

8 years agoFix typo in test runner
Francis Ricci [Wed, 20 Jul 2016 19:37:31 +0000 (19:37 +0000)]
Fix typo in test runner

llvm-svn: 276166

8 years agoFunction names should start with lowercase letters.
Rui Ueyama [Wed, 20 Jul 2016 19:36:41 +0000 (19:36 +0000)]
Function names should start with lowercase letters.

llvm-svn: 276165

8 years agoReturn a vector from createPhdrs instead of return nothing.
Rui Ueyama [Wed, 20 Jul 2016 19:36:39 +0000 (19:36 +0000)]
Return a vector from createPhdrs instead of return nothing.

This way is consistent with createSections.

llvm-svn: 276164

8 years agoReplace parallel arrays with a StringSwitch.
Rui Ueyama [Wed, 20 Jul 2016 19:36:38 +0000 (19:36 +0000)]
Replace parallel arrays with a StringSwitch.

llvm-svn: 276163

8 years agoRemove `else` after `break`.
Rui Ueyama [Wed, 20 Jul 2016 19:36:36 +0000 (19:36 +0000)]
Remove `else` after `break`.

llvm-svn: 276162

8 years ago[OpenCL] AMDGCN target will generate images in constant address space
Yaxun Liu [Wed, 20 Jul 2016 19:21:11 +0000 (19:21 +0000)]
[OpenCL] AMDGCN target will generate images in constant address space

Allows AMDGCN target to generate images (such as %opencl.image2d_t) in constant address space.
Images will still be generated in global address space by default.

Added tests to existing opencl-types.cl in test\CodeGenOpenCL.

Patch by Aaron En Ye Shi.

Differential Revision: https://reviews.llvm.org/D22523

llvm-svn: 276161

8 years agoGlobalISel: properly conditionalize LLT use.
Tim Northover [Wed, 20 Jul 2016 19:17:29 +0000 (19:17 +0000)]
GlobalISel: properly conditionalize LLT use.

We can't guard the include of LowLevelType.h because getType and setType are
(trivial) functions even when GlobalISel isn't built.

llvm-svn: 276160

8 years ago[modules] Don't emit initializers for VarDecls within a module eagerly whenever
Richard Smith [Wed, 20 Jul 2016 19:10:16 +0000 (19:10 +0000)]
[modules] Don't emit initializers for VarDecls within a module eagerly whenever
we first touch any part of that module. Instead, defer them until the first
time that module is (transitively) imported. The initializer step for a module
then recursively initializes modules that its own headers imported.

For example, this avoids running the <iostream> global initializer in programs
that don't actually use iostreams, but do use other parts of the standard
library.

llvm-svn: 276159

8 years agoGlobalISel: implement low-level type with just size & vector lanes.
Tim Northover [Wed, 20 Jul 2016 19:09:30 +0000 (19:09 +0000)]
GlobalISel: implement low-level type with just size & vector lanes.

This should be all the low-level instruction selection needs to determine how
to implement an operation, with the remaining context taken from the opcode
(e.g. G_ADD vs G_FADD) or other flags not based on type (e.g. fast-math).

llvm-svn: 276158

8 years agoAvoid use of uninitialized iterators.
Rafael Espindola [Wed, 20 Jul 2016 18:54:31 +0000 (18:54 +0000)]
Avoid use of uninitialized iterators.

llvm-svn: 276157

8 years agoProperly ifdef the use of cpuid.
Alina Sbirlea [Wed, 20 Jul 2016 18:54:26 +0000 (18:54 +0000)]
Properly ifdef the use of cpuid.

llvm-svn: 276156

8 years agoAdd yet more explicit template instantiations. These were always needed
Chandler Carruth [Wed, 20 Jul 2016 18:47:33 +0000 (18:47 +0000)]
Add yet more explicit template instantiations. These were always needed
but things happened to work on some platforms prior to r276133. This
should be the complete set (I hope).

llvm-svn: 276155

8 years ago[NVPTX] deal with all aggregate return types.
Artem Belevich [Wed, 20 Jul 2016 18:39:52 +0000 (18:39 +0000)]
[NVPTX] deal with all aggregate return types.

Fixes a crash in llvm_unreachable when a function has array return type.

Differential Revision: https://reviews.llvm.org/D22524

llvm-svn: 276154

8 years ago[NVPTX] Improve lowering of byval args of device functions.
Artem Belevich [Wed, 20 Jul 2016 18:39:47 +0000 (18:39 +0000)]
[NVPTX] Improve lowering of byval args of device functions.

Avoid unnecessary spills of byval arguments of device functions to
local space on SASS level and subsequent pointer conversion to generic
address space that follows. Instead, make a local copy in IR, provide
a way to access arguments directly, and let LLVM optimize the copy away
when possible.

Differential Review: https://reviews.llvm.org/D21421

llvm-svn: 276153

8 years agoFix modules self-host: add missing include and forward-decl.
Richard Smith [Wed, 20 Jul 2016 18:28:19 +0000 (18:28 +0000)]
Fix modules self-host: add missing include and forward-decl.

llvm-svn: 276152

8 years ago[compiler-rt] Don't require c++ headers when configuring compiler-rt builds
Francis Ricci [Wed, 20 Jul 2016 18:25:46 +0000 (18:25 +0000)]
[compiler-rt] Don't require c++ headers when configuring compiler-rt builds

Summary:
A sysroot without c++ headers is able to build compiler-rt, don't
require them when configuring available architectures from cmake.

Reviewers: samsonov, beanz, compnerd

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D22469

llvm-svn: 276151

8 years ago[OptDiag] Fix function comment
Adam Nemet [Wed, 20 Jul 2016 18:16:45 +0000 (18:16 +0000)]
[OptDiag] Fix function comment

Function is not passed unlike in the original of this
(llvm::emitOptimizationRemarkMissed).

llvm-svn: 276150

8 years ago[cpu-detection] Cleanup of Host.cpp.
Alina Sbirlea [Wed, 20 Jul 2016 18:15:29 +0000 (18:15 +0000)]
[cpu-detection] Cleanup of Host.cpp.

Summary:
Mirroring most cleanup changed from compiler-rt/lib/builtins/cpu_model.
x86 methods are still returning a bool.

Reviewers: llvm-commits, echristo, craig.topper, sanjoy

Subscribers: mehdi_amini

Differential Revision: https://reviews.llvm.org/D22480

llvm-svn: 276149

8 years ago[compiler-rt] Fix target architecture matching
Francis Ricci [Wed, 20 Jul 2016 18:06:31 +0000 (18:06 +0000)]
[compiler-rt] Fix target architecture matching

Summary:
Use stricter comparisons for architecture. This prevents cmake from failing
for sysroots which can only compile armhf and not arm, since
arm MATCHES armhf is true, while arm STREQUAL armhf is false.

Reviewers: beanz, compnerd

Subscribers: aemerson, llvm-commits

Differential Revision: https://reviews.llvm.org/D22473

llvm-svn: 276148

8 years agominimize tests and auto-generate checks
Sanjay Patel [Wed, 20 Jul 2016 17:58:20 +0000 (17:58 +0000)]
minimize tests and auto-generate checks

llvm-svn: 276147

8 years agoCreate thunks before regular relocation scan.
Rafael Espindola [Wed, 20 Jul 2016 17:58:07 +0000 (17:58 +0000)]
Create thunks before regular relocation scan.

We will need to do something like this to support range extension
thunks since that process is iterative.

Doing this also has the advantage that when doing the regular
relocation scan the offset in the output section is known and we can
just store that. This reduces the number of times we have to run
getOffset and I think will allow a more specialized .eh_frame
representation.

By itself this is already a performance win.

firefox
  master 7.295045737
  patch  7.209466989 0.98826892235
chromium
  master 4.531254468
  patch  4.509221804 0.995137623774
chromium fast
  master 1.836928973
  patch  1.823805241 0.992855612714
the gold plugin
  master 0.379768791
  patch  0.380043405 1.00072310839
clang
  master 0.642698284
  patch  0.642215663 0.999249070657
llvm-as
  master 0.036665467
  patch  0.036456225 0.994293213284
the gold plugin fsds
  master 0.40395817
  patch  0.404384555 1.0010555177
clang fsds
  master 0.722045545
  patch  0.720946135 0.998477367518
llvm-as fsds
  master 0.03292646
  patch  0.032759965 0.994943428477
scylla
  master 3.427376378
  patch  3.368316181 0.98276810292

llvm-svn: 276146

8 years agoAdd .clang-format to parallel-libs
Jason Henline [Wed, 20 Jul 2016 17:49:55 +0000 (17:49 +0000)]
Add .clang-format to parallel-libs

Summary:
The format style is set to LLVM. This is consistent with the
parallel-libs project charter which specifies that its libraries will
conform to LLVM coding style.

Reviewers: jlebar

Subscribers: parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D22576

llvm-svn: 276145

8 years agoUse iterators to avoid dereferencing end().
Rafael Espindola [Wed, 20 Jul 2016 17:41:18 +0000 (17:41 +0000)]
Use iterators to avoid dereferencing end().

Thanks to George Rimar for finding the problem.

llvm-svn: 276144

8 years agofix flaky test on windows sanitizer bots
Etienne Bergeron [Wed, 20 Jul 2016 17:35:15 +0000 (17:35 +0000)]
fix flaky test on windows sanitizer bots

llvm-svn: 276143

8 years agoUse HTTPS for arcconfig conduit URL
Jason Henline [Wed, 20 Jul 2016 17:30:40 +0000 (17:30 +0000)]
Use HTTPS for arcconfig conduit URL

llvm-svn: 276142

8 years agoSimplify output section ownership.
Rui Ueyama [Wed, 20 Jul 2016 17:19:03 +0000 (17:19 +0000)]
Simplify output section ownership.

This patch simplifies output section management by making
Factory class have ownership of sections that creates.

Differential Revision: https://reviews.llvm.org/D22575

llvm-svn: 276141

8 years agomove decomposeBitTestICmp() to Transforms/Utils; NFC
Sanjay Patel [Wed, 20 Jul 2016 17:18:45 +0000 (17:18 +0000)]
move decomposeBitTestICmp() to Transforms/Utils; NFC

As noted in https://reviews.llvm.org/D22537 , we can use this functionality in
visitSelectInstWithICmp() and InstSimplify, but currently we have duplicated
code.

llvm-svn: 276140

8 years agoFix test/Analysis/ScalarEvolution/scev-expander-existing-value-offset.ll for rL276136.
Wei Mi [Wed, 20 Jul 2016 16:54:58 +0000 (16:54 +0000)]
Fix test/Analysis/ScalarEvolution/scev-expander-existing-value-offset.ll for rL276136.

The content in this testcase was accidentally duplicated. Fix the error.

llvm-svn: 276139

8 years agoUpdate isl to isl-0.17.1-191-g540b2fd
Tobias Grosser [Wed, 20 Jul 2016 16:53:07 +0000 (16:53 +0000)]
Update isl to isl-0.17.1-191-g540b2fd

This update resolves a bug in computing lexicographic minima/maxima.

llvm-svn: 276138

8 years ago[ELF] - Refactor of LinkerScript<ELFT>::getPhdrIndicesForSection
George Rimar [Wed, 20 Jul 2016 16:43:03 +0000 (16:43 +0000)]
[ELF] - Refactor of LinkerScript<ELFT>::getPhdrIndicesForSection

Previously it was harder to read and also has a error:
command kind was not checked.

Differential revision: https://reviews.llvm.org/D22574

llvm-svn: 276137

8 years agoUse ValueOffsetPair to enhance value reuse during SCEV expansion.
Wei Mi [Wed, 20 Jul 2016 16:40:33 +0000 (16:40 +0000)]
Use ValueOffsetPair to enhance value reuse during SCEV expansion.

In D12090, the ExprValueMap was added to reuse existing value during SCEV expansion.
However, const folding and sext/zext distribution can make the reuse still difficult.

A simplified case is: suppose we know S1 expands to V1 in ExprValueMap, and
  S1 = S2 + C_a
  S3 = S2 + C_b
where C_a and C_b are different SCEVConstants. Then we'd like to expand S3 as
V1 - C_a + C_b instead of expanding S2 literally. It is helpful when S2 is a
complex SCEV expr and S2 has no entry in ExprValueMap, which is usually caused
by the fact that S3 is generated from S1 after const folding.

In order to do that, we represent ExprValueMap as a mapping from SCEV to
ValueOffsetPair. We will save both S1->{V1, 0} and S2->{V1, C_a} into the
ExprValueMap when we create SCEV for V1. When S3 is expanded, it will first
expand S2 to V1 - C_a because of S2->{V1, C_a} in the map, then expand S3 to
V1 - C_a + C_b.

Differential Revision: https://reviews.llvm.org/D21313

llvm-svn: 276136

8 years agofix documentation comments; NFC
Sanjay Patel [Wed, 20 Jul 2016 16:30:55 +0000 (16:30 +0000)]
fix documentation comments; NFC

llvm-svn: 276135

8 years ago[asan] trying to fix the android bot
Kostya Serebryany [Wed, 20 Jul 2016 15:59:34 +0000 (15:59 +0000)]
[asan] trying to fix the android bot

llvm-svn: 276134

8 years ago[ELF] Attempt to fix FreeBSD build bot (no template instantiation for getOutputSectio...
Eugene Leviant [Wed, 20 Jul 2016 15:42:34 +0000 (15:42 +0000)]
[ELF] Attempt to fix FreeBSD build bot (no template instantiation for getOutputSectionName)

llvm-svn: 276133

8 years agoIf x/i is followed by x/g, the format should be reset to 'x'.
Jim Ingham [Wed, 20 Jul 2016 15:41:12 +0000 (15:41 +0000)]
If x/i is followed by x/g, the format should be reset to 'x'.

Otherwise, you have to say "x/gx" to what you obviously intended to
happen to happen.

<rdar://problem/27415507>

llvm-svn: 276132

8 years agoTry to deflake Windows/dll_host.cc test by not using repeated echo appending
Reid Kleckner [Wed, 20 Jul 2016 15:28:49 +0000 (15:28 +0000)]
Try to deflake Windows/dll_host.cc test by not using repeated echo appending

llvm-svn: 276130

8 years agoAMDGPU: Add missing test coverage for control flow breaks
Matt Arsenault [Wed, 20 Jul 2016 15:20:35 +0000 (15:20 +0000)]
AMDGPU: Add missing test coverage for control flow breaks

None of the current lit tests hit si_break handling.

llvm-svn: 276129

8 years agolibunwind: limit stack usage in unwind cursor
Ed Maste [Wed, 20 Jul 2016 15:19:09 +0000 (15:19 +0000)]
libunwind: limit stack usage in unwind cursor

Obtained from FreeBSD SVN r302475

Differential Revision: https://reviews.llvm.org/D22570

llvm-svn: 276128

8 years agoRemoved trailing whitespaces. NFC.
George Rimar [Wed, 20 Jul 2016 15:09:10 +0000 (15:09 +0000)]
Removed trailing whitespaces. NFC.

llvm-svn: 276126

8 years ago[xray] Only build xray on Linux for now
Reid Kleckner [Wed, 20 Jul 2016 14:58:07 +0000 (14:58 +0000)]
[xray] Only build xray on Linux for now

Should fix the Windows buildbots, and maybe some other non-Linux Unix
bots too.

XRay currently depends on sanitizer_common, so associate it with the
"build sanitizers" option and remove the option for separately
controlling the XRay build.

llvm-svn: 276124

8 years agoInitial support for the local dynamic model ARM TLS relocations:
Peter Smith [Wed, 20 Jul 2016 14:56:26 +0000 (14:56 +0000)]
Initial support for the local dynamic model ARM TLS relocations:

- R_ARM_TLS_LDM32
- R_ARM_TLS_LDO32

The local dynamic implementation and tests follows the same model as
the other ARM TLS models. The R_ARM_TLS_LDO32 is implemented as R_ABS
expr type as the getVA() for a TLS symbol will return the offset from the
start of the TLS block.

Differential Revision https://reviews.llvm.org/D22563

llvm-svn: 276123

8 years ago[compiler-rt/asan] Disable irrelevant unittest on win64
Etienne Bergeron [Wed, 20 Jul 2016 14:53:17 +0000 (14:53 +0000)]
[compiler-rt/asan] Disable irrelevant unittest on win64

Summary:
This test is allocating a 1gig chunk to make shadow allocation failed,
but on 64-bits architecture the test is working.

Reviewers: rnk

Subscribers: kubabrecka, llvm-commits, wang0109, chrisha

Differential Revision: https://reviews.llvm.org/D22553

llvm-svn: 276122

8 years ago[ELF] Create output sections in LinkerScript class
Eugene Leviant [Wed, 20 Jul 2016 14:43:20 +0000 (14:43 +0000)]
[ELF] Create output sections in LinkerScript class

llvm-svn: 276121

8 years ago[MS] Improve VPtrInfo field names and doc comments
Reid Kleckner [Wed, 20 Jul 2016 14:40:25 +0000 (14:40 +0000)]
[MS] Improve VPtrInfo field names and doc comments

'ReusingBase' was a terrible name. It might actually refer to the most
derived class, which is not a base. 'BaseWithVPtr' was also bad, since
again, it could refer to the most derived class. It was actually the
first base to introduce the vptr, so now it is 'IntroducingObject'.

llvm-svn: 276120

8 years agoAMDGPU: Fix bug causing crash due to invalid opencl version metadata.
Yaxun Liu [Wed, 20 Jul 2016 14:38:06 +0000 (14:38 +0000)]
AMDGPU: Fix bug causing crash due to invalid opencl version metadata.

Differential Revision: https://reviews.llvm.org/D22526

llvm-svn: 276119

8 years ago[ELF] - Fixed integral constant overflow warning under MSVS 2015. NFC.
George Rimar [Wed, 20 Jul 2016 14:26:48 +0000 (14:26 +0000)]
[ELF] - Fixed integral constant overflow warning under MSVS 2015. NFC.

Under MSVS 2015 I observed integral constant overflow warning when aggregate initialization was used
to init the bit field. Patch fixes that.

llvm-svn: 276118

8 years ago[compiler-rt] [XRay] Basic initialization and flag definition for XRay runtime
Dean Michael Berris [Wed, 20 Jul 2016 14:14:50 +0000 (14:14 +0000)]
[compiler-rt] [XRay] Basic initialization and flag definition for XRay runtime

Summary:
This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting).

Depends on D19904

Reviewers: echristo, kcc, rnk

Subscribers: rnk, mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D21612

llvm-svn: 276117

8 years agotsan: fix windows build
Dmitry Vyukov [Wed, 20 Jul 2016 12:50:49 +0000 (12:50 +0000)]
tsan: fix windows build

It's only asan that installs vectored SEH handler to map memory lazily.

llvm-svn: 276112

8 years agoclang-tidy modernize-loop-convert: preserve type of alias declaration (bug 28341)
Matthias Gehre [Wed, 20 Jul 2016 12:32:06 +0000 (12:32 +0000)]
clang-tidy modernize-loop-convert: preserve type of alias declaration (bug 28341)

Summary:
Previoly, the added test failed with the fillowing fixit:

     char v[5];

-    for(size_t i = 0; i < 5; ++i)
+    for(char value : v)
     {
-        unsigned char value = v[i];
         if (value > 127)

i.e. the variable 'value' changes from unsigned char to signed char. And
thus the following 'if' does not work anymore.

With this commit, the fixit is changed to:
     char v[5];

-    for(size_t i = 0; i < 5; ++i)
+    for(unsigned char value : v)
     {
-        unsigned char value = v[i];
         if (value > 127)

Reviewers: alexfh, klimek

Subscribers: cfe-commits

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

llvm-svn: 276111

8 years ago[clang-tidy] readability-identifier-naming - support for other case types
Kirill Bobyrev [Wed, 20 Jul 2016 12:28:38 +0000 (12:28 +0000)]
[clang-tidy] readability-identifier-naming - support for other case types

Added Camel_Snake_Case and camel_Snake_Back

class Camel_Snake_Case_Class_Name
{
  void private_Camel_Snake_Back_Method_Name();
}

Patch by James Reynolds!

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D21472

llvm-svn: 276110

8 years ago[docs] Fixing Sphinx warnings to unclog the buildbot
Renato Golin [Wed, 20 Jul 2016 12:16:38 +0000 (12:16 +0000)]
[docs] Fixing Sphinx warnings to unclog the buildbot

Lots of blocks had "llvm" or "nasm" syntax types but either weren't following
the syntax, or the syntax has changed (and sphinx hasn't keep up) or the type
doesn't even exist (nasm?).

Other documents had :options: what were invalid. I only removed those that had
warnings, and left the ones that didn't, in order to follow the principle of
least surprise.

This is like this for ages, but the buildbot is now failing on errors. It may
take a while to upgrade the buildbot's sphinx, if that's even possible, but
that shouldn't stop us from getting docs updates (which seem down for quite
a while).

Also, we're not losing any syntax highlight, since when it doesn't parse, it
doesn't colour. Ie. those blocks are not being highlighted anyway.

I'm trying to get all docs in one go, so that it's easy to revert later if we
do fix, or at least easy to know what's to fix.

llvm-svn: 276109

8 years agoAvoid some binary searches.
Rafael Espindola [Wed, 20 Jul 2016 11:47:50 +0000 (11:47 +0000)]
Avoid some binary searches.

In here we are iterating relocations in order, so we can do the same
with the pieces of .eh_frame and avoid a binary search.

The link times I got with this patch were:

firefox
  master 7.22977811
  patch  7.141041442 0.987726225252
chromium
  master 4.478966851
  patch  4.506602207 1.00617002914
chromium fast
  master 1.894713371
  patch  1.866446889 0.98508139414
the gold plugin
  master 0.386193907
  patch  0.382374918 0.990111213743
clang
  master 0.654849589
  patch  0.647899815 0.989387220949
llvm-as
  master 0.037212718
  patch  0.036858172 0.990472450843
the gold plugin fsds
  master 0.410876711
  patch  0.407418613 0.991583611562
clang fsds
  master 0.734623069
  patch  0.728237526 0.991307728726
llvm-as fsds
  master 0.033446197
  patch  0.03302833 0.987506292569
scylla
  master 3.38134402
  patch  3.414188846 1.00971354166

llvm-svn: 276108

8 years agotsan: fix windows build
Dmitry Vyukov [Wed, 20 Jul 2016 11:43:52 +0000 (11:43 +0000)]
tsan: fix windows build

Currently fails as:

gotsan.cc: In function 'void* __sanitizer::__libc_memalign(__sanitizer::uptr, __sanitizer::uptr)':
gotsan.cc:6194:50: error: 'posix_memalign' was not declared in this scope
   uptr error = posix_memalign(&p, alignment, size);

Windows does not provide posix_memalign.

llvm-svn: 276107

8 years agoRevert "[InstCombine] Enable cast-folding in logic(cast(icmp), cast(icmp))"
Benjamin Kramer [Wed, 20 Jul 2016 11:40:16 +0000 (11:40 +0000)]
Revert "[InstCombine] Enable cast-folding in logic(cast(icmp), cast(icmp))"

Makes InstCombine infloop when compiling v8.

This reverts commit r275989 and r276105.

llvm-svn: 276106

8 years ago[InstCombine] Provide more test cases for cast-folding [NFC]
Tobias Grosser [Wed, 20 Jul 2016 11:24:27 +0000 (11:24 +0000)]
[InstCombine] Provide more test cases for cast-folding [NFC]

Summary: In r275989 we enabled the folding of `logic(cast(icmp), cast(icmp))` to `cast(logic(icmp, icmp))`. Here we add more test cases to assure this folding works for all logical operations `and`/`or`/`xor`.

Reviewers: grosser

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D22561

Contributed-by: Matthias Reisinger
llvm-svn: 276105

8 years ago[X86][SSE] Add cost model values for CTPOP of vectors
Simon Pilgrim [Wed, 20 Jul 2016 10:41:28 +0000 (10:41 +0000)]
[X86][SSE] Add cost model values for CTPOP of vectors

This patch adds costs for the vectorized implementations of CTPOP, the default values were seriously underestimating the cost of these and was encouraging vectorization on targets where serialized use of POPCNT would be much better.

Differential Revision: https://reviews.llvm.org/D22456

llvm-svn: 276104

8 years agotsan: fix leak of shadow stacks
Dmitry Vyukov [Wed, 20 Jul 2016 10:29:08 +0000 (10:29 +0000)]
tsan: fix leak of shadow stacks

llvm-svn: 276103

8 years ago[X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using generic IR
Simon Pilgrim [Wed, 20 Jul 2016 10:18:01 +0000 (10:18 +0000)]
[X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using generic IR

D20859 and D20860 attempted to replace the SSE (V)CVTTPS2DQ and VCVTTPD2DQ truncating conversions with generic IR instead.

It turns out that the behaviour of these intrinsics is different enough from generic IR that this will cause problems, INF/NAN/out of range values are guaranteed to result in a 0x80000000 value - which plays havoc with constant folding which converts them to either zero or UNDEF. This is also an issue with the scalar implementations (which were already generic IR and what I was trying to match).

This patch changes both scalar and packed versions back to using x86-specific builtins.

It also deals with the other scalar conversion cases that are runtime rounding mode dependent and can have similar issues with constant folding.

Differential Revision: https://reviews.llvm.org/D22105

llvm-svn: 276102

8 years ago[ARM] Skip inline asm memory operands in DAGToDAGISel
Diana Picus [Wed, 20 Jul 2016 09:48:24 +0000 (09:48 +0000)]
[ARM] Skip inline asm memory operands in DAGToDAGISel

Retry r275776 (no changes, we suspect the issue was with another commit).

The current logic for handling inline asm operands in DAGToDAGISel interprets
the operands by looking for constants, which should represent the flags
describing the kind of operand we're dealing with (immediate, memory, register
def etc). The operands representing actual data are skipped only if they are
non-const, with the exception of immediate operands which are skipped explicitly
when a flag describing an immediate is found.

The oversight is that memory operands may be const too (e.g. for device drivers
reading a fixed address), so we should explicitly skip the operand following a
flag describing a memory operand. If we don't, we risk interpreting that
constant as a flag, which is definitely not intended.

Fixes PR26038

Differential Revision: https://reviews.llvm.org/D22103

llvm-svn: 276101

8 years ago[docs] fix cmake code-block warning
Renato Golin [Wed, 20 Jul 2016 09:47:09 +0000 (09:47 +0000)]
[docs] fix cmake code-block warning

This will unblock the llvm-sphinx-buildbot, which is currently failing due
to a warning being treated as error.

llvm-svn: 276100

8 years ago[docs] Add proposals to index file
Renato Golin [Wed, 20 Jul 2016 09:38:04 +0000 (09:38 +0000)]
[docs] Add proposals to index file

llvm-svn: 276099

8 years ago[include-fixer] Make error messages a bit prettier and make sure to
Benjamin Kramer [Wed, 20 Jul 2016 09:12:19 +0000 (09:12 +0000)]
[include-fixer] Make error messages a bit prettier and make sure to
include a newline at the end.

llvm-svn: 276098

8 years ago[docs] GitHub Proposal for LLVM
Renato Golin [Wed, 20 Jul 2016 09:09:58 +0000 (09:09 +0000)]
[docs] GitHub Proposal for LLVM

This document was crafted from the various (320+) emails between 2nd June and
20th July regarding the move to GitHub. It tried to consolidate every issue that
was raised and every solution that was presented to have a GitHub repository
with sub-modules.

It *does not* try to argue whether sub-modules are better or worse than any other
Git solution, nor if Git is better than any other VCS, nor if GitHub is better
than any other free code hosting service. This is just the final conclusions of
48 days and 320 emails (plus a lot of IRC discussions) on the LLVM community.

This document will be presented at the survey that the foundation will setup for
us to decide if we move to this solution or not. It reflects what was discussed
on the lists, but it's not authoritative. If something is not clear enough,
please refer to the mailing list discussions (hint: search for "GitHub").

Review: https://reviews.llvm.org/D22463
llvm-svn: 276097

8 years ago[include-fixer] Tweak: remove unintended const.
Haojian Wu [Wed, 20 Jul 2016 09:00:22 +0000 (09:00 +0000)]
[include-fixer] Tweak: remove unintended const.

llvm-svn: 276096

8 years agoSupport for standard model ARM TLS
Peter Smith [Wed, 20 Jul 2016 08:52:27 +0000 (08:52 +0000)]
Support for standard model ARM TLS

Add relocations and identification functions for the Initial Exec
and Global Dynamic TLS model defined in Addenda to, and Errata in,
the ABI for the ARM Architecture.

ARM uses variant 1 of the thread local storage data
structures as defined in ELF Handling for Thread-Local Storage.

The "experimental" descriptor based model that can be selected in
gcc, but not clang with -mtls-dialect=gnu2 is not supported.

The relocations R_ARM_TLS_LE12 and R_ARM_TLS_IE12GP are not
supported, I know of no ARM Toolchain that supports these relocations
as they limit the size of the TLS block.

No code relaxation is supported as the standard ARM TLS model puts
the relocations on literal data.

Support for the local dynamic model will come in a follow up patch.

Differential Revision: https://reviews.llvm.org/D22462

llvm-svn: 276095

8 years agoUpdate isl to isl-0.17.1-171-g233f589
Tobias Grosser [Wed, 20 Jul 2016 07:52:42 +0000 (07:52 +0000)]
Update isl to isl-0.17.1-171-g233f589

This fixes an issue with equality detection that resulted in an assertion
being triggered during coalescing.

llvm-svn: 276094

8 years agoFix inheriting constructor test for std::function.
Eric Fiselier [Wed, 20 Jul 2016 06:46:22 +0000 (06:46 +0000)]
Fix inheriting constructor test for std::function.

The test I originally checked in only worked with ToT Clang. This patch
updates the test so that it works as far back as 3.5.

llvm-svn: 276093

8 years agoUnbreak is_constructible tests for Clang <= 3.7.
Eric Fiselier [Wed, 20 Jul 2016 06:36:11 +0000 (06:36 +0000)]
Unbreak is_constructible tests for Clang <= 3.7.

There is a bug in Clang's __is_constructible builtin that causes it
to return true for function types; ex [T = void()].

llvm-svn: 276092