platform/upstream/llvm.git
9 years agoRevert 239795
Philip Reames [Tue, 16 Jun 2015 01:20:53 +0000 (01:20 +0000)]
Revert 239795

I forgot to update some clang test cases.  I'll fix and resubmit tomorrow.

llvm-svn: 239800

9 years ago[AArch64] Generalize extract-high DUP extension to MOVI/MVNI.
Ahmed Bougacha [Tue, 16 Jun 2015 01:18:14 +0000 (01:18 +0000)]
[AArch64] Generalize extract-high DUP extension to MOVI/MVNI.

These are really immediate DUPs, and suffer from the same problem
with long instructions with a high/2 variant (e.g. smull).

By extending a MOVI (or DUP, before this patch), we can avoid an ext
on the other operand of the long instruction, e.g. turning:
    ext.16b v0, v0, v0, #8
    movi.4h v1, #0x53
    smull.4s  v0, v0, v1
into:
    movi.8h v1, #0x53
    smull2.4s  v0, v0, v1

While there, add a now-necessary combine to fold (VT NVCAST (VT x)).

llvm-svn: 239799

9 years ago[AArch64] Robustize neon-2velem-high test. NFC.
Ahmed Bougacha [Tue, 16 Jun 2015 01:05:39 +0000 (01:05 +0000)]
[AArch64] Robustize neon-2velem-high test. NFC.

llvm-svn: 239798

9 years agoMove logic from JumpThreading into LazyValue info to simplify caller.
Philip Reames [Tue, 16 Jun 2015 00:49:59 +0000 (00:49 +0000)]
Move logic from JumpThreading into LazyValue info to simplify caller.

This change is hopefully NFC. The only tricky part is that I changed the context instruction being used to the branch rather than the comparison. I believe both to be correct, but the branch is strictly more powerful. With the moved code, using the branch instruction is required for the basic block comparison test to return the same result. The previous code was able to directly access both the branch and the comparison where the revised code is not.

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

llvm-svn: 239797

9 years agomodules: Add explicit dependency on intrinsics_gen
Duncan P. N. Exon Smith [Tue, 16 Jun 2015 00:44:12 +0000 (00:44 +0000)]
modules: Add explicit dependency on intrinsics_gen

`LLVM_ENABLE_MODULES` builds sometimes fail because `Intrinsics.td`
needs to regenerate `Instrinsics.h` before anyone can include anything
from the LLVM_IR module.  Represent the dependency explicitly to prevent
that.

llvm-svn: 239796

9 years ago[InstCombine] Propagate non-null facts to call parameters
Philip Reames [Tue, 16 Jun 2015 00:43:54 +0000 (00:43 +0000)]
[InstCombine] Propagate non-null facts to call parameters

If a parameter to a function is known non-null, use the existing parameter attributes to record that fact at the call site. This has no optimization benefit by itself - that I know of - but is an enabling change for http://reviews.llvm.org/D9129.

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

llvm-svn: 239795

9 years agomodules: Mark CodeGen/DIEValues.def as a textual inclusion
Duncan P. N. Exon Smith [Tue, 16 Jun 2015 00:43:52 +0000 (00:43 +0000)]
modules: Mark CodeGen/DIEValues.def as a textual inclusion

Mark CodeGen/DIEValues.def as a textual inclusion to fix the
`LLVM_ENABLE_MODULES` build.

llvm-svn: 239794

9 years agomodules: Move ProfileKinds to an anonymous namespace
Duncan P. N. Exon Smith [Tue, 16 Jun 2015 00:43:04 +0000 (00:43 +0000)]
modules: Move ProfileKinds to an anonymous namespace

Fix a build failure with `LLVM_ENABLE_MODULES` due to
`ProfileData::instr` conflicting with a function `instr()` in
`<curses.h>`.

llvm-svn: 239793

