platform/upstream/llvm.git
8 years agoFix TestGetVariables.py.
Chaoren Lin [Mon, 25 Apr 2016 23:29:53 +0000 (23:29 +0000)]
Fix TestGetVariables.py.

Reviewers: sivachandra, clayborg

Subscribers: lldb-commits

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

llvm-svn: 267492

8 years agoAdd check for "branch_weights" with prof metadata
Sanjay Patel [Mon, 25 Apr 2016 23:15:16 +0000 (23:15 +0000)]
Add check for "branch_weights" with prof metadata

While we're here, fix the comment and variable names to make it
clear that these are raw weights, not percentages.

llvm-svn: 267491

8 years ago[CMake] If set we should pass LLVM_VERSION_INFO into config.h
Chris Bieneman [Mon, 25 Apr 2016 23:02:47 +0000 (23:02 +0000)]
[CMake] If set we should pass LLVM_VERSION_INFO into config.h

Autoconf used to support setting LLVM_VERSION_INFO and there is some code filtered around llvm in Support/CommandLine.cpp and LTO/LTOCodeGenerator.cpp that uses it if it is set.

We also shouldn't be explicitly setting it as a define on llvm-shlib. It is pointless there because there is no code using it in llvm-shlib, and it is better to have it as part of the generated config.h so that it is available everywhere.

llvm-svn: 267490

8 years ago[Sparc] Fix double-float fabs and fneg on little endian CPUs.
James Y Knight [Mon, 25 Apr 2016 22:54:09 +0000 (22:54 +0000)]
[Sparc] Fix double-float fabs and fneg on little endian CPUs.

The SparcV8 fneg and fabs instructions interestingly come only in a
single-float variant. Since the sign bit is always the topmost bit no
matter what size float it is, you simply operate on the high
subregister, as if it were a single float.

However, the layout of double-floats in the float registers is reversed
on little-endian CPUs, so that the high bits are in the second
subregister, rather than the first.

Thus, this expansion must check the endianness to use the correct
subregister.

llvm-svn: 267489

8 years agoARM: put correct symbol index on indirect pointers in __thread_ptr.
Tim Northover [Mon, 25 Apr 2016 22:36:07 +0000 (22:36 +0000)]
ARM: put correct symbol index on indirect pointers in __thread_ptr.

Otherwise the linker has no idea what should be resolved.

llvm-svn: 267488

8 years agoFix build warning
Andrew Kaylor [Mon, 25 Apr 2016 22:27:30 +0000 (22:27 +0000)]
Fix build warning

llvm-svn: 267487

8 years ago[MSan] Use COMMON_INTERCEPTOR_ENTER in libdl interceptors.
Marcin Koscielnicki [Mon, 25 Apr 2016 22:25:49 +0000 (22:25 +0000)]
[MSan] Use COMMON_INTERCEPTOR_ENTER in libdl interceptors.

This fixes fails in test/msan/dlerror.cc - when real dlerror calls strcmp,
our strcmp interceptor now skips poison checking, since it's called in
interceptor context.  Strictly speaking, only the dlerror change is
necessary to fix the fail, but let's also change the other two just in case.

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

llvm-svn: 267486

8 years agoAdd optimization bisect opt-in calls for AMDGPU passes
Andrew Kaylor [Mon, 25 Apr 2016 22:23:44 +0000 (22:23 +0000)]
Add optimization bisect opt-in calls for AMDGPU passes

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

llvm-svn: 267485

8 years agoReformat LLVMConstPointerNull. NFC
Amaury Sechet [Mon, 25 Apr 2016 22:23:35 +0000 (22:23 +0000)]
Reformat LLVMConstPointerNull. NFC

llvm-svn: 267484

8 years agoComment formating. NFC
Amaury Sechet [Mon, 25 Apr 2016 22:23:30 +0000 (22:23 +0000)]
Comment formating. NFC

llvm-svn: 267483

8 years agoOptimize store of "bitcast" from vector to aggregate.
Arch D. Robison [Mon, 25 Apr 2016 22:22:39 +0000 (22:22 +0000)]
Optimize store of "bitcast" from vector to aggregate.

This patch is what was the "instcombine" portion of D14185, with an additional
test added (see julia_pseudovec in test/Transforms/InstCombine/insert-val-extract-elem.ll).
The patch causes instcombine to replace sequences of extractelement-insertvalue-store
that act essentially like a bitcast followed by a store.

Differential review: http://reviews.llvm.org/D14260

llvm-svn: 267482

8 years ago[LVI] Make a precondition explicit rather than handling a case which never happens...
Philip Reames [Mon, 25 Apr 2016 22:21:24 +0000 (22:21 +0000)]
[LVI] Make a precondition explicit rather than handling a case which never happens [NFC]

llvm-svn: 267481

8 years agoAdd optimization bisect opt-in calls for ARM passes
Andrew Kaylor [Mon, 25 Apr 2016 22:01:04 +0000 (22:01 +0000)]
Add optimization bisect opt-in calls for ARM passes

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

llvm-svn: 267480

8 years agoAdd optimization bisect opt-in calls for AArch64 passes
Andrew Kaylor [Mon, 25 Apr 2016 21:58:52 +0000 (21:58 +0000)]
Add optimization bisect opt-in calls for AArch64 passes

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

llvm-svn: 267479

8 years agoFix StackFrame::GetVariables(...) function that was broken by 261858 when lambda...
Greg Clayton [Mon, 25 Apr 2016 21:54:10 +0000 (21:54 +0000)]
Fix StackFrame::GetVariables(...) function that was broken by 261858 when lambda functions were added to Block::AppendBlockVariables(). The Stackframe::GetVariables(...) function should get all variables regardless if they are in scope.

