platform/upstream/llvm.git
8 years ago[esan] EfficiencySanitizer libc interceptors
Derek Bruening [Sat, 23 Apr 2016 16:41:24 +0000 (16:41 +0000)]
[esan] EfficiencySanitizer libc interceptors

Summary:
Adds libc interceptors to the runtime library for the new
EfficiencySanitizer ("esan") family of tools.  The interceptors cover
the memory operations in most common library calls and will be shared
among all esan tools.

Reviewers: aizatsky

Subscribers: zhaoqin, tberghammer, danalbert, srhines, llvm-commits, vitalybuka, eugenis, kcc

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

llvm-svn: 267293

8 years agoimprove documentation comments; NFC
Sanjay Patel [Sat, 23 Apr 2016 16:31:48 +0000 (16:31 +0000)]
improve documentation comments; NFC

llvm-svn: 267292

8 years agoObjectFile: parse EABI Attributes
Saleem Abdulrasool [Sat, 23 Apr 2016 16:00:15 +0000 (16:00 +0000)]
ObjectFile: parse EABI Attributes

This adds basic parsing of the EABI attributes section.  This section contains
additional information about the target for which the file was built.  Attempt
to infer additional architecture information from that section.

llvm-svn: 267291

8 years agoclang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp: Use raw_string_ostream:...
NAKAMURA Takumi [Sat, 23 Apr 2016 14:54:28 +0000 (14:54 +0000)]
clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp: Use raw_string_ostream::str() to flush the buffer explicitly.

llvm-svn: 267290

8 years agoAdd an invalid domain to memory accesses
Johannes Doerfert [Sat, 23 Apr 2016 14:32:34 +0000 (14:32 +0000)]
Add an invalid domain to memory accesses

  Memory accesses can have non-precisely modeled access functions that
  would cause us to build incorrect execution context for hoisted loads.
  This is the same issue that occurred during the domain construction for
  statements and it is dealt with the same way.

llvm-svn: 267289

8 years agoTranslate SCEVs to isl_pw_aff and their invalid domain
Johannes Doerfert [Sat, 23 Apr 2016 14:31:17 +0000 (14:31 +0000)]
Translate SCEVs to isl_pw_aff and their invalid domain

  The SCEVAffinator will now produce not only the isl representaiton of
  a SCEV but also the domain under which it is invalid. This is used to
  record possible overflows that can happen in the statement domains in
  the statements invalid domain. The result is that invalid loads have
  an accurate execution contexts with regards to the validity of their
  statements domain. While the SCEVAffinator currently is only taking
  "no-wrapping" assumptions, we can add more withouth worrying about the
  execution context of loads that are optimistically hoisted.

llvm-svn: 267288

8 years agoRename a few tests that had typos in their names. No functional change. Thanks to...
Marshall Clow [Sat, 23 Apr 2016 14:31:00 +0000 (14:31 +0000)]
Rename a few tests that had typos in their names. No functional change. Thanks to STL for the catch

llvm-svn: 267287

8 years agoTrack invalid domains not invalid contexts for statements
Johannes Doerfert [Sat, 23 Apr 2016 13:02:23 +0000 (13:02 +0000)]
Track invalid domains not invalid contexts for statements

  The invalid context is not enough to describe the parameter constraints under
  which a statement is not modeled precisely. The reason is that during the
  domain construction the bounds on the induction variables are not known but
  needed to check if e.g., an overflow can actually happen. To this end we
  replace the invalid context of a statement with an invalid domain. It is
  initialized during domain construction and intersected with the domain once
  it was completely build. Later this invalid domain allows to eliminate
  falsely assumed wrapping cases and other falsely assumed mismatches in the
  modeling.

llvm-svn: 267286

8 years agoImprove accuracy of Scop::hasFeasibleRuntimeContext
Johannes Doerfert [Sat, 23 Apr 2016 13:00:27 +0000 (13:00 +0000)]
Improve accuracy of Scop::hasFeasibleRuntimeContext

  If the AssumptionContext is a subset of the InvalidContext the runtime
  context is not feasible.

llvm-svn: 267285

8 years agoSimplify the execution context for dereferencable loads
Johannes Doerfert [Sat, 23 Apr 2016 12:59:18 +0000 (12:59 +0000)]
Simplify the execution context for dereferencable loads

  If we know it is safe to execute a load we do not need an execution
  context, however only if we are sure it was modeled correctly.

llvm-svn: 267284

8 years agoRemove simplification calls for the execution domain [NFC]
Johannes Doerfert [Sat, 23 Apr 2016 12:56:58 +0000 (12:56 +0000)]
Remove simplification calls for the execution domain [NFC]

  These calls were sometimes costly and do not show any improvements on our
  small test cases.

llvm-svn: 267283

8 years ago[X86][XOP] Added VPPERM -> BLEND-WITH-ZERO Test
Simon Pilgrim [Sat, 23 Apr 2016 11:14:18 +0000 (11:14 +0000)]
[X86][XOP] Added VPPERM -> BLEND-WITH-ZERO Test

Currently failing due to poor blend matching, found whilst investigating PR27472

llvm-svn: 267282

8 years agoUse %T instead of cd'ing to Output directly.
Benjamin Kramer [Sat, 23 Apr 2016 11:01:36 +0000 (11:01 +0000)]
Use %T instead of cd'ing to Output directly.