9 years ago[modules] Rename -fmodule-maps to -fimplicit-module-maps (and likewise for
Richard Smith [Tue, 16 Jun 2015 00:20:23 +0000 (00:20 +0000)]
[modules] Rename -fmodule-maps to -fimplicit-module-maps (and likewise for
-fno-module-maps). The old names are preserved for compatibility.

llvm-svn: 239792

9 years agoCommit some test changes somehow missed in r239789.
Richard Smith [Tue, 16 Jun 2015 00:19:29 +0000 (00:19 +0000)]
Commit some test changes somehow missed in r239789.

llvm-svn: 239791

9 years agoMIR Serialization: Print and parse simple machine function attributes.
Alex Lorenz [Tue, 16 Jun 2015 00:10:47 +0000 (00:10 +0000)]
MIR Serialization: Print and parse simple machine function attributes.

This commit serializes the simple, scalar attributes from the
'MachineFunction' class.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 239790

9 years ago[modules] Simplify -cc1 interface for enabling implicit module maps.
Richard Smith [Tue, 16 Jun 2015 00:08:24 +0000 (00:08 +0000)]
[modules] Simplify -cc1 interface for enabling implicit module maps.

We used to have a flag to enable module maps, and two more flags to enable
implicit module maps. This is all redundant; we don't need any flag for
enabling module maps in the abstract, and we don't usually have -fno- flags for
-cc1. We now have just a single flag, -fimplicit-module-maps, that enables
implicitly searching the file system for module map files and loading them.

The driver interface is unchanged for now. We should probably rename
-fmodule-maps to -fimplicit-module-maps at some point.

llvm-svn: 239789

9 years agoMIR Serialization: move the MIR printer out of the MIR printing pass.
Alex Lorenz [Mon, 15 Jun 2015 23:52:35 +0000 (23:52 +0000)]
MIR Serialization: move the MIR printer out of the MIR printing pass.

This commit decouples the MIR printer and the MIR printing pass so
that it will be possible to move the MIR printer into a separate
machine IR library later on.

Reviewers: Duncan P. N. Exon Smith
llvm-svn: 239788

9 years ago[modules] Remove non-functional driver options -f[no-]modules-implicit-maps.
Richard Smith [Mon, 15 Jun 2015 23:52:34 +0000 (23:52 +0000)]
[modules] Remove non-functional driver options -f[no-]modules-implicit-maps.

These driver options never did anything (they weren't forwarded to the
frontend). Also update the documentation to not mention them.

llvm-svn: 239787

9 years ago[X86] Try to shorten dwarf CFI emission
Reid Kleckner [Mon, 15 Jun 2015 23:45:08 +0000 (23:45 +0000)]
[X86] Try to shorten dwarf CFI emission

llvm-svn: 239786

9 years ago[ASan tests] Revert a bad change from r239754
Filipe Cabecinhas [Mon, 15 Jun 2015 23:44:53 +0000 (23:44 +0000)]
[ASan tests] Revert a bad change from r239754

Hopefully the last partial revert. Sorry about the noise.

llvm-svn: 239785

9 years agoAccording to the OpenMP spec, all the preprocessor macros should be
Samuel Antao [Mon, 15 Jun 2015 23:44:27 +0000 (23:44 +0000)]
According to the OpenMP spec, all the preprocessor macros should be
expanded in OpenMP pragmas. This patch adds support for that in -E.

llvm-svn: 239784

9 years ago[modules] Re-enable accidentally-disabled test.
Richard Smith [Mon, 15 Jun 2015 23:39:16 +0000 (23:39 +0000)]
[modules] Re-enable accidentally-disabled test.

llvm-svn: 239783

9 years agoUse a macro for the omnipresent attributes on header functions in Intrin.h.
Eric Christopher [Mon, 15 Jun 2015 23:20:35 +0000 (23:20 +0000)]
Use a macro for the omnipresent attributes on header functions in Intrin.h.

Saves some typing and if someone wants to change them it makes it much easier.

llvm-svn: 239782

9 years agoDebug Info: Turn on ODR type uniquing for (the C++ part of) Objective-C++.
Adrian Prantl [Mon, 15 Jun 2015 23:18:16 +0000 (23:18 +0000)]
Debug Info: Turn on ODR type uniquing for (the C++ part of) Objective-C++.

rdar://problem/20571359

llvm-svn: 239781

9 years agoDebug Info IR: Switch DIObjCProperty to use DITypeRef.
Adrian Prantl [Mon, 15 Jun 2015 23:18:03 +0000 (23:18 +0000)]
Debug Info IR: Switch DIObjCProperty to use DITypeRef.
This is a prerequisite for turning on ODR type uniquing for ObjC++.

rdar://problem/21377883

llvm-svn: 239780

9 years agoIf a candidate keyword contains quotes, it's clearly not a keyword, so bail out early
Enrico Granata [Mon, 15 Jun 2015 23:12:29 +0000 (23:12 +0000)]
If a candidate keyword contains quotes, it's clearly not a keyword, so bail out early

There are other characters we could optimize for (any non-letter pretty much), but keyword.iskeyword() will handle them, whereas quotes do have the potential to confuse us, so they actually need custom handling

Fixes rdar://problem/21022787

llvm-svn: 239779

9 years agoMIR Serialization: Create dummy functions when the MIR file doesn't have LLVM IR.
Alex Lorenz [Mon, 15 Jun 2015 23:07:38 +0000 (23:07 +0000)]
MIR Serialization: Create dummy functions when the MIR file doesn't have LLVM IR.

This commit creates a dummy LLVM IR function with one basic block and an unreachable
instruction for each parsed machine function when the MIR file doesn't have LLVM IR.
This change is required as the machine function analysis pass creates machine
functions only for the functions that are defined in the current LLVM module.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 239778

9 years agoAdd a formatter for wchar_t[N] arrays
Enrico Granata [Mon, 15 Jun 2015 23:01:47 +0000 (23:01 +0000)]
Add a formatter for wchar_t[N] arrays

rdar://21299888

llvm-svn: 239777

9 years agoMIR Serialization: Report an error when machine functions have the same name.
Alex Lorenz [Mon, 15 Jun 2015 22:23:23 +0000 (22:23 +0000)]
MIR Serialization: Report an error when machine functions have the same name.

This commit reports an error when the MIR parser encounters a machine
function with the name that is the same as the name of a different
machine function.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 239774

9 years ago[ASan tests] Leftover that didn't get reverted in r239754
Filipe Cabecinhas [Mon, 15 Jun 2015 22:19:47 +0000 (22:19 +0000)]
[ASan tests] Leftover that didn't get reverted in r239754

llvm-svn: 239773

9 years agoAdd safestack attribute to LLVMAttribute enum and Go bindings. Correct
Peter Collingbourne [Mon, 15 Jun 2015 22:16:51 +0000 (22:16 +0000)]
Add safestack attribute to LLVMAttribute enum and Go bindings. Correct
constants in commented-out part of LLVMAttribute enum. Add tests that verify
that the safestack attribute is only allowed as a function attribute.

llvm-svn: 239772

9 years ago[ASan tests] Use export, not env.
Filipe Cabecinhas [Mon, 15 Jun 2015 22:14:21 +0000 (22:14 +0000)]
[ASan tests] Use export, not env.

llvm-svn: 239771

9 years ago[Hexagon] Using readobj rather than objdump.
Colin LeMahieu [Mon, 15 Jun 2015 21:57:41 +0000 (21:57 +0000)]
[Hexagon] Using readobj rather than objdump.

llvm-svn: 239770

9 years ago[Hexagon] PC-relative offsets are relative to packet start rather than the offset...
Colin LeMahieu [Mon, 15 Jun 2015 21:52:13 +0000 (21:52 +0000)]
[Hexagon] PC-relative offsets are relative to packet start rather than the offset of the relocation.  Set relocation addend and check it's correct in the ELF.

llvm-svn: 239769

9 years agoRevert "[ASan tests] Try to fix Windows buildbots due to r239754"
Filipe Cabecinhas [Mon, 15 Jun 2015 21:49:35 +0000 (21:49 +0000)]
Revert "[ASan tests] Try to fix Windows buildbots due to r239754"

This reverts commit r239764 and the TestCases/Windows part of r239754.

llvm-svn: 239768

9 years ago[X86][SSE] Added tests for vector i8/i16 to f32/f64 conversions
Simon Pilgrim [Mon, 15 Jun 2015 21:49:31 +0000 (21:49 +0000)]
[X86][SSE] Added tests for vector i8/i16 to f32/f64 conversions

llvm-svn: 239767

9 years agoFix a bug where passing a value of the type "A B" to settings set target.env-vars...
Enrico Granata [Mon, 15 Jun 2015 21:37:05 +0000 (21:37 +0000)]
Fix a bug where passing a value of the type "A B" to settings set target.env-vars would cause LLDB to crash

Fixes rdar://problem/21241817

llvm-svn: 239766

9 years agoFix submodule test to pass on content addressable filesystems where inodes would...
Reid Kleckner [Mon, 15 Jun 2015 21:21:17 +0000 (21:21 +0000)]
Fix submodule test to pass on content addressable filesystems where inodes would collide

llvm-svn: 239765

9 years ago[ASan tests] Try to fix Windows buildbots due to r239754
Filipe Cabecinhas [Mon, 15 Jun 2015 21:15:26 +0000 (21:15 +0000)]
[ASan tests] Try to fix Windows buildbots due to r239754

llvm-svn: 239764

9 years agoProtection against stack-based memory corruption errors using SafeStack: compiler...
Peter Collingbourne [Mon, 15 Jun 2015 21:08:47 +0000 (21:08 +0000)]
Protection against stack-based memory corruption errors using SafeStack: compiler-rt runtime support library

This patch adds runtime support for the Safe Stack protection to compiler-rt
(see http://reviews.llvm.org/D6094 for the detailed description of the
Safe Stack).

This patch is our implementation of the safe stack on top of compiler-rt. The
patch adds basic runtime support for the safe stack to compiler-rt that
manages unsafe stack allocation/deallocation for each thread.

Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.

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

llvm-svn: 239763

9 years agoProtection against stack-based memory corruption errors using SafeStack: Clang comman...
Peter Collingbourne [Mon, 15 Jun 2015 21:08:13 +0000 (21:08 +0000)]
Protection against stack-based memory corruption errors using SafeStack: Clang command line option and function attribute

This patch adds the -fsanitize=safe-stack command line argument for clang,
which enables the Safe Stack protection (see http://reviews.llvm.org/D6094
for the detailed description of the Safe Stack).

This patch is our implementation of the safe stack on top of Clang. The
patches make the following changes:

- Add -fsanitize=safe-stack and -fno-sanitize=safe-stack options to clang
  to control safe stack usage (the safe stack is disabled by default).

- Add __attribute__((no_sanitize("safe-stack"))) attribute to clang that can be
  used to disable the safe stack for individual functions even when enabled
  globally.

Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.

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

llvm-svn: 239762

9 years agoProtection against stack-based memory corruption errors using SafeStack
Peter Collingbourne [Mon, 15 Jun 2015 21:07:11 +0000 (21:07 +0000)]
Protection against stack-based memory corruption errors using SafeStack

This patch adds the safe stack instrumentation pass to LLVM, which separates
the program stack into a safe stack, which stores return addresses, register
spills, and local variables that are statically verified to be accessed
in a safe way, and the unsafe stack, which stores everything else. Such
separation makes it much harder for an attacker to corrupt objects on the
safe stack, including function pointers stored in spilled registers and
return addresses. You can find more information about the safe stack, as
well as other parts of or control-flow hijack protection technique in our
OSDI paper on code-pointer integrity (http://dslab.epfl.ch/pubs/cpi.pdf)
and our project website (http://levee.epfl.ch).

The overhead of our implementation of the safe stack is very close to zero
(0.01% on the Phoronix benchmarks). This is lower than the overhead of
stack cookies, which are supported by LLVM and are commonly used today,
yet the security guarantees of the safe stack are strictly stronger than
stack cookies. In some cases, the safe stack improves performance due to
better cache locality.

Our current implementation of the safe stack is stable and robust, we
used it to recompile multiple projects on Linux including Chromium, and
we also recompiled the entire FreeBSD user-space system and more than 100
packages. We ran unit tests on the FreeBSD system and many of the packages
and observed no errors caused by the safe stack. The safe stack is also fully
binary compatible with non-instrumented code and can be applied to parts of
a program selectively.

This patch is our implementation of the safe stack on top of LLVM. The
patches make the following changes:

- Add the safestack function attribute, similar to the ssp, sspstrong and
  sspreq attributes.

- Add the SafeStack instrumentation pass that applies the safe stack to all
  functions that have the safestack attribute. This pass moves all unsafe local
  variables to the unsafe stack with a separate stack pointer, whereas all
  safe variables remain on the regular stack that is managed by LLVM as usual.

- Invoke the pass as the last stage before code generation (at the same time
  the existing cookie-based stack protector pass is invoked).

- Add unit tests for the safe stack.

Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.

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

llvm-svn: 239761

9 years agoDon't indent inside a namespace. NFC.
Rafael Espindola [Mon, 15 Jun 2015 21:04:27 +0000 (21:04 +0000)]
Don't indent inside a namespace. NFC.

llvm-svn: 239760

9 years agoReplace @ with the more common \. NFC.
Rafael Espindola [Mon, 15 Jun 2015 21:02:49 +0000 (21:02 +0000)]
Replace @ with the more common \. NFC.

llvm-svn: 239759

9 years agoparser: improve diagnostics for MS attributes
Saleem Abdulrasool [Mon, 15 Jun 2015 20:57:04 +0000 (20:57 +0000)]
parser: improve diagnostics for MS attributes

Switch to using BalancedDelimiterTracker to get better diagnostics for
unbalanced delimiters.  This still does not handle any of the attributes, simply
improves the parsing.

llvm-svn: 239758

9 years agoWildcard out some SSA value names from the ACLE intrinsic test case
Reid Kleckner [Mon, 15 Jun 2015 20:55:43 +0000 (20:55 +0000)]
Wildcard out some SSA value names from the ACLE intrinsic test case

llvm-svn: 239757

9 years agoDon't repeat names in comments and start functions with a lower case letter.
Rafael Espindola [Mon, 15 Jun 2015 20:55:37 +0000 (20:55 +0000)]
Don't repeat names in comments and start functions with a lower case letter.

llvm-svn: 239756

9 years ago[Sparc] Make soft-float emit an error.
James Y Knight [Mon, 15 Jun 2015 20:51:24 +0000 (20:51 +0000)]
[Sparc] Make soft-float emit an error.

LLVM does not and has not ever supported a soft-float ABI mode on
Sparc, so don't pretend that it does.

Also switch the default from "soft-float" -- which was actually
hard-float because soft-float is unimplemented -- to hard-float.

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

llvm-svn: 239755

9 years ago[ASan] Test churn for setting ASAN_OPTIONS=symbolize_vs_style=false
Filipe Cabecinhas [Mon, 15 Jun 2015 20:43:42 +0000 (20:43 +0000)]
[ASan] Test churn for setting ASAN_OPTIONS=symbolize_vs_style=false

Summary:
This commit adds symbolize_vs_style=false to every instance of
ASAN_OPTIONS in the asan tests and sets
ASAN_OPTIONS=symbolize_vs_style=false in lit, for tests which don't set
it.

This way we don't need to make the tests be able to deal with both
symbolize styles.

This is the first patch in the series. I will eventually submit for the
other sanitizers too.

We need this change (or another way to deal with the different outputs) in
order to be able to default to symbolize_vs_style=true on some platforms.

Adding to this change, I'm also adding "env " before any command line
which sets environment variables. That way the test works on other host
shells, like we have if the host is running Windows.

Reviewers: samsonov, kcc, rnk

Subscribers: tberghammer, llvm-commits

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

llvm-svn: 239754

9 years agoMIR Serialization: Connect the machine function analysis pass to the MIR parser.
Alex Lorenz [Mon, 15 Jun 2015 20:30:22 +0000 (20:30 +0000)]
MIR Serialization: Connect the machine function analysis pass to the MIR parser.

This commit connects the machine function analysis pass (which creates machine
functions) to the MIR parser, which will initialize the machine functions
with the state from the MIR file and reconstruct the machine IR.

This commit introduces a new interface called 'MachineFunctionInitializer',
which can be used to provide custom initialization for the machine functions.

This commit also introduces a new diagnostic class called
'DiagnosticInfoMIRParser' which is used for MIR parsing errors.
This commit modifies the default diagnostic handling in LLVMContext - now the
the diagnostics are printed directly into llvm::errs() so that the MIR parsing
errors can be printed with colours.

Reviewers: Justin Bogner

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

llvm-svn: 239753

9 years agoFound an issue that was causing types to be completed much more often than they neede...
Greg Clayton [Mon, 15 Jun 2015 20:17:18 +0000 (20:17 +0000)]
Found an issue that was causing types to be completed much more often than they needed to be.

The problem is for lldb_private::Type instances that have encoding types (pointer/reference/const/volatile/restrict/typedef to type with user ID 0x123). If they started out with m_flags.clang_type_resolve_state being set to eResolveStateUnresolved (0), then when we would call Type::ResolveClangType(eResolveStateForward) we would complete the full type due to logic errors in the code.

We now only complete the type if clang_type_resolve_state is eResolveStateLayout or eResolveStateFull and we correctly upgrade the type's current completion state to eResolveStateForward after we make a forward delcaration to the pointer/reference/const/volatile/restrict/typedef type instead of leaving it set to eResolveStateUnresolved.

llvm-svn: 239752

9 years agoRemove duplicate conditional in if-stmt.
Eric Christopher [Mon, 15 Jun 2015 20:16:53 +0000 (20:16 +0000)]
Remove duplicate conditional in if-stmt.

Fixes PR23839.

llvm-svn: 239751

9 years ago[modules] Better support for redefinitions of an entity from the same module.
Richard Smith [Mon, 15 Jun 2015 20:15:48 +0000 (20:15 +0000)]
[modules] Better support for redefinitions of an entity from the same module.

Support this across module save/reload and extend the 'missing import'
diagnostics with a list of providing modules.

llvm-svn: 239750

9 years agoCleanup the constructor of BitcodeReader. NFC.
Rafael Espindola [Mon, 15 Jun 2015 20:08:17 +0000 (20:08 +0000)]
Cleanup the constructor of BitcodeReader. NFC.

Use the same argument names as the members.
Use default member initializes.

Extracted from a patch by Karl Schimpf.

llvm-svn: 239749

9 years agoAdd "REQUIRES: asserts" to test case that uses -debug-only
Sanjoy Das [Mon, 15 Jun 2015 20:05:38 +0000 (20:05 +0000)]
Add "REQUIRES: asserts" to test case that uses -debug-only

llvm-svn: 239748

9 years agoUnbreak docs build from r239740.
Sanjoy Das [Mon, 15 Jun 2015 19:38:15 +0000 (19:38 +0000)]
Unbreak docs build from r239740.

Add FaultMaps.rst to toctree.

llvm-svn: 239747

9 years agoUnbreak the build from r239740.
Sanjoy Das [Mon, 15 Jun 2015 19:29:44 +0000 (19:29 +0000)]
Unbreak the build from r239740.

Do not re-use an enum name as a field name.  Some bots don't like this.

llvm-svn: 239746

9 years agoCOFF: Simplify SymbolBody::compare(SymbolBody *Other).
Rui Ueyama [Mon, 15 Jun 2015 19:06:53 +0000 (19:06 +0000)]
COFF: Simplify SymbolBody::compare(SymbolBody *Other).

We are currently handling all combinations of SymbolBody types directly.
This patch is to flip this and Other if Other->kind() < this->kind()
to reduce number of combinations. No functionality change intended.

llvm-svn: 239745

9 years ago[Hexagon] Moving pass declarations out of header and in to implementation files....
Colin LeMahieu [Mon, 15 Jun 2015 19:05:35 +0000 (19:05 +0000)]
[Hexagon] Moving pass declarations out of header and in to implementation files.  Removing unused function getSubtargetInfo from HexagonMCCodeEmitter.cpp  Removing deletion of copy construction and assignment operator since parent already deletes it.

llvm-svn: 239744

9 years ago[CodeGen] Add a pass to fold null checks into nearby memory operations.
Sanjoy Das [Mon, 15 Jun 2015 18:44:27 +0000 (18:44 +0000)]
[CodeGen] Add a pass to fold null checks into nearby memory operations.

Summary:
This change adds an "ImplicitNullChecks" target dependent pass.  This
pass folds null checks into memory operation using the FAULTING_LOAD
pseudo-op introduced in previous patches.

Depends on D10197
Depends on D10199
Depends on D10200

Reviewers: reames, rnk, pgavlin, JosephTremoulet, atrick

Reviewed By: atrick

Subscribers: ab, JosephTremoulet, llvm-commits

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

llvm-svn: 239743

9 years ago[TargetInstrInfo] Add new hook: AnalyzeBranchPredicate.
Sanjoy Das [Mon, 15 Jun 2015 18:44:21 +0000 (18:44 +0000)]
[TargetInstrInfo] Add new hook: AnalyzeBranchPredicate.

Summary:
NFC: no one uses AnalyzeBranchPredicate yet.

Add TargetInstrInfo::AnalyzeBranchPredicate and implement for x86.  A
later change adding support for page-fault based implicit null checks
depends on this.

Reviewers: reames, ab, atrick

Reviewed By: atrick

Subscribers: llvm-commits

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

llvm-svn: 239742

9 years ago[TargetInstrInfo] Rename getLdStBaseRegImmOfs and implement for x86.
Sanjoy Das [Mon, 15 Jun 2015 18:44:14 +0000 (18:44 +0000)]
[TargetInstrInfo] Rename getLdStBaseRegImmOfs and implement for x86.

Summary:

TargetInstrInfo::getLdStBaseRegImmOfs to
TargetInstrInfo::getMemOpBaseRegImmOfs and implement for x86.  The
implementation only handles a few easy cases now and will be made more
sophisticated in the future.

This is NFCI: the only user of `getLdStBaseRegImmOfs` (now
`getmemOpBaseRegImmOfs`) is `LoadClusterMotion` and `LoadClusterMotion`
is disabled for x86.

Reviewers: reames, ab, MatzeB, atrick

Reviewed By: MatzeB, atrick

Subscribers: llvm-commits

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

llvm-svn: 239741

9 years ago[CodeGen] Introduce a FAULTING_LOAD_OP pseudo-op.
Sanjoy Das [Mon, 15 Jun 2015 18:44:08 +0000 (18:44 +0000)]
[CodeGen] Introduce a FAULTING_LOAD_OP pseudo-op.

Summary:
This instruction encodes a loading operation that may fault, and a label
to branch to if the load page-faults.  The locations of potentially
faulting loads and their "handler" destinations are recorded in a
FaultMap section, meant to be consumed by LLVM's clients.

Nothing generates FAULTING_LOAD_OP instructions yet, but they will be
used in a future change.

The documentation (FaultMaps.rst) needs improvement and I will update
this diff with a more expanded version shortly.

Depends on D10196

Reviewers: rnk, reames, AndyAyers, ab, atrick, pgavlin

Reviewed By: atrick, pgavlin

Subscribers: llvm-commits

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

llvm-svn: 239740

9 years ago[NFC] Extract X86MCInstLower::LowerMachineOperand.
Sanjoy Das [Mon, 15 Jun 2015 18:44:01 +0000 (18:44 +0000)]
[NFC] Extract X86MCInstLower::LowerMachineOperand.

Summary: Refactoring-only change that will be used later.

Reviewers: reames, atrick

Reviewed By: atrick

Subscribers: llvm-commits

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

llvm-svn: 239739

9 years agoCOFF: Fix .reloc section attributes.
Rui Ueyama [Mon, 15 Jun 2015 18:03:47 +0000 (18:03 +0000)]
COFF: Fix .reloc section attributes.

llvm-svn: 239738

9 years agoThis patch implements clang support for the ACLE special register intrinsics
Luke Cheeseman [Mon, 15 Jun 2015 17:51:01 +0000 (17:51 +0000)]
This patch implements clang support for the ACLE special register intrinsics
in section 10.1, __arm_{w,r}sr{,p,64}.

This includes arm_acle.h definitions with builtins and codegen to support
these, the intrinsics are implemented by generating read/write_register calls
which get appropriately lowered in the backend based on the register string
provided. SemaChecking is also implemented to fault invalid parameters.

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

llvm-svn: 239737

9 years agoDe-duplicate common expression, NFC.
Yaron Keren [Mon, 15 Jun 2015 17:03:35 +0000 (17:03 +0000)]
De-duplicate common expression, NFC.

llvm-svn: 239736

9 years agoCOFF: Update README.
Rui Ueyama [Mon, 15 Jun 2015 16:25:11 +0000 (16:25 +0000)]
COFF: Update README.

llvm-svn: 239734

9 years agoRangify several for loops, NFC.
Yaron Keren [Mon, 15 Jun 2015 16:20:16 +0000 (16:20 +0000)]
Rangify several for loops, NFC.

llvm-svn: 239733

9 years agoOn behalf of Alexandros Lamprineas:
Evgeny Astigeevich [Mon, 15 Jun 2015 15:48:44 +0000 (15:48 +0000)]
On behalf of Alexandros Lamprineas:

LLVM targeting aarch64 doesn't correctly produce aligned accesses for non-aligned
data at -O0/fast-isel (-mno-unaligned-access).
The root cause seems to be in fast-isel not producing unaligned access correctly
for -mno-unaligned-access.

The patch just aborts fast-isel for loads and stores when -mno-unaligned-access is
present.
The regression test is updated to check this new test case (-mno-unaligned-access
together with fast-isel).

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

llvm-svn: 239732

9 years ago[LinkerTest] Use LLVMDisposeMessage to free error string.
Benjamin Kramer [Mon, 15 Jun 2015 15:42:26 +0000 (15:42 +0000)]
[LinkerTest] Use LLVMDisposeMessage to free error string.

LLVMDisposeMessage is just a thing wrapper around free at the moment, but it's
the proper API to use here.

llvm-svn: 239731

9 years agoclang-format: NFC. Move testing of selective formatting to a separate file.
Daniel Jasper [Mon, 15 Jun 2015 15:25:11 +0000 (15:25 +0000)]
clang-format: NFC. Move testing of selective formatting to a separate file.

This is a first step for splitting the huge FormatTest.cpp into separate
files to make it easier to find specific tests.

llvm-svn: 239730

9 years agoAvoid a "always true" warning from gcc.
Rafael Espindola [Mon, 15 Jun 2015 14:49:41 +0000 (14:49 +0000)]
Avoid a "always true" warning from gcc.

llvm-svn: 239729

9 years agoFix spelling in comment.
Douglas Katzman [Mon, 15 Jun 2015 13:46:40 +0000 (13:46 +0000)]
Fix spelling in comment.

llvm-svn: 239727

9 years agogold-plugin: save the .o when given -save-temps.
Rafael Espindola [Mon, 15 Jun 2015 13:36:27 +0000 (13:36 +0000)]
gold-plugin: save the .o when given -save-temps.

The plugin now save the bitcode before and after optimizations and the
.o that is passed to the linker.

llvm-svn: 239726

9 years agoOrthography: substracting -> subtracting
Michael Kruse [Mon, 15 Jun 2015 10:52:28 +0000 (10:52 +0000)]
Orthography: substracting -> subtracting

This is a test commit for being granted commit-after-approval access.

llvm-svn: 239725

9 years agoRevert r239721 - Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo...
Daniel Sanders [Mon, 15 Jun 2015 10:34:38 +0000 (10:34 +0000)]
Revert r239721 - Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.

It appears to cause sparc-little-endian.s to assert on Windows and Darwin.

llvm-svn: 239724

9 years ago[LinkerScript] Allow destruction of PHDR
Denis Protivensky [Mon, 15 Jun 2015 09:44:25 +0000 (09:44 +0000)]
[LinkerScript] Allow destruction of PHDR

This is needed for static variable defined in sources.

llvm-svn: 239723

9 years agoclang-format: [JS] Tweak behavior for multiline array initializer parameters
Daniel Jasper [Mon, 15 Jun 2015 09:23:17 +0000 (09:23 +0000)]
clang-format: [JS] Tweak behavior for multiline array initializer parameters

Before:
  var someVariable = SomeFuntion(aaaa, [
    aaaaaaaaaaaaaaaaaaaaaaaaaaa,
    bbbbbbbbbbbbbbbbbbbbbbbbbbb,
    ccccccccccccccccccccccccccc
  ],
                                 aaaa);

After:
  var someVariable = SomeFuntion(aaaa,
                                 [
                                   aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                                   bbbbbbbbbbbbbbbbbbbbbbbbbbb,
                                   ccccccccccccccccccccccccccc
                                 ],
                                 aaaa);

llvm-svn: 239722

9 years agoReplace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.
Daniel Sanders [Mon, 15 Jun 2015 09:19:41 +0000 (09:19 +0000)]
Replace string GNU Triples with llvm::Triple in InitMCObjectFileInfo. NFC.

Summary:
This affects other tools so the previous C++ API has been retained as a
deprecated function for the moment. Clang has been updated with a trivial
patch (not covered by the pre-commit review) to avoid breaking -Werror builds.
Other in-tree tools will be fixed with similar trivial patches.

This continues the patch series to eliminate StringRef forms of GNU triples
from the internals of LLVM that began in r239036.

Reviewers: rengolin

Reviewed By: rengolin

Subscribers: llvm-commits, rengolin

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

llvm-svn: 239721

9 years ago[MachineSink] Improve runtime performance. NFC.
Arnaud A. de Grandmaison [Mon, 15 Jun 2015 09:09:06 +0000 (09:09 +0000)]
[MachineSink] Improve runtime performance. NFC.

This patch fixes a compilation time issue, when MachineSink faces PHIs
with a huge number of operands. This can happen for example in goto table
based interpreters, where some basic blocks can have several of those PHIs,
each one with several hundreds operands. MachineSink was spending a
significant time re-building and re-sorting the list of successors of
the current MachineBasicBlock. The computing and sorting of the current
MachineBasicBlock successors is now cached.

llvm-svn: 239720

9 years ago[LinkerScript] Add matching of output sections to segments
Denis Protivensky [Mon, 15 Jun 2015 08:00:51 +0000 (08:00 +0000)]
[LinkerScript] Add matching of output sections to segments

Add method to query segments for specified output section name.
Return error if the section is assigned to unknown segment.
Check matching of sections to segments during layout on the subject of correctness.
NOTE: no actual functionality of using custom segments is implemented.

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

llvm-svn: 239719

9 years ago[ValueTracking] do not overwrite analysis results already computed
Jingyue Wu [Mon, 15 Jun 2015 05:46:29 +0000 (05:46 +0000)]
[ValueTracking] do not overwrite analysis results already computed

Summary:
ValueTracking used to overwrite the analysis results computed from
assumes and dominating conditions. This patch fixes this issue.

Test Plan: test/Analysis/ValueTracking/assume.ll

Reviewers: hfinkel, majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

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

llvm-svn: 239718

9 years agoCOFF: Use ulittle32_t::operator|=. NFC.
Rui Ueyama [Mon, 15 Jun 2015 03:03:23 +0000 (03:03 +0000)]
COFF: Use ulittle32_t::operator|=. NFC.

llvm-svn: 239717

9 years ago[Support][Endian] Define |= and &= for u{big,little}{16,32,64}_t.
Rui Ueyama [Mon, 15 Jun 2015 03:00:15 +0000 (03:00 +0000)]
[Support][Endian] Define |= and &= for u{big,little}{16,32,64}_t.

llvm-svn: 239716

9 years ago[AArch64] Delete two empty files, which should be removed by r239713.
Hao Liu [Mon, 15 Jun 2015 02:56:40 +0000 (02:56 +0000)]
[AArch64] Delete two empty files, which should be removed by r239713.

llvm-svn: 239715

9 years agoCOFF: Add a brief description about LTO.
Rui Ueyama [Mon, 15 Jun 2015 02:46:18 +0000 (02:46 +0000)]
COFF: Add a brief description about LTO.

llvm-svn: 239714

9 years ago[AArch64] Revert r239711 again. We need to discuss how to share code between AArch64...
Hao Liu [Mon, 15 Jun 2015 01:56:40 +0000 (01:56 +0000)]
[AArch64] Revert r239711 again. We need to discuss how to share code between AArch64 and ARM backend.

llvm-svn: 239713

9 years agoCOFF: Fix resource table size.
Rui Ueyama [Mon, 15 Jun 2015 01:35:56 +0000 (01:35 +0000)]
COFF: Fix resource table size.

The size field shouldn't include trailing padding.

llvm-svn: 239712

9 years ago[AArch64] Match interleaved memory accesses into ldN/stN instructions.
Hao Liu [Mon, 15 Jun 2015 01:35:49 +0000 (01:35 +0000)]
[AArch64] Match interleaved memory accesses into ldN/stN instructions.

Re-commit after adding "-aarch64-neon-syntax=generic" to fix the failure on OS X.
This patch was firstly committed in r239514, then reverted in r239544 because of a syntax incompatible failure on OS X.

llvm-svn: 239711

9 years agoCOFF: Support base relocations.
Rui Ueyama [Mon, 15 Jun 2015 01:23:58 +0000 (01:23 +0000)]
COFF: Support base relocations.

PE/COFF executables/DLLs usually contain data which is called
base relocations. Base relocations are a list of addresses that
need to be fixed by the loader if load-time relocation is needed.

Base relocations are in .reloc section.

We emit one base relocation entry for each IMAGE_REL_AMD64_ADDR64
relocation.

In order to save disk space, base relocations are grouped by page.
Each group is called a block. A block starts with a 32-bit page
address followed by 16-bit offsets in the page. That is more
efficient representation of addresses than just an array of 32-bit
addresses.

llvm-svn: 239710

9 years ago[analyzer] Remove ObjCContainersChecker size information when a CFMutableArrayRef...
Devin Coughlin [Mon, 15 Jun 2015 01:00:42 +0000 (01:00 +0000)]
[analyzer] Remove ObjCContainersChecker size information when a CFMutableArrayRef escapes

Update ObjCContainersChecker to be notified when pointers escape so it can
remove size information for escaping CFMutableArrayRefs. When such pointers
escape, un-analyzed code could mutate the array and cause the size information
to be incorrect.

rdar://problem/19406485

llvm-svn: 239709

9 years agoFix std::function allocator constructors in C++03.
Eric Fiselier [Sun, 14 Jun 2015 23:30:09 +0000 (23:30 +0000)]
Fix std::function allocator constructors in C++03.

The C++03 version of function tried to default construct the allocator
in the uses allocator constructors when no allocation was performed. These
constructors would fail to compile when used with allocators that had no
default constructor.

llvm-svn: 239708

9 years agoCOFF: Change const name. NFC.
Rui Ueyama [Sun, 14 Jun 2015 22:21:29 +0000 (22:21 +0000)]
COFF: Change const name. NFC.

llvm-svn: 239707

9 years agoCOFF: Set Chunk to OutputSection backreference in addChunk().
Rui Ueyama [Sun, 14 Jun 2015 22:16:47 +0000 (22:16 +0000)]
COFF: Set Chunk to OutputSection backreference in addChunk().

When we add a chunk to an OutputSection, we always want to create
a backreference from an OutputSection to a Chunk. To make sure
we always do, do that in addChunk(). NFC.

llvm-svn: 239706

9 years agoCOFF: Add an assertion. NFC.
Rui Ueyama [Sun, 14 Jun 2015 22:01:39 +0000 (22:01 +0000)]
COFF: Add an assertion. NFC.

r239458 changed callee side of this function, so Live can never be
true when this function is called.

llvm-svn: 239705

9 years agoCOFF: Support Windows resource files.
Rui Ueyama [Sun, 14 Jun 2015 21:50:50 +0000 (21:50 +0000)]
COFF: Support Windows resource files.

Resource files are data files containing i18n messages, icon images, etc.
MSVC has a tool to convert a resource file to a regular COFF file so that
you can just link that file to embed resources to an executable.

However, you can directly pass resource files to the linker. If you do that,
the linker invokes the tool automatically. This patch implements that feature.

llvm-svn: 239704

9 years ago[CMake] Try to fix r239612, not to miss resources/windows_version_resource.rc in...
NAKAMURA Takumi [Sun, 14 Jun 2015 21:47:29 +0000 (21:47 +0000)]
[CMake] Try to fix r239612, not to miss resources/windows_version_resource.rc in clang build.

  - Who defines ${LLVM_SOURCE_DIR} ?
  - Would windows_version_resource.rc be available in an *installed* llvm tree?
    I suggest it may be installed in ${PREFIX}/share.

llvm-svn: 239703

9 years ago[InstSimplify] fsub nnan x, x -> 0.0 is valid without ninf
Benjamin Kramer [Sun, 14 Jun 2015 21:01:20 +0000 (21:01 +0000)]
[InstSimplify] fsub nnan x, x -> 0.0 is valid without ninf

Both inf - inf and (-inf) - (-inf) are NaN, so it's already covered by
nnan.

llvm-svn: 239702

9 years ago[InstSimplify] Add self-fdiv identities for -ffinite-math-only.
Benjamin Kramer [Sun, 14 Jun 2015 18:53:58 +0000 (18:53 +0000)]
[InstSimplify] Add self-fdiv identities for -ffinite-math-only.

When NaNs and Infs are ignored we can fold
 X /  X -> 1.0
-X /  X -> -1.0
 X / -X -> -1.0

llvm-svn: 239701

9 years agoAVX-512: Implemented DAG lowering for shuff62x2/shufi62x2 instuctions ( Shuffle Packe...
Igor Breger [Sun, 14 Jun 2015 13:07:47 +0000 (13:07 +0000)]
AVX-512: Implemented DAG lowering for shuff62x2/shufi62x2 instuctions ( Shuffle Packed Values at 128-bit Granularity )
Tests added , vector-shuffle-512-v8.ll test re-generated.

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

llvm-svn: 239697

9 years agoAdd test for parsing the XOR operator in Intel syntax inline assembly.
Michael Kuperstein [Sun, 14 Jun 2015 13:03:27 +0000 (13:03 +0000)]
Add  test for parsing the XOR operator in Intel syntax inline assembly.
LLVM side of the patch was committed as r239695.

Differential Revision: http://reviews.llvm.org/D10384
Patch by marina.yatsina@intel.com

llvm-svn: 239696

9 years agoAdd support for parsing the XOR operator in Intel syntax inline assembly.
Michael Kuperstein [Sun, 14 Jun 2015 12:59:45 +0000 (12:59 +0000)]
Add support for parsing the XOR operator in Intel syntax inline assembly.

Differential Revision: http://reviews.llvm.org/D10385
Patch by marina.yatsina@intel.com

llvm-svn: 239695

9 years agoAVX-512: Implemented cvtsi2ss/d cvtusi2ss/d instructions with round control for KNL.
Igor Breger [Sun, 14 Jun 2015 12:44:55 +0000 (12:44 +0000)]
AVX-512: Implemented cvtsi2ss/d cvtusi2ss/d instructions with round control for KNL.
Added intrinsics for cvtsi2ss/d instructions.
Added tests for intrinsics and encoding.

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

llvm-svn: 239694