This wasn't caught by the test suite so I added a test for it.

llvm-svn: 267478

8 years ago[sanitizers] read/write page fault detection on mac.
Mike Aizatsky [Mon, 25 Apr 2016 21:44:43 +0000 (21:44 +0000)]
[sanitizers] read/write page fault detection on mac.

Subscribers: kubabrecka

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

llvm-svn: 267477

8 years agoAdd accidentally deleted "break"
Krzysztof Parzyszek [Mon, 25 Apr 2016 21:28:52 +0000 (21:28 +0000)]
Add accidentally deleted "break"

llvm-svn: 267476

8 years ago[ORC] clang-format code that was touched in r267457. NFC.
Lang Hames [Mon, 25 Apr 2016 21:21:20 +0000 (21:21 +0000)]
[ORC] clang-format code that was touched in r267457. NFC.

Commit r267457 made a lot of type-substitutions threw off code formatting and
alignment. This patch should tidy those changes up.

llvm-svn: 267475

8 years agodriver: Add a `--rsp-quoting` flag to pick response file quoting.
Nico Weber [Mon, 25 Apr 2016 21:15:49 +0000 (21:15 +0000)]
driver: Add a `--rsp-quoting` flag to pick response file quoting.

Currently, clang-cl always uses Windows style for unquoting, and clang always
uses POSIX style for unquoting.

With this flag, it's possible to change these defaults.

In general, response file quoting should match the shell the response file is
used in.  On Windows, it's possible to run clang-cl in a bash shell, or clang in
cmd.exe, so a flag for overriding the default behavior is natural there.

On non-Windows, Windows quoting probably never makes sense (except maybe in
Wine), but having clang-cl behave differently based on the host OS seems
strange too.  So require that people who want to use posix-style response
files with clang-cl on non-Windows pass --rsp-quoting=posix.

http://reviews.llvm.org/D19425

llvm-svn: 267474

8 years agoARM: put extern __thread stubs in a special section.
Tim Northover [Mon, 25 Apr 2016 21:12:04 +0000 (21:12 +0000)]
ARM: put extern __thread stubs in a special section.

The linker needs to know that the symbols are thread-local to do its job
properly.

llvm-svn: 267473

8 years agoRemove architecture dependent Hwloc DEBUG section
Jonathan Peyton [Mon, 25 Apr 2016 21:11:26 +0000 (21:11 +0000)]
Remove architecture dependent Hwloc DEBUG section

This debug sections's functionality can be replicated using the environment
variable KMP_TOPOLOGY_METHOD with different values and KMP_AFFINITY=verbose

llvm-svn: 267472

8 years ago[ThinLTO] Introduce typedef for commonly-used map type (NFC)
Teresa Johnson [Mon, 25 Apr 2016 21:09:51 +0000 (21:09 +0000)]
[ThinLTO] Introduce typedef for commonly-used map type (NFC)

Add a typedef for the std::map<GlobalValue::GUID, GlobalValueSummary *>
map that is passed around to identify summaries for values defined in a
particular module. This shortens up declarations in a variety of places.

llvm-svn: 267471

8 years agoFix buffer problem with printing long Hwloc affinity mask
Jonathan Peyton [Mon, 25 Apr 2016 21:08:31 +0000 (21:08 +0000)]
Fix buffer problem with printing long Hwloc affinity mask

This change has the hwloc_bitmap_list_snprintf() function use the entire buffer
to print the mask.  There is no need to shorten the buffer length by 7.  It only
needs to be shortened by one byte.

llvm-svn: 267470

8 years ago[Hexagon] Few fixes for exception handling
Krzysztof Parzyszek [Mon, 25 Apr 2016 21:05:19 +0000 (21:05 +0000)]
[Hexagon] Few fixes for exception handling

llvm-svn: 267469

8 years agoMaintain register numbering across xml include features
Francis Ricci [Mon, 25 Apr 2016 21:03:55 +0000 (21:03 +0000)]
Maintain register numbering across xml include features

Summary:
If the remote uses include features when communicating
xml register info back to lldb, the existing code would reset the
lldb register index at the beginning of each include node.
This would lead to multiple registers having the same lldb register index.
Since the lldb register numbers should be contiguous and unique,
maintain them accross the parsing of all of the xml feature nodes.

Reviewers: jingham, jasonmolenda, clayborg

Subscribers: lldb-commits, sas

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

llvm-svn: 267468

8 years agoProperly unload modules from target image list when using svr4 packets
Francis Ricci [Mon, 25 Apr 2016 21:02:24 +0000 (21:02 +0000)]
Properly unload modules from target image list when using svr4 packets

Summary:
When we receive an svr4 packet from the remote, we check for new modules
and add them to the list of images in the target. However, we did not
do the same for modules which have been removed.

This was causing TestLoadUnload to fail when using ds2, which uses
svr4 packets to communicate all library info on Linux. This patch fixes
the failing test.

Reviewers: zturner, tfiala, ADodds

Subscribers: lldb-commits, sas

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

llvm-svn: 267467

8 years agoUse Process Plugin register indices when communicating with remote
Francis Ricci [Mon, 25 Apr 2016 20:59:11 +0000 (20:59 +0000)]
Use Process Plugin register indices when communicating with remote