%T expands to Output if not configured differently.

llvm-svn: 267281

8 years ago[CodeGen] When promoting CTTZ operations to larger type, don't insert a select to...
Craig Topper [Sat, 23 Apr 2016 05:20:47 +0000 (05:20 +0000)]
[CodeGen] When promoting CTTZ operations to larger type, don't insert a select to detect if the input is zero to return the original size instead of the extended size. Instead just set the first bit in the zero extended part.

llvm-svn: 267280

8 years ago[gold] Gate value name discarding under save-temps
Teresa Johnson [Sat, 23 Apr 2016 05:15:59 +0000 (05:15 +0000)]
[gold] Gate value name discarding under save-temps

Summary:
This removes a couple of flags added to control this behavior, and
simply keeps all value names when save-temps is specified.

Reviewers: rafael

Subscribers: llvm-commits, pcc, davide

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

llvm-svn: 267279

8 years agoBitcodeWriter: Emit uniqued subgraphs after all distinct nodes
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 04:59:22 +0000 (04:59 +0000)]
BitcodeWriter: Emit uniqued subgraphs after all distinct nodes

Since forward references for uniqued node operands are expensive (and
those for distinct node operands are cheap due to
DistinctMDOperandPlaceholder), minimize forward references in uniqued
node operands.

Moreover, guarantee that when a cycle is broken by a distinct node, none
of the uniqued nodes have any forward references.  In
ValueEnumerator::EnumerateMetadata, enumerate uniqued node subgraphs
first, delaying distinct nodes until all uniqued nodes have been
handled.  This guarantees that uniqued nodes only have forward
references when there is a uniquing cycle (since r267276 changed
ValueEnumerator::organizeMetadata to partition distinct nodes in front
of uniqued nodes as a post-pass).

Note that a single uniqued subgraph can hit multiple distinct nodes at
its leaves.  Ideally these would themselves be emitted in post-order,
but this commit doesn't attempt that; I think it requires an extra pass
through the edges, which I'm not convinced is worth it (since
DistinctMDOperandPlaceholder makes forward references quite cheap
between distinct nodes).

I've added two testcases:

  - test/Bitcode/mdnodes-distinct-in-post-order.ll is just like
    test/Bitcode/mdnodes-in-post-order.ll, except with distinct nodes
    instead of uniqued ones.  This confirms that, in the absence of
    uniqued nodes, distinct nodes are still emitted in post-order.

  - test/Bitcode/mdnodes-distinct-nodes-break-cycles.ll is the minimal
    example where a naive post-order traversal would cause one uniqued
    node to forward-reference another.  IOW, it's the motivating test.

llvm-svn: 267278

8 years agoAvoid MSVC failure with default arguments in lambdas from r267270
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 04:52:47 +0000 (04:52 +0000)]
Avoid MSVC failure with default arguments in lambdas from r267270

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11700

llvm-svn: 267277

8 years agoBitcodeWriter: Emit distinct nodes before uniqued nodes
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 04:42:39 +0000 (04:42 +0000)]
BitcodeWriter: Emit distinct nodes before uniqued nodes

When an operand of a distinct node hasn't been read yet, the reader can
use a DistinctMDOperandPlaceholder.  This is much cheaper than forward
referencing from a uniqued node.  Change
ValueEnumerator::organizeMetadata to partition distinct nodes and
uniqued nodes to reduce the overhead of cycles broken by distinct nodes.

Mehdi measured this for me; this removes most of the RAUW from the
importing step of -flto=thin, even after a WIP patch that removes
string-based DITypeRefs (introducing many more cycles to the metadata
graph).

llvm-svn: 267276

8 years agoAdd #ifndef NDEBUG markers around EXPECT_DEATH after r267270
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 04:34:11 +0000 (04:34 +0000)]
Add #ifndef NDEBUG markers around EXPECT_DEATH after r267270

http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/36076

llvm-svn: 267275

8 years agoAddress comments.
Teresa Johnson [Sat, 23 Apr 2016 04:31:20 +0000 (04:31 +0000)]
Address comments.

llvm-svn: 267274

8 years agoRefactor bitcode writer into classes (NFC)
Teresa Johnson [Sat, 23 Apr 2016 04:30:47 +0000 (04:30 +0000)]
Refactor bitcode writer into classes (NFC)

Summary:
As discussed in on the mailing list yesterday, I have refactored
BitcodeWriter.cpp to use classes to manage the bitcode writing process,
instead of passing around long lists of parameters between static
functions. See:
  http://lists.llvm.org/pipermail/llvm-dev/2016-April/098610.html

I created a parent BitcodeWriter class to own the BitstreamWriter,
write the header, and contain the main entry point into the writing
process. There are two derived classes, one for writing a module and one
for writing a combined index file (for ThinLTO), which manage the
writing process specific to those bitcode file types.

I also changed the functions to conform to LLVM coding standards
(lowercase function name first letter). The only two routines that still
start with an uppercase letter are the two external interfaces, which
can be fixed as a follow-on (I wanted to keep this round just within
BitcodeWriter.cpp).

Reviewers: dexonsmith, joker.eph

Subscribers: llvm-commits

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

llvm-svn: 267273

8 years agoAvoid ternery statement to please g++ after r267270, NFC
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 04:23:57 +0000 (04:23 +0000)]
Avoid ternery statement to please g++ after r267270, NFC