Summary:
eRegisterKindProcessPlugin is used to store the register
indices used by the remote, and eRegisterKindLLDB is used
to store the internal lldb register indices. However, we're currently
using the lldb indices instead of the process plugin indices
when sending p/P packets. This will break if the remote uses
non-contiguous register indices.

Reviewers: jasonmolenda, clayborg

Subscribers: lldb-commits, sas

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

llvm-svn: 267466

8 years agoRe-apply r267206 with a fix for the encoding problem: when the immediate of
Quentin Colombet [Mon, 25 Apr 2016 20:54:08 +0000 (20:54 +0000)]
Re-apply r267206 with a fix for the encoding problem: when the immediate of
log2(Mask) is smaller than 32, we must use the 32-bit variant because the 64-bit
variant cannot encode it. Therefore, set the subreg part accordingly.

[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: 267465

8 years agoModule Debugging: Fix the condition for determining whether a template
Adrian Prantl [Mon, 25 Apr 2016 20:52:40 +0000 (20:52 +0000)]
Module Debugging: Fix the condition for determining whether a template
instantiation is in a module.

This patch fixes the condition for determining whether the debug info for a
template instantiation will exist in an imported clang module by:

- checking whether the ClassTemplateSpecializationDecl is complete and
- checking that the instantiation was in a module by looking at the first field.

I also added a negative check to make sure that a typedef to a forward-declared
template (with the definition outside of the module) is handled correctly.

http://reviews.llvm.org/D19443
rdar://problem/25553724

llvm-svn: 267464

8 years agoStore absolute path for lldb executable in dotest.py
Francis Ricci [Mon, 25 Apr 2016 20:36:22 +0000 (20:36 +0000)]
Store absolute path for lldb executable in dotest.py

Summary:
lldb-server tests are currently being skipped on the
check-lldb target. This is because we get the path of
lldb-server by modifying the path to the lldb executable.
However, by this point, we've changed directories, and a
relative path to the build/bin directory will no longer point
to the location of lldb-server.

Storing an absolute path solves this issue.

Reviewers: vharron, zturner, tfiala, labath

Subscribers: labath, lldb-commits, sas

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

llvm-svn: 267463

8 years agoCreate _lldb python symlink correctly when LLVM_LIBDIR_SUFFIX is used
Francis Ricci [Mon, 25 Apr 2016 20:34:34 +0000 (20:34 +0000)]
Create _lldb python symlink correctly when LLVM_LIBDIR_SUFFIX is used

Summary:
Do not assume that liblldb.so is located in $(lldb -P)/../../../lib
when creating the _lldb python symlink. Instead, use the path passed
to LLVM_LIBDIR_SUFFIX, defaulting to $(lldb -P)/../../../lib when this
variable is not set.

Reviewers: vharron, emaste, zturner

Subscribers: zturner, labath, lldb-commits, sas

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

llvm-svn: 267462

8 years ago[ELF][MIPS] Move MIPS GOT header generation to the GotSection
Simon Atanasyan [Mon, 25 Apr 2016 20:25:05 +0000 (20:25 +0000)]
[ELF][MIPS] Move MIPS GOT header generation to the GotSection

MIPS is the only target requires GOT header. We already have MIPS
specific code in the `GotSection` class, so move MIPS GOT header
generation there and delete redundant stuff like `GotHeaderEntriesNum`
field and `writeGotHeader` method.

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

llvm-svn: 267460

8 years agoAdd missing qRegisterInfo option to gdbremote testcase
Francis Ricci [Mon, 25 Apr 2016 20:24:30 +0000 (20:24 +0000)]
Add missing qRegisterInfo option to gdbremote testcase

Summary:
"gcc" is equivalent to "ehframe" in ProcessGDBRemote, but
only "ehframe" was a valid response in the test suite.

Reviewers: tfiala, jasonmolenda, clayborg

Subscribers: lldb-commits, sas

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

llvm-svn: 267459

8 years agoCleanup redundant expression in InstCombineAndOrXor.
Etienne Bergeron [Mon, 25 Apr 2016 20:15:33 +0000 (20:15 +0000)]
Cleanup redundant expression in InstCombineAndOrXor.

Summary:
The expression is redundant on both side of operator |.

detected by : http://reviews.llvm.org/D19451

Reviewers: rnk, majnemer

Subscribers: cfe-commits

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

llvm-svn: 267458

8 years ago[ORC] Thread Error/Expected through the RPC library.
Lang Hames [Mon, 25 Apr 2016 19:56:45 +0000 (19:56 +0000)]
[ORC] Thread Error/Expected through the RPC library.

This replaces use of std::error_code and ErrorOr in the ORC RPC support library
with Error and Expected. This required updating the OrcRemoteTarget API, Client,
and server code, as well as updating the Orc C API.

This patch also fixes several instances where Errors were dropped.

llvm-svn: 267457

8 years agoAMDGPU/SI: Optimize adjacent s_nop instructions
Matt Arsenault [Mon, 25 Apr 2016 19:53:22 +0000 (19:53 +0000)]
AMDGPU/SI: Optimize adjacent s_nop instructions

Use the operand for how long to wait. This is somewhat
distasteful, since it would be better to just emit s_nop
with the right argument in the first place. This would require
changing TII::insertNoop to emit N operands, which would be easy.
Slightly more problematic is the post-RA scheduler and hazard recognizer
represent nops as a single null node, and would require inventing
another way of representing N nops.

llvm-svn: 267456

8 years ago[libFuzzer] remove dead code
Kostya Serebryany [Mon, 25 Apr 2016 19:41:45 +0000 (19:41 +0000)]
[libFuzzer] remove dead code

llvm-svn: 267455

8 years agoImplement support for conditional between xvalues of reference-compatible
Richard Smith [Mon, 25 Apr 2016 19:30:37 +0000 (19:30 +0000)]
Implement support for conditional between xvalues of reference-compatible
types. Patch by Erik Pilkington!

llvm-svn: 267454

8 years agoRefactor traversal of bases in deduction of template parameters from base
Richard Smith [Mon, 25 Apr 2016 19:28:08 +0000 (19:28 +0000)]
Refactor traversal of bases in deduction of template parameters from base
classes of an argument to use CXXRecordDecl::forallBases. Fix forallBases to
only visit each base class once.

llvm-svn: 267453

8 years agoAMDGPU: Implement addrspacecast
Matt Arsenault [Mon, 25 Apr 2016 19:27:24 +0000 (19:27 +0000)]
AMDGPU: Implement addrspacecast

llvm-svn: 267452

8 years agoAMDGPU: Add queue ptr intrinsic
Matt Arsenault [Mon, 25 Apr 2016 19:27:18 +0000 (19:27 +0000)]
AMDGPU: Add queue ptr intrinsic

llvm-svn: 267451

8 years agoAdd useful helpers to AddrSpaceCastInst
Matt Arsenault [Mon, 25 Apr 2016 19:27:13 +0000 (19:27 +0000)]
Add useful helpers to AddrSpaceCastInst

llvm-svn: 267450

8 years agoAMDGPU: Add DAG to debug dump
Matt Arsenault [Mon, 25 Apr 2016 19:27:09 +0000 (19:27 +0000)]
AMDGPU: Add DAG to debug dump

Also reorder case to match enum order

llvm-svn: 267449

8 years ago[Support] Fix latent bugs in Expected and ExitOnError that were preventing them
Lang Hames [Mon, 25 Apr 2016 19:21:57 +0000 (19:21 +0000)]
[Support] Fix latent bugs in Expected and ExitOnError that were preventing them
from working with reference types.

llvm-svn: 267448

8 years ago[Docs] Clarify what the object-size sanitizer does.
George Burgess IV [Mon, 25 Apr 2016 19:21:45 +0000 (19:21 +0000)]
[Docs] Clarify what the object-size sanitizer does.

Currently, the UBSan docs make it sound like the object-size sanitizer
will only detect out-of-bounds reads/writes. It also catches some
operations that don't necessarily access memory (invalid downcasts,
calls of methods on invalid pointers, ...). This patch adds a note
about this behavior in the docs.