http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/36074

llvm-svn: 267272

8 years agoValueEnumerator: Use std::find_if, NFC
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 04:22:38 +0000 (04:22 +0000)]
ValueEnumerator: Use std::find_if, NFC

Mehdi's pattern recognition pulled this one out.  This is cleaner with
std::find_if than with the strange helper function that took an iterator
by reference and updated it.

llvm-svn: 267271

8 years agoBitcodeReader: Avoid referencing unresolved nodes from distinct ones
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 04:15:56 +0000 (04:15 +0000)]
BitcodeReader: Avoid referencing unresolved nodes from distinct ones

Each reference to an unresolved MDNode is expensive, since the RAUW
support in MDNode uses a separate allocation and side map.  Since
a distinct MDNode doesn't require its operands on creation (unlike
uniuqed nodes, there's no need to check for structural equivalence),
use nullptr for any of its unresolved operands.  Besides reducing the
burden on MDNode maps, this can avoid allocating temporary MDNodes in
the first place.

We need some way to track operands.  Invent DistinctMDOperandPlaceholder
for this purpose, which is a Metadata subclass that holds an ID and
points at its single user.  DistinctMDOperandPlaceholder::replaceUseWith
is just like RAUW, but its name highlights that there is only ever
exactly one use.

There is no support for moving (or, obviously, copying) these.  Move
support would be possible but expensive; leaving it unimplemented
prevents user error.  In the BitcodeReader I originally considered
allocating on a BumpPtrAllocator and keeping a vector of pointers to
them, and then I realized that std::deque implements exactly this.

A couple of obvious follow-ups:

  - Change ValueEnumerator to emit distinct nodes first to take more
    advantage of this optimization.  (How convenient... I think I might
    have a couple of patches for this.)

  - Change DIBuilder and its consumers (like CGDebugInfo in clang) to
    use something like this when constructing debug info in the first
    place.

llvm-svn: 267270

8 years agoTag the end of an anonymous namespace, NFC
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 04:02:39 +0000 (04:02 +0000)]
Tag the end of an anonymous namespace, NFC

Prevent clang-format from moving the closing branch.

llvm-svn: 267269

8 years agoBitcodeReader: Consistently use IsDistinct, NFC
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 04:01:57 +0000 (04:01 +0000)]
BitcodeReader: Consistently use IsDistinct, NFC

Consistently use the IsDistinct variable and start relying on it in
GET_OR_DISTINCT.  This change has NFC, but prepares for using IsDistinct
to optimize the behaviour of the getMD() and getMDOrNull() helpers.

llvm-svn: 267268

8 years agoBitcodeReader: Use getMD/getMDOrNull helpers consistently, almost NFC
Duncan P. N. Exon Smith [Sat, 23 Apr 2016 03:55:14 +0000 (03:55 +0000)]
BitcodeReader: Use getMD/getMDOrNull helpers consistently, almost NFC

The only functionality change was removing an error check from the
BitcodeReader (and an assertion from DILocation::getImpl) that is
already caught by Verifier::visitDILocation.  The Verifier is a better
place for this anyway, and being inconsistent with other subclasses of
MDNode isn't serving anyone.

llvm-svn: 267267

8 years ago[Hexagon] Set ctlz_zero_undef/cttz_zero_undef to Expand so LegalizeDAG will convert...
Craig Topper [Sat, 23 Apr 2016 02:49:31 +0000 (02:49 +0000)]
[Hexagon] Set ctlz_zero_undef/cttz_zero_undef to Expand so LegalizeDAG will convert them to ctlz/cttz. Remove the now unneccessary isel patterns. NFC

llvm-svn: 267266

8 years ago[NVPTX] Set ctlz_zero_undef to Expand so LegalizeDAG will convert it to ctlz. Remove...
Craig Topper [Sat, 23 Apr 2016 02:49:29 +0000 (02:49 +0000)]
[NVPTX] Set ctlz_zero_undef to Expand so LegalizeDAG will convert it to ctlz. Remove the now unneccessary isel patterns. NFC

llvm-svn: 267265

8 years ago[WebAssembly] Set ctlz_zero_undef/cttz_zero_undef to Expand so LegalizeDAG will conve...
Craig Topper [Sat, 23 Apr 2016 02:49:25 +0000 (02:49 +0000)]
[WebAssembly] Set ctlz_zero_undef/cttz_zero_undef to Expand so LegalizeDAG will convert them to ctlz/cttz. Remove the now unneccessary isel patterns. NFC

llvm-svn: 267264

8 years ago[profile] Fix another use of the driver.
Sean Silva [Sat, 23 Apr 2016 02:13:48 +0000 (02:13 +0000)]
[profile] Fix another use of the driver.

Follow-on to r267262.

llvm-svn: 267263

8 years ago[profile] Use cc1 in these tests instead of the driver.
Sean Silva [Sat, 23 Apr 2016 02:11:16 +0000 (02:11 +0000)]
[profile] Use cc1 in these tests instead of the driver.

I ran into this when seeing what tests would break if we make a
driver-level decision about whether FEPGO or IRPGO is the default.

llvm-svn: 267262

8 years agoAdd a file comment about the Ulrich's document and don't repeat it in other comments.
Rui Ueyama [Sat, 23 Apr 2016 01:10:15 +0000 (01:10 +0000)]
Add a file comment about the Ulrich's document and don't repeat it in other comments.