llvm-svn: 267447

8 years agoARM Limited license agreement from the copyright/patent holder
Jonathan Peyton [Mon, 25 Apr 2016 19:12:20 +0000 (19:12 +0000)]
ARM Limited license agreement from the copyright/patent holder

I have prepared some patches for LLVM OpenMP runtime, mostly addressing
ARMv8 support. Before I upstream them, I must address legal issues that
arose around my planned contribution. I was advised that before I send any
substantial commit, I need to make sure that LICENSE.txt file in the projects
repository contains a statement submitted by ARM, similar to the one provided
by Intel (see "a license agreement from the copyright/patent holders"). This is
the same situation as with top-level LLVM project: ARM has provided the same
statement in http://llvm.org/svn/llvm-project/llvm/trunk/lib/Target/ARM/LICENSE.TXT file.

Patch by Paul Osmialowski

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

llvm-svn: 267446

8 years agoExtract some constant factors from "SCEVAddExprs"
Johannes Doerfert [Mon, 25 Apr 2016 19:09:10 +0000 (19:09 +0000)]
Extract some constant factors from "SCEVAddExprs"

  Additive expressions can have constant factors too that we can extract
  and thereby simplify the internal representation. For now we do
  compute the gcd of all constant factors but only extract the same
  (possibly negated) factor if there is one.

llvm-svn: 267445

8 years agoWhen deducing template parameters from base classes of an argument type, don't
Richard Smith [Mon, 25 Apr 2016 19:09:05 +0000 (19:09 +0000)]
When deducing template parameters from base classes of an argument type, don't
preserve any deduced types from a failed deduction to a subsequent attempt at
deduction. Patch by Erik Pilkington!

llvm-svn: 267444

8 years agotest commit
Francis Ricci [Mon, 25 Apr 2016 19:02:05 +0000 (19:02 +0000)]
test commit

llvm-svn: 267443

8 years agoDo not check all GEPs for assumptions
Johannes Doerfert [Mon, 25 Apr 2016 18:55:15 +0000 (18:55 +0000)]
Do not check all GEPs for assumptions

  Before, we checked all GEPs in a statement in order to derive
  out-of-bound assumptions. However, this can not only introduce new
  parameters but it is also not clear what we can learn from GEPs that
  are not immediately used in a memory accesses inside the SCoP. As this
  case is very rare, no actual change in the behaviour is expected.

llvm-svn: 267442

8 years agoOnly add user assumptions on known parameters [NFC]
Johannes Doerfert [Mon, 25 Apr 2016 18:51:27 +0000 (18:51 +0000)]
Only add user assumptions on known parameters [NFC]

  Before, assumptions derived from llvm.assume could reference new
  parameters that were not known to the SCoP before. These were neither
  beneficial to the representation nor to the user that reads the
  emitted remark. Now we project them out and keep only user assumptions
  on known parameters. Nevertheless, the new parameters are still part
  of the SCoPs parameter space as the SCEVAffinator currently adds them
  on demand.