llvm-svn: 267261

8 years agoAdd more comment.
Rui Ueyama [Sat, 23 Apr 2016 01:10:13 +0000 (01:10 +0000)]
Add more comment.

llvm-svn: 267260

8 years agoAdd comments.
Rui Ueyama [Sat, 23 Apr 2016 00:26:32 +0000 (00:26 +0000)]
Add comments.

llvm-svn: 267259

8 years agoStyle fix in Core.h / Core.cpp. NFC
Amaury Sechet [Sat, 23 Apr 2016 00:12:45 +0000 (00:12 +0000)]
Style fix in Core.h / Core.cpp. NFC

llvm-svn: 267257

8 years ago[sanitizer] add a function MmapNoAccess that mmaps a protected region *somewhere...
Kostya Serebryany [Sat, 23 Apr 2016 00:05:24 +0000 (00:05 +0000)]
[sanitizer] add a function MmapNoAccess that mmaps a protected region *somewhere*; use MmapNoAccess in the Allocator when SpaceBeg is not a constant. In this mode the allocator will be a bit more hardened

llvm-svn: 267256

8 years agoUse ScriptParserBase features to parse linker script expressions.
Rui Ueyama [Sat, 23 Apr 2016 00:04:03 +0000 (00:04 +0000)]
Use ScriptParserBase features to parse linker script expressions.

Previously, we have re-implemented utility functions such as `expect`
or `next` in LinkerScript.cpp. This patch reuses the existing
implementation that is in ScriptParser.cpp.

llvm-svn: 267255

8 years ago[clang-tidy] Fix misc-macro-repeated-side-effects false positive with stringified...
Alexander Kornienko [Sat, 23 Apr 2016 00:00:08 +0000 (00:00 +0000)]
[clang-tidy] Fix misc-macro-repeated-side-effects false positive with stringified arguments

llvm-svn: 267254

8 years ago[sanitizer] rename MmapNoAccess to MmapFixedNoAccess; NFC
Kostya Serebryany [Fri, 22 Apr 2016 23:46:53 +0000 (23:46 +0000)]
[sanitizer] rename MmapNoAccess to MmapFixedNoAccess; NFC

llvm-svn: 267253

8 years ago[sanitizer] partially un-revert r267094: Allow the sanitizer allocator to use a non...
Kostya Serebryany [Fri, 22 Apr 2016 23:35:00 +0000 (23:35 +0000)]
[sanitizer] partially un-revert r267094: Allow the sanitizer allocator to use a non-fixed address range. An allocator with a non-fixed address range will be attack-resistan. NFC for the sanitizers at this point.

llvm-svn: 267252

8 years ago[sanitizer] revert r267203 as it breaks aarch64 bots
Kostya Serebryany [Fri, 22 Apr 2016 23:27:15 +0000 (23:27 +0000)]
[sanitizer] revert r267203 as it breaks aarch64 bots

llvm-svn: 267251

8 years agollvm-objdump: deal with invalid ARM encodings slightly better.
Tim Northover [Fri, 22 Apr 2016 23:23:31 +0000 (23:23 +0000)]
llvm-objdump: deal with invalid ARM encodings slightly better.

Before we printed a warning to stderr and left the actual output stream in a
mess. This tries to print a .long or .short representation of what we saw (as
if there was a data-in-code directive).

This isn't guaranteed to restore synchronization in Thumb-mode (if the invalid
instruction was supposed to be 32-bits, we may be off-by-16 for the rest of the
function). But there's no certain way to deal with that, and it's invalid code
anyway (if the data really wasn't an instruction, the user can add proper
.data_in_code directives if they care)

llvm-svn: 267250

8 years agoMachO: remove weird ARM/Thumb interface from MachOObjectFile
Tim Northover [Fri, 22 Apr 2016 23:21:13 +0000 (23:21 +0000)]
MachO: remove weird ARM/Thumb interface from MachOObjectFile

Only one consumer (llvm-objdump) actually cared about the fact that there were
two triples. Others were actively working around the fact that the Triple
returned by getArch might have been invalid. As for llvm-objdump, it needs to
be acutely aware of both Triples anyway, so being generic in the exposed API is
no benefit.

Also rename the version of getArch returning a Triple. Users were having to
pass an unwanted nullptr to disambiguate the two, which was nasty.

The only functional change here is that armv7m and armv7em object files no
longer crash llvm-objdump.

llvm-svn: 267249

8 years agoDWARF layout for bitfields is wrong when the bit offset is negative.
Greg Clayton [Fri, 22 Apr 2016 23:14:35 +0000 (23:14 +0000)]
DWARF layout for bitfields is wrong when the bit offset is negative.

Some older versions of clang emitted bit offsets that were negative and these bitfields would have their bitfield-ness stripped off and it would cause a clang assertion in clang assertions were enabled. I updated the bitfield C test to make sure we don't regress.

<rdar://problem/21082998>

llvm-svn: 267248

8 years agoSource: fix another -Wunused-variable warning
Saleem Abdulrasool [Fri, 22 Apr 2016 23:08:34 +0000 (23:08 +0000)]
Source: fix another -Wunused-variable warning

Conditionalise a variable definition which may be unused in certain compilations
due to the preprocessor.  Protect the variable accordingly.  NFC.