llvm-svn: 267441

8 years ago[LVI] Clarify comments describing the lattice values
Philip Reames [Mon, 25 Apr 2016 18:48:43 +0000 (18:48 +0000)]
[LVI] Clarify comments describing the lattice values

There has been much recent confusion about the partition in the lattice between constant and non-constant values.  Hopefully, documenting this will prevent confusion going forward.

llvm-svn: 267440

8 years ago[LVI] Split solveBlockValueConstantRange into two [NFC]
Philip Reames [Mon, 25 Apr 2016 18:30:31 +0000 (18:30 +0000)]
[LVI] Split solveBlockValueConstantRange into two [NFC]

This function handled both unary and binary operators.  Cloning and specializing leads to much easier to follow code with minimal duplicatation.

llvm-svn: 267438

8 years ago[gold] Fix linkInModule and extend common.ll test.
Evgeniy Stepanov [Mon, 25 Apr 2016 18:23:29 +0000 (18:23 +0000)]
[gold] Fix linkInModule and extend common.ll test.

Fix early exit from linkInModule. IRMover::move returns false on
success and true on error.

Add a few more cases of merged common linkage variables with
different sizes and alignments.

llvm-svn: 267437

8 years agoFix typo from r267432.
Chad Rosier [Mon, 25 Apr 2016 18:20:27 +0000 (18:20 +0000)]
Fix typo from r267432.

llvm-svn: 267436

8 years ago[Hexagon] Use llvm-mc instead of llc in an MC testcase
Krzysztof Parzyszek [Mon, 25 Apr 2016 18:09:36 +0000 (18:09 +0000)]
[Hexagon] Use llvm-mc instead of llc in an MC testcase

Remember to svn add the new file.

llvm-svn: 267435

8 years ago[Hexagon] Use llvm-mc instead of llc in an MC testcase
Krzysztof Parzyszek [Mon, 25 Apr 2016 18:08:33 +0000 (18:08 +0000)]
[Hexagon] Use llvm-mc instead of llc in an MC testcase

llvm-svn: 267434

8 years ago[Hexagon] Register save/restore functions do not follow regular conventions
Krzysztof Parzyszek [Mon, 25 Apr 2016 17:49:44 +0000 (17:49 +0000)]
[Hexagon] Register save/restore functions do not follow regular conventions

Do not mark them as modifying any of the volatile registers by default.

llvm-svn: 267433

8 years ago[ValueTracking] Add an additional test case for r266767 where one operand is a const.
Chad Rosier [Mon, 25 Apr 2016 17:41:48 +0000 (17:41 +0000)]
[ValueTracking] Add an additional test case for r266767 where one operand is a const.

llvm-svn: 267432

8 years agoResubmit "Refactor raw pdb dumper into library"
Zachary Turner [Mon, 25 Apr 2016 17:38:08 +0000 (17:38 +0000)]
Resubmit "Refactor raw pdb dumper into library"

This fixes a number of endianness issues as well as an ODR
violation that hopefully causes everything to be happy.

llvm-svn: 267431

8 years ago[ValueTracking] Improve isImpliedCondition when the dominating cond is false.
Chad Rosier [Mon, 25 Apr 2016 17:23:36 +0000 (17:23 +0000)]
[ValueTracking] Improve isImpliedCondition when the dominating cond is false.

llvm-svn: 267430

8 years ago[gold-plugin] Remove dead assignment. NFC.
Davide Italiano [Mon, 25 Apr 2016 17:18:45 +0000 (17:18 +0000)]
[gold-plugin] Remove dead assignment. NFC.

llvm-svn: 267429

8 years ago[ELFRelocs] Other architectures do not have *_NUM reloc.
Davide Italiano [Mon, 25 Apr 2016 17:13:39 +0000 (17:13 +0000)]
[ELFRelocs] Other architectures do not have *_NUM reloc.

It also seems to be unused. Get rid of it.
Thanks to Rafael for pointing out.

llvm-svn: 267428