llvm-svn: 267247

8 years agoDevirtualize ScriptParserBase. NFC.
Rui Ueyama [Fri, 22 Apr 2016 22:59:24 +0000 (22:59 +0000)]
Devirtualize ScriptParserBase. NFC.

ScriptParserBase class is a container of collection of various methods
to parse linker script-ish text. It had a virtual method `run` to run
the parser. But we don't have to enforce its descendents to implement
that. It's up to them.

This patch removes pure virtual function `run`.

llvm-svn: 267246

8 years agoFix link failure.
Rui Ueyama [Fri, 22 Apr 2016 22:59:22 +0000 (22:59 +0000)]
Fix link failure.

llvm-svn: 267245

8 years agoAMDGPU: sext_inreg (srl x, K), vt -> bfe x, K, vt.Size
Matt Arsenault [Fri, 22 Apr 2016 22:59:16 +0000 (22:59 +0000)]
AMDGPU: sext_inreg (srl x, K), vt -> bfe x, K, vt.Size

llvm-svn: 267244

8 years agoFix llvm/test/CodeGen/ARM/Windows/dbzchk.ll not to check mixed output, take #2.
NAKAMURA Takumi [Fri, 22 Apr 2016 22:51:48 +0000 (22:51 +0000)]
Fix llvm/test/CodeGen/ARM/Windows/dbzchk.ll not to check mixed output, take #2.

llvm-svn: 267242

8 years agollvm-symbolizer: Avoid infinite recursion walking dwos where the dwo contains a dwo_n...
David Blaikie [Fri, 22 Apr 2016 22:50:56 +0000 (22:50 +0000)]
llvm-symbolizer: Avoid infinite recursion walking dwos where the dwo contains a dwo_name attribute

The dwo_name was added to dwo files to improve diagnostics in dwp, but
it confuses tools that attempt to load any dwo named by a dwo_name, even
ones inside dwos. Avoid this by keeping track of whether a unit is
already a dwo unit, and if so, not loading further dwos.

llvm-svn: 267241

8 years agoAMDGPU: Re-visit nodes in performAndCombine
Matt Arsenault [Fri, 22 Apr 2016 22:48:38 +0000 (22:48 +0000)]
AMDGPU: Re-visit nodes in performAndCombine

This fixes test regressions when i64 loads/stores are made promote.

llvm-svn: 267240

8 years agoAdd some release notes about the fix for PR26774
Sanjoy Das [Fri, 22 Apr 2016 22:45:23 +0000 (22:45 +0000)]
Add some release notes about the fix for PR26774

As suggested by Chandler on the review thread for D18634.

llvm-svn: 267239

8 years agoFix comment about Intr*Mem properties
Nicolai Haehnle [Fri, 22 Apr 2016 22:37:58 +0000 (22:37 +0000)]
Fix comment about Intr*Mem properties

Summary:
Follow up to D19291: it now makes sense to use two Intr*Mem properties,
in particular IntrReadMem + IntrArgMemOnly is common.

Pointed out by Mikael Holmén.

Reviewers: uabelho, joker.eph, reames

Subscribers: llvm-commits

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

llvm-svn: 267238

8 years agoFixed in issue with ObjectFileMachO where it would add empty sections to the section...
Greg Clayton [Fri, 22 Apr 2016 22:35:08 +0000 (22:35 +0000)]
Fixed in issue with ObjectFileMachO where it would add empty sections to the section list that was used to try and cap symbols to the max address of the section in which it is contained. The empty sections would make cap the symbols and make their sizes zero. Also fixed a few other things that could cause problems in the SymbolFileDWARFDebugMap when zero sized symbols were found and used to make OSO range map entries.

<rdar://problem/25886773>

llvm-svn: 267237

8 years agoRemoving unused function.
Andrew Kaylor [Fri, 22 Apr 2016 22:24:20 +0000 (22:24 +0000)]
Removing unused function.

llvm-svn: 267236

8 years agoFix a build-llvm.py crasher when we can't find cmake. Now it exits with a valid error...
Greg Clayton [Fri, 22 Apr 2016 22:15:59 +0000 (22:15 +0000)]
Fix a build-llvm.py crasher when we can't find cmake. Now it exits with a valid error that explains what went wrong.

llvm-svn: 267235

8 years agoRevert the bool portion of r267054
Richard Trieu [Fri, 22 Apr 2016 22:14:32 +0000 (22:14 +0000)]
Revert the bool portion of r267054

Remove the floating point to bool conversion warnings.  Some of these
conversions will be caught by -Wliteral-conversion and -Wfloat-conversion

llvm-svn: 267234

8 years agoBring r267164 back with a fix.
Rafael Espindola [Fri, 22 Apr 2016 22:09:35 +0000 (22:09 +0000)]
Bring r267164 back with a fix.

The fix is to handle local symbols referring to SHF_MERGE sections.

Original message:

GC entries of SHF_MERGE sections.

It is a fairly direct extension of the gc algorithm. For merge sections
instead of remembering just a live bit, we remember which offsets
were used.

This reduces the .rodata sections in chromium from 9648861 to 9477472
bytes.

llvm-svn: 267233

8 years agoRevert r267210, it makes clang assert (PR27490).
Nico Weber [Fri, 22 Apr 2016 22:08:42 +0000 (22:08 +0000)]
Revert r267210, it makes clang assert (PR27490).