8 years agodsymutil: Only warn about clang module DWO id mismatches in verbose mode.
Adrian Prantl [Mon, 25 Apr 2016 17:04:32 +0000 (17:04 +0000)]
dsymutil: Only warn about clang module DWO id mismatches in verbose mode.
Until PR27449 (https://llvm.org/bugs/show_bug.cgi?id=27449) is fixed in
clang this warning is pointless, since ASTFileSignatures will change
randomly when a module is rebuilt.

rdar://problem/25610919

llvm-svn: 267427

8 years agoadd tests for potential CGP transform (PR27344)
Sanjay Patel [Mon, 25 Apr 2016 16:56:52 +0000 (16:56 +0000)]
add tests for potential CGP transform (PR27344)

llvm-svn: 267426

8 years ago[Clang][Builtin][AVX512]Adding k-register logic intrinsics KAND, KANDN, KOR, KORTEST...
Michael Zuckerman [Mon, 25 Apr 2016 16:42:29 +0000 (16:42 +0000)]
[Clang][Builtin][AVX512]Adding k-register logic intrinsics KAND, KANDN, KOR, KORTEST, KXNOR, KXOR, KUNPACK instruction set.

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

llvm-svn: 267425

8 years ago[lanai] Expand findClosestSuitableAluInstr check to consider offset register.
Jacques Pienaar [Mon, 25 Apr 2016 16:41:21 +0000 (16:41 +0000)]
[lanai] Expand findClosestSuitableAluInstr check to consider offset register.

Previously findClosestSuitableAluInstr was only considering the base register when checking the current instruction for suitability. Expand check to consider the offset if the offset is a register.

llvm-svn: 267424

8 years agoRefactor Scop parameter handling
Johannes Doerfert [Mon, 25 Apr 2016 16:15:13 +0000 (16:15 +0000)]
Refactor Scop parameter handling

  The new handling is consistent with the remaining code, e.g., we do
  not create a new parameter id for each lookup call but copy an
  existing one. Additionally, we now use the implicit order defined by
  the Parameters set instead of an explicit one defined in a map.

llvm-svn: 267423

8 years agoFix ARM attribute parsing for Android after rL267291
Tamas Berghammer [Mon, 25 Apr 2016 15:51:45 +0000 (15:51 +0000)]
Fix ARM attribute parsing for Android after rL267291

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

llvm-svn: 267422

8 years agoskip TestBitfields.py on OS X
Todd Fiala [Mon, 25 Apr 2016 15:48:34 +0000 (15:48 +0000)]
skip TestBitfields.py on OS X

tracked by:
https://llvm.org/bugs/show_bug.cgi?id=27515

llvm-svn: 267421

8 years ago[PR27390] [CodeGen] Reject indexed loads in CombinerDAG.
Marcin Koscielnicki [Mon, 25 Apr 2016 15:43:44 +0000 (15:43 +0000)]
[PR27390] [CodeGen] Reject indexed loads in CombinerDAG.

visitAND, when folding and (load) forgets to check which output of
an indexed load is involved, happily folding the updated address
output on the following testcase:

target datalayout = "e-m:e-i64:64-n32:64"
target triple = "powerpc64le-unknown-linux-gnu"

%typ = type { i32, i32 }

define signext i32 @_Z8access_pP1Tc(%typ* %p, i8 zeroext %type) {
  %b = getelementptr inbounds %typ, %typ* %p, i64 0, i32 1
  %1 = load i32, i32* %b, align 4
  %2 = ptrtoint i32* %b to i64
  %3 = and i64 %2, -35184372088833
  %4 = inttoptr i64 %3 to i32*
  %_msld = load i32, i32* %4, align 4
  %zzz = add i32 %1,  %_msld
  ret i32 %zzz
}

Fix this by checking ResNo.

I've found a few more places that currently neglect to check for
indexed load, and tightened them up as well, but I don't have test
cases for them.  In fact, they might not be triggerable at all,
at least with current targets.  Still, better safe than sorry.

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

llvm-svn: 267420

8 years ago[mips][microMIPS] Revert commit r267137
Hrvoje Varga [Mon, 25 Apr 2016 15:40:08 +0000 (15:40 +0000)]
[mips][microMIPS] Revert commit r267137

Commit r267137 was the reason for failing tests in LLVM test suite.

llvm-svn: 267419

8 years ago[mips][microMIPS] Revert commit r266977
Zlatko Buljan [Mon, 25 Apr 2016 15:34:57 +0000 (15:34 +0000)]
[mips][microMIPS] Revert commit r266977
Commit r266977 was reason for failing LLVM test suite with error message: fatal error: error in backend: Cannot select: t17: i32 = rotr t2, t11 ...

llvm-svn: 267418

8 years ago[x86] auto-generate checks for cmov tests
Sanjay Patel [Mon, 25 Apr 2016 15:26:57 +0000 (15:26 +0000)]
[x86] auto-generate checks for cmov tests

llvm-svn: 267417

8 years agoAdded Fixer implementation and fix() interface in clang-format for removing redundant...
Eric Liu [Mon, 25 Apr 2016 15:09:22 +0000 (15:09 +0000)]
Added Fixer implementation and fix() interface in clang-format for removing redundant code.

Summary:
After applying replacements, redundant code like extra commas or empty namespaces
might be introduced. Fixer can detect and remove any redundant code introduced by replacements.
The current implementation only handles redundant commas.

Reviewers: djasper, klimek

Subscribers: ioeric, mprobst, klimek, cfe-commits

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

llvm-svn: 267416

8 years agoFix incorrect redundant expression in target AMDGPU.
Etienne Bergeron [Mon, 25 Apr 2016 15:06:33 +0000 (15:06 +0000)]
Fix incorrect redundant expression in target AMDGPU.

Summary:
The expression is detected as a redundant expression.
Turn out, this is probably a bug.

```
/home/etienneb/llvm/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:306:26: warning: both side of operator are equivalent [misc-redundant-expression]
  if (isSMRD(*FirstLdSt) && isSMRD(*FirstLdSt)) {
```

Reviewers: rnk, tstellarAMD

Subscribers: arsenm, cfe-commits

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

llvm-svn: 267415

8 years ago[Clang][Builtin][AVX512]Adding intrinsics for vfpclass{sd|ss} vfpclass{pd|ps} instruc...
Michael Zuckerman [Mon, 25 Apr 2016 14:48:23 +0000 (14:48 +0000)]
[Clang][Builtin][AVX512]Adding intrinsics for vfpclass{sd|ss} vfpclass{pd|ps} instruction set

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

llvm-svn: 267414

8 years ago[analyzer] Let TK_PreserveContents span across the whole base region.
Artem Dergachev [Mon, 25 Apr 2016 14:44:25 +0000 (14:44 +0000)]
[analyzer] Let TK_PreserveContents span across the whole base region.

If an address of a field is passed through a const pointer,
the whole structure's base region should receive the
TK_PreserveContents trait and avoid invalidation.

Additionally, include a few FIXME tests shown up during testing.

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

llvm-svn: 267413

8 years ago[WinEH] Update SplitAnalysis::computeLastSplitPoint to cope with multiple EH successors
David Majnemer [Mon, 25 Apr 2016 14:31:32 +0000 (14:31 +0000)]
[WinEH] Update SplitAnalysis::computeLastSplitPoint to cope with multiple EH successors

We didn't have logic to correctly handle CFGs where there was more than
one EH-pad successor (these are novel with WinEH).
There were situations where a register was live in one exceptional
successor but not another but the code as written would only consider
the first exceptional successor it found.

This resulted in split points which were insufficiently early if an
invoke was present.

This fixes PR27501.

N.B.  This removes getLandingPadSuccessor.

llvm-svn: 267412

8 years ago[ARM] Add support for the X asm constraint
Silviu Baranga [Mon, 25 Apr 2016 14:29:18 +0000 (14:29 +0000)]
[ARM] Add support for the X asm constraint

Summary:
This patch adds support for the X asm constraint.

To do this, we lower the constraint to either a "w" or "r" constraint
depending on the operand type (both constraints are supported on ARM).

Fixes PR26493

Reviewers: t.p.northover, echristo, rengolin

Subscribers: joker.eph, jgreenhalgh, aemerson, rengolin, llvm-commits

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

llvm-svn: 267411

8 years ago[AMDGPU][llvm-mc] s_getreg/setreg* - Add hwreg(...) syntax.
Artem Tamazov [Mon, 25 Apr 2016 14:13:51 +0000 (14:13 +0000)]
[AMDGPU][llvm-mc] s_getreg/setreg* - Add hwreg(...) syntax.

Added hwreg(reg[,offset,width]) syntax.
Default offset = 0, default width = 32.
Possibility to specify 16-bit immediate kept.
Added out-of-range checks.
Disassembling is always to hwreg(...) format.
Tests updated/added.

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

llvm-svn: 267410

8 years agoAdd support for R_X86_64_PC64.
Rafael Espindola [Mon, 25 Apr 2016 14:05:44 +0000 (14:05 +0000)]
Add support for R_X86_64_PC64.

llvm-svn: 267409

8 years agoModel zext-extend instructions
Johannes Doerfert [Mon, 25 Apr 2016 14:01:36 +0000 (14:01 +0000)]
Model zext-extend instructions

  A zero-extended value can be interpreted as a piecewise defined signed
  value. If the value was non-negative it stays the same, otherwise it
  is the sum of the original value and 2^n where n is the bit-width of
  the original (or operand) type. Examples:
    zext i8 127 to i32 -> { [127] }
    zext i8  -1 to i32 -> { [256 + (-1)] } = { [255] }
    zext i8  %v to i32 -> [v] -> { [v] | v >= 0; [256 + v] | v < 0 }

  However, LLVM/Scalar Evolution uses zero-extend (potentially lead by a
  truncate) to represent some forms of modulo computation. The left-hand side
  of the condition in the code below would result in the SCEV
  "zext i1 <false, +, true>for.body" which is just another description
  of the C expression "i & 1 != 0" or, equivalently, "i % 2 != 0".

    for (i = 0; i < N; i++)
      if (i & 1 != 0 /* == i % 2 */)
        /* do something */

  If we do not make the modulo explicit but only use the mechanism described
  above we will get the very restrictive assumption "N < 3", because for all
  values of N >= 3 the SCEVAddRecExpr operand of the zero-extend would wrap.
  Alternatively, we can make the modulo in the operand explicit in the
  resulting piecewise function and thereby avoid the assumption on N. For the
  example this would result in the following piecewise affine function:
  { [i0] -> [(1)] : 2*floor((-1 + i0)/2) = -1 + i0;
    [i0] -> [(0)] : 2*floor((i0)/2) = i0 }
  To this end we can first determine if the (immediate) operand of the
  zero-extend can wrap and, in case it might, we will use explicit modulo
  semantic to compute the result instead of emitting non-wrapping assumptions.

  Note that operands with large bit-widths are less likely to be negative
  because it would result in a very large access offset or loop bound after the
  zero-extend. To this end one can optimistically assume the operand to be
  positive and avoid the piecewise definition if the bit-width is bigger than
  some threshold (here MaxZextSmallBitWidth).

  We choose to go with a hybrid solution of all modeling techniques described
  above. For small bit-widths (up to MaxZextSmallBitWidth) we will model the
  wrapping explicitly and use a piecewise defined function. However, if the
  bit-width is bigger than MaxZextSmallBitWidth we will employ overflow
  assumptions and assume the "former negative" piece will not exist.

llvm-svn: 267408

8 years agoSkip TestBitfileds on linux
Pavel Labath [Mon, 25 Apr 2016 14:00:23 +0000 (14:00 +0000)]
Skip TestBitfileds on linux

Test added in r267248 exposed a bug in handling of dwarf produced by clang>=3.9, which causes a
crash during expression evaluation. Skip the test until this is sorted out.

llvm-svn: 267407

8 years agoTest commit: modified comment. NFC
Anna Thomas [Mon, 25 Apr 2016 13:58:05 +0000 (13:58 +0000)]
Test commit: modified comment. NFC

llvm-svn: 267406

8 years agoHandle invalid values of PLT entry size generated by linker
Omair Javaid [Mon, 25 Apr 2016 13:45:39 +0000 (13:45 +0000)]
Handle invalid values of PLT entry size generated by linker

Make sure we figure out correct plt entry field in case linker has generated a small value below realistic entry size like 4 bytes or below.

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

llvm-svn: 267405

8 years agoCheck only loop control of loops that are part of the region
Johannes Doerfert [Mon, 25 Apr 2016 13:37:24 +0000 (13:37 +0000)]
Check only loop control of loops that are part of the region

  This also removes a duplicated line of code in the region generator
  that caused a SPEC benchmark to fail with the new SCoPs.

llvm-svn: 267404

8 years agoInitialize the invalid domain of an access with an empty set
Johannes Doerfert [Mon, 25 Apr 2016 13:36:23 +0000 (13:36 +0000)]
Initialize the invalid domain of an access with an empty set

llvm-svn: 267403

8 years agoDo not propagate invalid domains over back edges
Johannes Doerfert [Mon, 25 Apr 2016 13:34:50 +0000 (13:34 +0000)]
Do not propagate invalid domains over back edges

llvm-svn: 267402

8 years agoIntroduce a parameter set type [NFC]
Johannes Doerfert [Mon, 25 Apr 2016 13:33:07 +0000 (13:33 +0000)]
Introduce a parameter set type [NFC]

llvm-svn: 267401

8 years agoRemove unnecessary argument of the SCEVValidator [NFC]
Johannes Doerfert [Mon, 25 Apr 2016 13:32:36 +0000 (13:32 +0000)]
Remove unnecessary argument of the SCEVValidator [NFC]

llvm-svn: 267400

8 years agoTypo. NFC.
Chad Rosier [Mon, 25 Apr 2016 13:25:14 +0000 (13:25 +0000)]
Typo. NFC.

llvm-svn: 267399

8 years ago[Clang][AVX512][BUILTIN] Adding intrinsics for VSCATTERPF{1|0}{DPS|QPS|DPD|QPD} instr...
Michael Zuckerman [Mon, 25 Apr 2016 13:01:40 +0000 (13:01 +0000)]
[Clang][AVX512][BUILTIN] Adding intrinsics for VSCATTERPF{1|0}{DPS|QPS|DPD|QPD} instruction set

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

llvm-svn: 267398

8 years ago[Hexagon] Correctly set "Flags" in ELF header
Krzysztof Parzyszek [Mon, 25 Apr 2016 12:49:47 +0000 (12:49 +0000)]
[Hexagon] Correctly set "Flags" in ELF header

llvm-svn: 267397

8 years agoSimplify. NFC.
Rafael Espindola [Mon, 25 Apr 2016 12:32:19 +0000 (12:32 +0000)]
Simplify. NFC.

llvm-svn: 267396

8 years ago[OPENMP 4.5] Codegen for 'taskloop' directive.
Alexey Bataev [Mon, 25 Apr 2016 12:22:29 +0000 (12:22 +0000)]
[OPENMP 4.5] Codegen for 'taskloop' directive.

The taskloop construct specifies that the iterations of one or more associated loops will be executed in parallel using OpenMP tasks. The iterations are distributed across tasks created by the construct and scheduled to be executed.
The next code will be generated for the taskloop directive:
    #pragma omp taskloop num_tasks(N) lastprivate(j)
        for( i=0; i<N*GRAIN*STRIDE-1; i+=STRIDE ) {
          int th = omp_get_thread_num();
          #pragma omp atomic
            counter++;
          #pragma omp atomic
            th_counter[th]++;
          j = i;
    }

Generated code:
task = __kmpc_omp_task_alloc(NULL,gtid,1,sizeof(struct
task),sizeof(struct shar),&task_entry);
psh = task->shareds;
psh->pth_counter = &th_counter;
psh->pcounter = &counter;
psh->pj = &j;
task->lb = 0;
task->ub = N*GRAIN*STRIDE-2;
task->st = STRIDE;
__kmpc_taskloop(
NULL,             // location
gtid,             // gtid
task,             // task structure
1,                // if clause value
&task->lb,        // lower bound
&task->ub,        // upper bound
STRIDE,           // loop increment
0,                // 1 if nogroup specified
2,                // schedule type: 0-none, 1-grainsize, 2-num_tasks
N,                // schedule value (ignored for type 0)
(void*)&__task_dup_entry // tasks duplication routine
);

llvm-svn: 267395

8 years agoDelete needsCopyRelImpl. It is redundant with getRelExpr.
Rafael Espindola [Mon, 25 Apr 2016 12:05:56 +0000 (12:05 +0000)]
Delete needsCopyRelImpl. It is redundant with getRelExpr.

llvm-svn: 267394

8 years ago[GlobalOpt] Allow constant globals to be SRA'd
James Molloy [Mon, 25 Apr 2016 10:48:29 +0000 (10:48 +0000)]
[GlobalOpt] Allow constant globals to be SRA'd

The current logic assumes that any constant global will never be SRA'd. I presume this is because normally constant globals can be pushed into their uses and deleted. However, that sometimes can't happen (which is where you really want SRA, so the elements that can be eliminated, are!).

There seems to be no reason why we can't SRA constants too, so let's do it.

llvm-svn: 267393

8 years agoRemove flaky decorator from two tests on linux
Pavel Labath [Mon, 25 Apr 2016 10:32:23 +0000 (10:32 +0000)]
Remove flaky decorator from two tests on linux

The flakyness is no longer reproducible, and the tests seem to be passing reliably now.

llvm-svn: 267392

8 years ago[ELF] Delete extra line. NFC
Simon Atanasyan [Mon, 25 Apr 2016 10:18:48 +0000 (10:18 +0000)]
[ELF] Delete extra line. NFC

llvm-svn: 267391