llvm-svn: 267232

8 years agoRe-commit optimization bisect support (r267022) without new pass manager support.
Andrew Kaylor [Fri, 22 Apr 2016 22:06:11 +0000 (22:06 +0000)]
Re-commit optimization bisect support (r267022) without new pass manager support.

The original commit was reverted because of a buildbot problem with LazyCallGraph::SCC handling (not related to the OptBisect handling).

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

llvm-svn: 267231

8 years agoLTO: Merge -lto-no-discard-value-names with -save-temps.
Rui Ueyama [Fri, 22 Apr 2016 21:43:10 +0000 (21:43 +0000)]
LTO: Merge -lto-no-discard-value-names with -save-temps.

This patch is to remove -lto-no-discard-value-names flag and
instead to use -save-temps as we discussed in the post-commit
review thread for r267020.

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

llvm-svn: 267230

8 years agoDifferential Revision: http://reviews.llvm.org/D19040
Sriraman Tallam [Fri, 22 Apr 2016 21:41:58 +0000 (21:41 +0000)]
Differential Revision: reviews.llvm.org/D19040

llvm-svn: 267229

8 years ago[Clang-tidy] Fix Clang warning in misc/StringConstructorCheck.h.
Eugene Zelenko [Fri, 22 Apr 2016 21:33:33 +0000 (21:33 +0000)]
[Clang-tidy] Fix Clang warning in misc/StringConstructorCheck.h.

Using LLVM_ENABLE_WARNINGS=ON is good idea.

llvm-svn: 267228

8 years agollvm-symbolizer: prefer .dwo contents over fission-gmlt-like-data when .dwo file...
David Blaikie [Fri, 22 Apr 2016 21:32:59 +0000 (21:32 +0000)]
llvm-symbolizer: prefer .dwo contents over fission-gmlt-like-data when .dwo file is present

Rather than relying on the gmlt-like data emitted into the .o/executable
which only contains the simple name of any inlined functions, use the
.dwo file if present.

Test symbolication with/without a .dwo, and the old test that was
testing behavior when no gmlt-like data was present. (I haven't included
a test of non-gmlt-like data + no .dwo (that would be akin to
symbolication with no debug info) but we could add one for completeness)

The test was simplified a bit to be a little clearer (unoptimized, force
inline, using a function call as the inlined entity) and regenerated
with ToT clang. For the no-gmlt-like-data case, I modified Clang back to
its old behavior temporarily & the .dwo file is identical so it is
shared between the two executables.

llvm-svn: 267227

8 years agoUpdate discriminator assignment algorithm in clang assembler.
Dehao Chen [Fri, 22 Apr 2016 21:31:18 +0000 (21:31 +0000)]
Update discriminator assignment algorithm in clang assembler.

Summary: The clang assembler assumes that the discriminator remains the same when there is source line change. The correct behavior is that when there is line change, discriminator will automatically reset to 0.

Reviewers: dnovillo, davidxl, echristo

Subscribers: echristo, llvm-commits

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

llvm-svn: 267226

8 years agoAMDGPU: Fix crash when dumping unknown opcode
Matt Arsenault [Fri, 22 Apr 2016 21:23:41 +0000 (21:23 +0000)]
AMDGPU: Fix crash when dumping unknown opcode

I'm for some reason having a problem producing a test.
It should be the same as test/MC/X86/invalid_opcode.s,
but llvm-mc seems to ignore random bytes.

llvm-svn: 267225

8 years agoPGO] PGOFuncName meta data if PGOFuncName is different from function's raw name
Rong Xu [Fri, 22 Apr 2016 21:19:05 +0000 (21:19 +0000)]
PGO] PGOFuncName meta data if PGOFuncName is different from function's raw name

Write out the PGOFuncName meta data if PGOFuncName is different from function's
raw name. This should only apply to internal linkage functions. This is to be
consumed by indirect-call promotion when called in LTO optimization pass.

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

llvm-svn: 267224

8 years agoIntroduce llvm.load.relative intrinsic.
Peter Collingbourne [Fri, 22 Apr 2016 21:18:02 +0000 (21:18 +0000)]
Introduce llvm.load.relative intrinsic.

This intrinsic takes two arguments, ``%ptr`` and ``%offset``. It loads
a 32-bit value from the address ``%ptr + %offset``, adds ``%ptr`` to that
value and returns it. The constant folder specifically recognizes the form of
this intrinsic and the constant initializers it may load from; if a loaded
constant initializer is known to have the form ``i32 trunc(x - %ptr)``,
the intrinsic call is folded to ``x``.

LLVM provides that the calculation of such a constant initializer will
not overflow at link time under the medium code model if ``x`` is an
``unnamed_addr`` function. However, it does not provide this guarantee for
a constant initializer folded into a function body. This intrinsic can be
used to avoid the possibility of overflows when loading from such a constant.

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

llvm-svn: 267223

8 years agoRemove unused #include.
Rui Ueyama [Fri, 22 Apr 2016 21:17:55 +0000 (21:17 +0000)]
Remove unused #include.

llvm-svn: 267222

8 years agoMove BitcodeCompiler constructor to the .cpp file. NFC.
Rui Ueyama [Fri, 22 Apr 2016 21:16:18 +0000 (21:16 +0000)]
Move BitcodeCompiler constructor to the .cpp file. NFC.

llvm-svn: 267221

8 years agoTLI: Only iterate over integer vector types
Matt Arsenault [Fri, 22 Apr 2016 21:16:17 +0000 (21:16 +0000)]
TLI: Only iterate over integer vector types

Instead of iterating over all vectors and skipping integers.

llvm-svn: 267220

8 years agoInline getInteger as it's too short to be a function. NFC.
Rui Ueyama [Fri, 22 Apr 2016 21:05:04 +0000 (21:05 +0000)]
Inline getInteger as it's too short to be a function. NFC.

llvm-svn: 267219

8 years agoUpdate a comment for r267145.
Rui Ueyama [Fri, 22 Apr 2016 21:02:27 +0000 (21:02 +0000)]
Update a comment for r267145.

llvm-svn: 267218

8 years agoDAGCombiner: Relax alignment restriction when changing store type
Matt Arsenault [Fri, 22 Apr 2016 21:01:41 +0000 (21:01 +0000)]
DAGCombiner: Relax alignment restriction when changing store type

If the target allows the alignment, this should be OK.

llvm-svn: 267217

8 years ago[PGO] change the interface for createPGOFuncNameMetadata()
Rong Xu [Fri, 22 Apr 2016 21:00:17 +0000 (21:00 +0000)]
[PGO] change the interface for createPGOFuncNameMetadata()

This patch changes the interface for createPGOFuncNameMetadata() where we add
another PGOFuncName argument.

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

llvm-svn: 267216

8 years ago[unordered] sink unordered stores at end of blocks
Philip Reames [Fri, 22 Apr 2016 20:53:32 +0000 (20:53 +0000)]
[unordered] sink unordered stores at end of blocks

The existing code turned out to be completely correct when auditted.  Thus, only minor code changes and adding a couple of tests.

llvm-svn: 267215

8 years agoFold compares for distinct allocations
Sanjoy Das [Fri, 22 Apr 2016 20:52:25 +0000 (20:52 +0000)]
Fold compares for distinct allocations

Summary:
We can fold compares to false when two distinct allocations within a
function are compared for equality.

Patch by Anna Thomas!

Reviewers: majnemer, reames, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 267214

8 years agoMove uintX_t typedef to the class definition. NFC.
Rui Ueyama [Fri, 22 Apr 2016 20:41:07 +0000 (20:41 +0000)]
Move uintX_t typedef to the class definition. NFC.

Now it is doable because LinkerScript is a template class.

llvm-svn: 267212

8 years agoCodeGen: Use PLT relocations for relative references to unnamed_addr functions.
Peter Collingbourne [Fri, 22 Apr 2016 20:40:10 +0000 (20:40 +0000)]
CodeGen: Use PLT relocations for relative references to unnamed_addr functions.

The relative vtable ABI (PR26723) needs PLT relocations to refer to virtual
functions defined in other DSOs. The unnamed_addr attribute means that the
function's address is not significant, so we're allowed to substitute it
with the address of a PLT entry.

Also includes a bonus feature: addends for COFF image-relative references.

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

llvm-svn: 267211

8 years ago[unordered] Extend load/store type canonicalization to handle unordered operations
Philip Reames [Fri, 22 Apr 2016 20:33:48 +0000 (20:33 +0000)]
[unordered] Extend load/store type canonicalization to handle unordered operations

Extend the type canonicalization logic to work for unordered atomic loads and stores.  Note that while this change itself is fairly simple and low risk, there's a reasonable chance this will expose problems in the backends by suddenly generating IR they wouldn't have seen before.  Anything of this nature will be an existing bug in the backend (you could write an atomic float load), but this will definitely change the frequency with which such cases are encountered.  If you see problems, feel free to revert this change, but please make sure you collect a test case.

llvm-svn: 267210

8 years agoDAGCombiner: Relax alignment restriction when changing load type
Matt Arsenault [Fri, 22 Apr 2016 20:21:36 +0000 (20:21 +0000)]
DAGCombiner: Relax alignment restriction when changing load type

If the target allows the alignment, this should still be OK.

llvm-svn: 267209

8 years agoELF: Implement basic support for --version-script.
Peter Collingbourne [Fri, 22 Apr 2016 20:21:26 +0000 (20:21 +0000)]
ELF: Implement basic support for --version-script.

This patch only implements support for version scripts of the form:
  { [ global: symbol1; symbol2; [...]; symbolN; ] local: *; };
No wildcards are supported, other than for the local entry. Symbol versioning
is also not supported.

It works by introducing a new Symbol flag which tracks whether a symbol
appears in the global section of a version script.

This patch also simplifies the logic in SymbolBody::isPreemptible(), and
teaches it to handle the case where symbols with default visibility in DSOs
do not appear in the dynamic symbol table because of a version script.

Fixes PR27482.

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

llvm-svn: 267208

8 years agoUpdate test.
Rafael Espindola [Fri, 22 Apr 2016 20:21:25 +0000 (20:21 +0000)]
Update test.

Sorry about the noise.

llvm-svn: 267207

8 years ago[AArch64] Fix optimizeCondBranch logic.
Quentin Colombet [Fri, 22 Apr 2016 20:09:58 +0000 (20:09 +0000)]
[AArch64] Fix optimizeCondBranch logic.

The opcode for the optimized branch does not depend on the size
of the activate bits in the AND masks, but the AND opcode itself.
Indeed, we need to use a X or W variant based on the AND variant
not based on whether the mask fits into the related variant.
Otherwise, we may end up using the W variant of the optimized branch
for 64-bit register inputs!

This fixes the last make check verifier issues for AArch64: PR27479.

llvm-svn: 267206

8 years agoAdd missing options that were required to crash.
Rafael Espindola [Fri, 22 Apr 2016 20:07:59 +0000 (20:07 +0000)]
Add missing options that were required to crash.

llvm-svn: 267204

8 years ago[sanitizer] allow zero first parameter in MmapNoAccess; This is a part of r267094...
Kostya Serebryany [Fri, 22 Apr 2016 20:05:52 +0000 (20:05 +0000)]
[sanitizer] allow zero first parameter in MmapNoAccess; This is a part of r267094 that has been reverted

llvm-svn: 267203

8 years agoAdd a reduction of the recent bootstrap failure.
Rafael Espindola [Fri, 22 Apr 2016 20:05:16 +0000 (20:05 +0000)]
Add a reduction of the recent bootstrap failure.

llvm-svn: 267202

8 years agoReorganize LinkerDriver::link and add comments. NFC.
Rui Ueyama [Fri, 22 Apr 2016 19:58:47 +0000 (19:58 +0000)]
Reorganize LinkerDriver::link and add comments. NFC.

llvm-svn: 267201

8 years agoUpdate an out of date comment.
Peter Collingbourne [Fri, 22 Apr 2016 19:56:45 +0000 (19:56 +0000)]
Update an out of date comment.

llvm-svn: 267200

8 years agoPM: Port SinkingPass to the new pass manager
Justin Bogner [Fri, 22 Apr 2016 19:54:10 +0000 (19:54 +0000)]
PM: Port SinkingPass to the new pass manager

llvm-svn: 267199

8 years agoPM: Reorder the functions used for SinkingPass. NFC
Justin Bogner [Fri, 22 Apr 2016 19:54:04 +0000 (19:54 +0000)]
PM: Reorder the functions used for SinkingPass. NFC

This will make the port to the new PM easier to follow.

llvm-svn: 267198

8 years ago[DeadStoreElimination] Shorten beginning of memset overwritten by later stores
Jun Bum Lim [Fri, 22 Apr 2016 19:51:29 +0000 (19:51 +0000)]
[DeadStoreElimination] Shorten beginning of memset overwritten by later stores

Summary: This change will shorten memset if the beginning of memset is overwritten by later stores.

Reviewers: hfinkel, eeckstein, dberlin, mcrosier

Subscribers: mgrang, mcrosier, llvm-commits

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

llvm-svn: 267197

8 years agoPM: Port DCE to the new pass manager
Justin Bogner [Fri, 22 Apr 2016 19:40:41 +0000 (19:40 +0000)]
PM: Port DCE to the new pass manager

Also add a very basic test, since apparently there aren't any tests
for DCE whatsoever to add the new pass version to.

llvm-svn: 267196

8 years agoInline SymbolTable::compareCommons and add comments. NFC.
Rui Ueyama [Fri, 22 Apr 2016 19:34:59 +0000 (19:34 +0000)]
Inline SymbolTable::compareCommons and add comments. NFC.

llvm-svn: 267195

8 years ago Revert "GC entries of SHF_MERGE sections."
Rafael Espindola [Fri, 22 Apr 2016 19:31:35 +0000 (19:31 +0000)]
Revert "GC entries of SHF_MERGE sections."

    This reverts commit r267164.

    Revert "Trying to fix the windows build."

    This reverts commit r267168.

Debugging a bootstrap problem.

llvm-svn: 267194

8 years agoMachineScheduler: Move code to initialize a Candidate out of tryCandidate(); NFC
Matthias Braun [Fri, 22 Apr 2016 19:10:15 +0000 (19:10 +0000)]
MachineScheduler: Move code to initialize a Candidate out of tryCandidate(); NFC

llvm-svn: 267191

8 years ago[LoopUtils] Extend findStringMetadataForLoop to return the value for metadata
Adam Nemet [Fri, 22 Apr 2016 19:10:05 +0000 (19:10 +0000)]
[LoopUtils] Extend findStringMetadataForLoop to return the value for metadata

E.g. for:

  !1 = {"llvm.distribute", i32 1}

it now returns the MDOperand for 1.

I will use this in LoopDistribution to check the value of the metadata.

Note that the change is backward-compatible with its current use in
LoopVersioningLICM.  An Optional implicitly converts to a bool depending
whether it contains a value or not.

llvm-svn: 267190

8 years agoMachineScheduler: Limit the size of the ready list.
Matthias Braun [Fri, 22 Apr 2016 19:09:17 +0000 (19:09 +0000)]
MachineScheduler: Limit the size of the ready list.

Avoid quadratic complexity in unusually large basic blocks by limiting
the size of the ready lists.

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

llvm-svn: 267189

8 years agoELF: Scan for undefined symbols in shlibs and symbols in dynamic lists before LTO.
Peter Collingbourne [Fri, 22 Apr 2016 18:47:52 +0000 (18:47 +0000)]
ELF: Scan for undefined symbols in shlibs and symbols in dynamic lists before LTO.

This ensures that these features work correctly with bitcode files.

llvm-svn: 267188