platform/upstream/llvm.git
9 years ago[Object][ELF] Support dumping hash-tables from files with no section table.
Michael J. Spencer [Thu, 9 Jul 2015 22:32:24 +0000 (22:32 +0000)]
[Object][ELF] Support dumping hash-tables from files with no section table.

This time without breaking the bots.

llvm-svn: 241869

9 years agoMIR Serialization: Serialize the virtual register definitions.
Alex Lorenz [Thu, 9 Jul 2015 22:23:13 +0000 (22:23 +0000)]
MIR Serialization: Serialize the virtual register definitions.

The virtual registers are serialized using a YAML sequence of YAML inline
mappings. Each mapping has the id of the virtual register and the register
class.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 241868

9 years ago[LAA] Fix grammar in debug output
Adam Nemet [Thu, 9 Jul 2015 22:17:41 +0000 (22:17 +0000)]
[LAA] Fix grammar in debug output

llvm-svn: 241867

9 years ago[LAA] Hide NeedRTCheck logic completely inside canCheckPtrAtRT, NFC
Adam Nemet [Thu, 9 Jul 2015 22:17:38 +0000 (22:17 +0000)]
[LAA] Hide NeedRTCheck logic completely inside canCheckPtrAtRT, NFC

Currently canCheckPtrAtRT returns two flags NeedRTCheck and CanDoRT.
NeedRTCheck says whether we need checks and CanDoRT whether we can
generate the checks.  The idea is to encode three states with these:

     Need/Can:
(1) false/dont-care: no checks are needed
(2) true/false: we need checks but can't generate them
(3) true/true: we need checks and we can generate them

This is pretty unnecessary since the caller (analyzeLoop) is only
interested in whether we can generate the checks if we actually need
them (i.e. 1 or 3).

So this change cleans up to return just that (CanDoRTIfNeeded) and pulls
all the underlying logic into canCheckPtrAtRT.

By doing all this, we simplify analyzeLoop which is the complex function
in LAA.

There is further room for improvement here by using RtCheck.Need
directly rather than a new local variable NeedRTCheck but that's for a
later patch.

llvm-svn: 241866

9 years ago[WinEH] Give up on using CSRs across 32-bit invokes for now
Reid Kleckner [Thu, 9 Jul 2015 22:09:41 +0000 (22:09 +0000)]
[WinEH] Give up on using CSRs across 32-bit invokes for now

The runtime does not restore CSRs when transferring control back to the
function handling the exception. According to the experts on IRC, LLVM's
register allocator has no way to model register clobbers that only
happen on one edge of the CFG. For now, don't worry about trying to use
the meager three CSRs available on 32-bit X86 and just say that such
invokes preserve nothing.

llvm-svn: 241865

9 years agoExpose sjlj preparation through opt for my own debugging purposes
Reid Kleckner [Thu, 9 Jul 2015 21:48:40 +0000 (21:48 +0000)]
Expose sjlj preparation through opt for my own debugging purposes

llvm-svn: 241864

9 years ago[Static Analyzer] Basic per checker command line option validation.
Gabor Horvath [Thu, 9 Jul 2015 21:43:45 +0000 (21:43 +0000)]
[Static Analyzer] Basic per checker command line option validation.

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

llvm-svn: 241863

9 years agoMIR Parser: Report an error when parsing machine function with an empty body.
Alex Lorenz [Thu, 9 Jul 2015 21:21:33 +0000 (21:21 +0000)]
MIR Parser: Report an error when parsing machine function with an empty body.

This commit adds a new error which is reported when the MIR Parser encounters
a machine function without any machine basic blocks. The machine verifier
expects that the machine functions have at least one MBB, and this error will
prevent machine functions without MBBs from reaching the machine verifier and
crashing with an assertion.

llvm-svn: 241862

9 years agoAMDGPU: Add helper function for implicit parameter offsets.
Tom Stellard [Thu, 9 Jul 2015 21:20:37 +0000 (21:20 +0000)]
AMDGPU: Add helper function for implicit parameter offsets.

Patch by: Zoltan Gilian

llvm-svn: 241861

9 years agoCOFF: Fix locally-imported symbol's size for x86.
Rui Ueyama [Thu, 9 Jul 2015 21:15:58 +0000 (21:15 +0000)]
COFF: Fix locally-imported symbol's size for x86.

llvm-svn: 241860

9 years agoUnbreak WebAssembly build
JF Bastien [Thu, 9 Jul 2015 21:00:09 +0000 (21:00 +0000)]
Unbreak WebAssembly build

Summary: D11021 and D11045 didn't update the WebAssembly target's code. It's still experimental so all tests passed.

Reviewers: sunfish, joker.eph, echristo

Subscribers: llvm-commits, jfb

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

llvm-svn: 241859

9 years agoWebAssembly: add placeholder intrinsics header
JF Bastien [Thu, 9 Jul 2015 20:57:38 +0000 (20:57 +0000)]
WebAssembly: add placeholder intrinsics header

Reviewers: sunfish

Subscribers: llvm-commits, jfb

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

llvm-svn: 241858

9 years agoCOFF: Implement base relocations for x86.
Rui Ueyama [Thu, 9 Jul 2015 20:36:59 +0000 (20:36 +0000)]
COFF: Implement base relocations for x86.

With this patch, LLD is now able to self-link an .exe file for x86
that runs correctly, although I don't think some headers (particularly
SEH) are not correct. DLL support is coming soon.

llvm-svn: 241857

9 years agoCOFF: Fix import symbol name mangling.
Rui Ueyama [Thu, 9 Jul 2015 20:22:41 +0000 (20:22 +0000)]
COFF: Fix import symbol name mangling.

For IMPORT_NAME_NOPREFIX symbols, we should remove only one prefix character.

llvm-svn: 241854

9 years agoCOFF: Fix command line options for external commands.
Rui Ueyama [Thu, 9 Jul 2015 20:22:39 +0000 (20:22 +0000)]
COFF: Fix command line options for external commands.

llvm-svn: 241853

9 years agoTurn debugger interface off by default.
Jonathan Peyton [Thu, 9 Jul 2015 20:17:16 +0000 (20:17 +0000)]
Turn debugger interface off by default.

Just changed LIBOMP_USE_DEBUGGER to false.

llvm-svn: 241852

9 years ago[ImplicitNullChecks] Fix a memory leak.
Sanjoy Das [Thu, 9 Jul 2015 20:13:31 +0000 (20:13 +0000)]
[ImplicitNullChecks] Fix a memory leak.

llvm-svn: 241851

9 years ago[ImplicitNullChecks] Be smarter in picking the memory op.
Sanjoy Das [Thu, 9 Jul 2015 20:13:25 +0000 (20:13 +0000)]
[ImplicitNullChecks] Be smarter in picking the memory op.

Summary:
Before this change ImplicitNullChecks would only pick loads of the form:

```
   test Reg, Reg
   jz elsewhere
 fallthrough:
   movl 32(Reg), Reg2
```

but not (say)

```
   test Reg, Reg
   jz elsewhere
 fallthrough:
   inc Reg3
   movl 32(Reg), Reg2
```

This change teaches ImplicitNullChecks to look through "unrelated"
instructions like `inc Reg3` when searching for a load instruction
to convert to a trapping load.

Reviewers: atrick, JosephTremoulet, reames

Subscribers: llvm-commits

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

llvm-svn: 241850

9 years agoCreate BSD archives by default on OS X.
Rafael Espindola [Thu, 9 Jul 2015 20:12:50 +0000 (20:12 +0000)]
Create BSD archives by default on OS X.

They should probably be created on anything that is not windows or linux, but I will
test on freebsd before changing that.

With this it is possible to bootstrap with llvm-ar instead of ar+ranlib on OS X.

llvm-svn: 241849

9 years agoCFI: Emit correct bit set information if RTTI is disabled under MS ABI.
Peter Collingbourne [Thu, 9 Jul 2015 19:56:14 +0000 (19:56 +0000)]
CFI: Emit correct bit set information if RTTI is disabled under MS ABI.

We were previously creating bit set entries at virtual table offset
sizeof(void*) unconditionally under the Microsoft C++ ABI. This is incorrect
if RTTI data is disabled; in that case the "address point" is at offset
0. This change modifies bit set emission to take into account whether RTTI
data is being emitted.

Also make a start on a blacklisting scheme for records.

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

llvm-svn: 241845

9 years agoMIR Serialization: Serialize the simple MachineFrameInfo attributes.
Alex Lorenz [Thu, 9 Jul 2015 19:55:27 +0000 (19:55 +0000)]
MIR Serialization: Serialize the simple MachineFrameInfo attributes.

This commit serializes the 13 scalar boolean and integer attributes from the
MachineFrameInfo class: IsFrameAddressTaken, IsReturnAddressTaken, HasStackMap,
HasPatchPoint, StackSize, OffsetAdjustment, MaxAlignment, AdjustsStack,
HasCalls, MaxCallFrameSize, HasOpaqueSPAdjustment, HasVAStart, and
HasMustTailInVarArgFunc. These attributes are serialized as part
of the frameInfo YAML mapping, which itself is a part of the machine function's
YAML mapping.

llvm-svn: 241844

9 years agoCOFF: Infer machine type earlier than before.
Rui Ueyama [Thu, 9 Jul 2015 19:54:13 +0000 (19:54 +0000)]
COFF: Infer machine type earlier than before.

Previously, we infer machine type at the very end of linking after
all symbols are resolved. That's actually too late because machine
type affects how we mangle symbols (whether or not we need to
add "_").

For example, /entry:foo adds "_foo" to the symbol table if x86 but
"foo" if x64.

This patch moves the code to infer machine type, so that machine
type is inferred based on input files given via the command line
(but not based on .directives files).

llvm-svn: 241843

9 years agollvm-ar: Pad the symbol table to 4 bytes.
Rafael Espindola [Thu, 9 Jul 2015 19:48:06 +0000 (19:48 +0000)]
llvm-ar: Pad the symbol table to 4 bytes.

It looks like ld64 requires it. With this we seem to be able to bootstrap using
llvm-ar+/usr/bin/true instead of ar+ranlib (currently on stage2).

llvm-svn: 241842

9 years agoRename ModuleContainerGenerator to PCHContainergenerator for consistency
Adrian Prantl [Thu, 9 Jul 2015 19:46:39 +0000 (19:46 +0000)]
Rename ModuleContainerGenerator to PCHContainergenerator for consistency
and re-clang-format (NFC).

llvm-svn: 241841

9 years agoCOFF: Make /machine:{i386,amd64} aliases to {x86,x64}.
Rui Ueyama [Thu, 9 Jul 2015 19:43:49 +0000 (19:43 +0000)]
COFF: Make /machine:{i386,amd64} aliases to {x86,x64}.

MSVC linker accepts these aliases.

llvm-svn: 241840

9 years agoAMDGPU/R600: Return correct chain when lowering loads
Matt Arsenault [Thu, 9 Jul 2015 18:47:03 +0000 (18:47 +0000)]
AMDGPU/R600: Return correct chain when lowering loads

The other LowerLOAD should be returning the correct chain.

llvm-svn: 241839

9 years ago[IndVars] Try to use existing values in RewriteLoopExitValues.
Sanjoy Das [Thu, 9 Jul 2015 18:46:12 +0000 (18:46 +0000)]
[IndVars] Try to use existing values in RewriteLoopExitValues.

Summary:
In RewriteLoopExitValues, before expanding out an SCEV expression using
SCEVExpander, try to see if an existing LLVM IR expression already
computes the value we're interested in.  If so use that existing
expression.

Apart from reducing IndVars' reliance on the rest of the compilation
pipeline, this also prevents IndVars from concluding some expressions as
"high cost" when they're not.  For instance,
`InductiveRangeCheckElimination` often emits code of the following form:

```
len = umin(len_A, len_B)

loop:
  ...
  if (i++ < len)
    goto loop

outside_loop:
    use(i)
```

`SCEVExpander` refuses to rewrite the use of `i` in `outside_loop`,
since it thinks the value of `i` on loop exit, `len`, is a high cost
expansion since it contains an `umax` in it.  With this change,
`IndVars` can see that it can re-use `len` instead of creating a new
expression to compute `umin(len_A, len_B)`.

I considered putting this cleverness in `SCEVExpander`, but I was
worried that it may then have a deterimental effect on other passes
that use it.  So I decided it was better to just do this in the one
place where it seems like an obviously good idea, with the intent of
generalizing later if needed.

Reviewers: atrick, reames

Subscribers: llvm-commits

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

llvm-svn: 241838

9 years agoFix 32-bit Linux watchpoint failures.
Chaoren Lin [Thu, 9 Jul 2015 18:35:16 +0000 (18:35 +0000)]
Fix 32-bit Linux watchpoint failures.

Summary:
32-bit signed return value from ptrace got sign extended when being converted to
64-bit unsigned.

Also, replaced tabs with spaces in the source.

Reviewers: labath, clayborg

Subscribers: lldb-commits

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

llvm-svn: 241837

9 years ago[llvm-readobj] Print MIPS PLT table
Simon Atanasyan [Thu, 9 Jul 2015 18:23:10 +0000 (18:23 +0000)]
[llvm-readobj] Print MIPS PLT table

Now the -mips-plt-got prints both MIPS GOT and PLT tables.

llvm-svn: 241836

9 years ago[yaml2obj] Initialize sh_addralign field for the .symtab section
Simon Atanasyan [Thu, 9 Jul 2015 18:23:02 +0000 (18:23 +0000)]
[yaml2obj] Initialize sh_addralign field for the .symtab section

llvm-svn: 241835

9 years ago[ELF] Explicitly configure sections alignment in the tests. NFC
Simon Atanasyan [Thu, 9 Jul 2015 18:22:55 +0000 (18:22 +0000)]
[ELF] Explicitly configure sections alignment in the tests. NFC

llvm-svn: 241834

9 years agoFollow up to safe API patch
Jonathan Peyton [Thu, 9 Jul 2015 18:20:51 +0000 (18:20 +0000)]
Follow up to safe API patch

A while back, we made an initial change where dangerous C API functions were
replaced with macros that translated the dangerous API function calls to safer
function calls e.g., sprintf() replaced with KMP_SPRINTF() which translates to
sprintf_s() on Windows. Currently, the only operating system where this is
applicable is Windows. Unix-like systems are still using the dangerous API
e.g., KMP_SPRINTF() translates to sprintf().  Our own testing showed no
performance differences.

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

llvm-svn: 241833

9 years agoEnable debugger support
Jonathan Peyton [Thu, 9 Jul 2015 18:16:58 +0000 (18:16 +0000)]
Enable debugger support

These changes enable external debuggers to conveniently interface with
the LLVM OpenMP Library.  Structures are added which describe the important
internal structures of the OpenMP Library e.g., teams, threads, etc.
This feature is turned on by default (CMake variable LIBOMP_USE_DEBUGGER)
and can be turned off with -DLIBOMP_USE_DEBUGGER=off.

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

llvm-svn: 241832

9 years ago[llvm-readobj] Re-add sanity checking which was accidentally removed in r241764
David Majnemer [Thu, 9 Jul 2015 18:14:31 +0000 (18:14 +0000)]
[llvm-readobj] Re-add sanity checking which was accidentally removed in r241764

llvm-svn: 241831

9 years ago[llvm-objdump] Require that jump targets shown in -d are functions
David Majnemer [Thu, 9 Jul 2015 18:11:40 +0000 (18:11 +0000)]
[llvm-objdump] Require that jump targets shown in -d are functions

Don't let the disassembler pick call <.text> if a function happens to
live at the start of the section by only using function symbols.

llvm-svn: 241830

9 years agoRemove dead code from old 64-bit SEH lowering
Reid Kleckner [Thu, 9 Jul 2015 17:46:39 +0000 (17:46 +0000)]
Remove dead code from old 64-bit SEH lowering

llvm-svn: 241829

9 years agoCOFF: Fill in the type and storage class in the symbol table
David Majnemer [Thu, 9 Jul 2015 17:43:50 +0000 (17:43 +0000)]
COFF: Fill in the type and storage class in the symbol table

We can use the type and storage class from the symbol's original object
file to fill in the linked executable's symbol table.

llvm-svn: 241828

9 years agoAllow {e,r}bp as the target of {read,write}_register.
Pat Gavlin [Thu, 9 Jul 2015 17:40:29 +0000 (17:40 +0000)]
Allow {e,r}bp as the target of {read,write}_register.

This patch allows the read_register and write_register intrinsics to
read/write the RBP/EBP registers on X86 iff the targeted register is
the frame pointer for the containing function.

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

llvm-svn: 241827

9 years agofix an invisible bug when combining repeated FP divisors
Sanjay Patel [Thu, 9 Jul 2015 17:28:37 +0000 (17:28 +0000)]
fix an invisible bug when combining repeated FP divisors

This patch fixes bugs that were exposed by the addition of fast-math-flags in the DAG:
r237046 ( http://reviews.llvm.org/rL237046 ):

1. When replacing a division node, it's not enough to RAUW.
   We should call CombineTo() to delete dead nodes and combine again.
2. Because we are changing the DAG, we can't return an empty SDValue
   after the transform. As the code comments say:

    Visitation implementation - Implement dag node combining for different node types.
    The semantics are as follows: Return Value:
      SDValue.getNode() == 0 - No change was made
      SDValue.getNode() == N - N was replaced, is dead and has been handled.
      otherwise - N should be replaced by the returned Operand.

The new test case shows no difference with or without this patch, but it will crash if
we re-apply r237046 or enable FMF via the current -enable-fmf-dag cl::opt.

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

llvm-svn: 241826

9 years agoAdd GCC-compatible flags -fprofile-generate and -fprofile-use.
Diego Novillo [Thu, 9 Jul 2015 17:23:53 +0000 (17:23 +0000)]
Add GCC-compatible flags -fprofile-generate and -fprofile-use.

This patch adds support for specifying where the profile is emitted in a
way similar to GCC. These flags are used to specify directories instead
of filenames. When -fprofile-generate=DIR is used, the compiler will
generate code to write to <DIR>/default.profraw.

The patch also adds a couple of extensions: LLVM_PROFILE_FILE can still be
used to override the directory and file name to use and -fprofile-use
accepts both directories and filenames.

To simplify the set of flags used in the backend, all the flags get
canonicalized to -fprofile-instr-{generate,use} when passed to the
backend. The decision to use a default name for the profile is done
in the driver.

llvm-svn: 241825

9 years agoAdd support for generating profiles in a given directory.
Diego Novillo [Thu, 9 Jul 2015 17:21:52 +0000 (17:21 +0000)]
Add support for generating profiles in a given directory.

When the file is initialized, this patch checks whether the path
specifies a directory. If so, it creates the directory tree before
truncating the file.

Use default.profdata instead of pgo-data for default indexed profile name.

llvm-svn: 241824

9 years ago[StackMap] Use lambdas to specify the sort and erase conditions. NFC.
Juergen Ributzka [Thu, 9 Jul 2015 17:11:15 +0000 (17:11 +0000)]
[StackMap] Use lambdas to specify the sort and erase conditions. NFC.

llvm-svn: 241823

9 years ago[StackMap] Rename variables to be more consistent. NFC.
Juergen Ributzka [Thu, 9 Jul 2015 17:11:11 +0000 (17:11 +0000)]
[StackMap] Rename variables to be more consistent. NFC.

Rename a few variables and use auto for long iterator names.

llvm-svn: 241822

9 years ago[StackMaps] Use emplace_back when possible. NFC.
Juergen Ributzka [Thu, 9 Jul 2015 17:11:08 +0000 (17:11 +0000)]
[StackMaps] Use emplace_back when possible. NFC.

llvm-svn: 241821

9 years agoUnbreak Makefile build
Keno Fischer [Thu, 9 Jul 2015 17:09:09 +0000 (17:09 +0000)]
Unbreak Makefile build

llvm-svn: 241820

9 years agoCOFF: Remove Writer::Is64 and use Config::is64 instead. NFC.
Rui Ueyama [Thu, 9 Jul 2015 16:40:39 +0000 (16:40 +0000)]
COFF: Remove Writer::Is64 and use Config::is64 instead. NFC.

llvm-svn: 241819

9 years agoAdd a test of a regression discovered during testing of r241673
Silviu Baranga [Thu, 9 Jul 2015 16:40:25 +0000 (16:40 +0000)]
Add a test of a regression discovered during testing of r241673

Summary:
We were missing a corner case where DepCands was not available,
but we were using DepCands to compute the checking pointer
groups.

This adds a test for that regression.

Subscribers: llvm-commits

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

llvm-svn: 241818

9 years agoAMDGPU/SI: The SIShrinkInstructions pass should only fold immediates with one use
Tom Stellard [Thu, 9 Jul 2015 16:30:36 +0000 (16:30 +0000)]
AMDGPU/SI: The SIShrinkInstructions pass should only fold immediates with one use

This is convered by existing testcases and will be exposed by a future
commit.

llvm-svn: 241817

9 years agoAMDGPU/SI: Fix crash on physical registers in SIInstrInfo::isOperandLegal()
Tom Stellard [Thu, 9 Jul 2015 16:30:27 +0000 (16:30 +0000)]
AMDGPU/SI: Fix crash on physical registers in SIInstrInfo::isOperandLegal()

No test case for this.  I ran into it while working on some improvements
to SIShrinkInstructions.cpp.

llvm-svn: 241816

9 years agoAdd missing file from previous commit.
Rafael Espindola [Thu, 9 Jul 2015 15:58:22 +0000 (15:58 +0000)]
Add missing file from previous commit.

llvm-svn: 241815

9 years agoBasic support for BSD symbol tables in archives.
Rafael Espindola [Thu, 9 Jul 2015 15:56:23 +0000 (15:56 +0000)]
Basic support for BSD symbol tables in archives.

This could be optimized and for now we only produce __.SYMDEF
and not "__.SYMDEF SORTED".

llvm-svn: 241814

9 years ago[Hexagon] Add missing preamble to a source file
Krzysztof Parzyszek [Thu, 9 Jul 2015 15:40:25 +0000 (15:40 +0000)]
[Hexagon] Add missing preamble to a source file

llvm-svn: 241813

9 years ago[Driver] semi-annual ubuntu version bump.
Benjamin Kramer [Thu, 9 Jul 2015 15:31:17 +0000 (15:31 +0000)]
[Driver] semi-annual ubuntu version bump.

llvm-svn: 241812

9 years ago[CodeCompletion] Don't crash on member inits of templated constructors.
Benjamin Kramer [Thu, 9 Jul 2015 15:31:10 +0000 (15:31 +0000)]
[CodeCompletion] Don't crash on member inits of templated constructors.

Also fixes a crash (on invalid) member functions with a colon
initializer. PR23948.

llvm-svn: 241811

9 years agoRemove redundant variable. NFC.
Rafael Espindola [Thu, 9 Jul 2015 15:24:39 +0000 (15:24 +0000)]
Remove redundant variable. NFC.

llvm-svn: 241810

9 years agoDon't rely on the DepCands iteration order when constructing checking pointer groups
Silviu Baranga [Thu, 9 Jul 2015 15:18:25 +0000 (15:18 +0000)]
Don't rely on the DepCands iteration order when constructing checking pointer groups

Summary:
The checking pointer group construction algorithm relied on the iteration on DepCands.
We would need the same leaders across runs and the same iteration order over the underlying std::set for determinism.

This changes the algorithm to process the pointers in the order in which they were added to the runtime check, which is deterministic.
We need to update the tests, since the order in which pointers appear has changed.

No new tests were added, since it is impossible to test for non-determinism.

Subscribers: llvm-commits

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

llvm-svn: 241809

9 years agoAdd a helper to printing BE of LE depending on the format.
Rafael Espindola [Thu, 9 Jul 2015 15:13:41 +0000 (15:13 +0000)]
Add a helper to printing BE of LE depending on the format.

The gnu ar format uses BE numbers. The BSD one uses LE. Add a helper for one or the
other. NFC for now, just removes some noise from the following patch.

llvm-svn: 241808

9 years agoRe-instate the EVT parameter to getScalarShiftAmountTy() for OOT user
Mehdi Amini [Thu, 9 Jul 2015 15:12:23 +0000 (15:12 +0000)]
Re-instate the EVT parameter to getScalarShiftAmountTy() for OOT user

A documentation for this function would be nice by the way.

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

9 years agoReapply fixed r241790: Fix shift legalization and lowering for big constants.
Pawel Bylica [Thu, 9 Jul 2015 14:58:04 +0000 (14:58 +0000)]
Reapply fixed r241790: Fix shift legalization and lowering for big constants.

Summary: If shift amount is a constant value > 64 bit it is handled incorrectly during type legalization and X86 lowering. This patch the type of shift amount argument in function DAGTypeLegalizer::ExpandShiftByConstant from unsigned to APInt.

Reviewers: nadav, majnemer, sanjoy, RKSimon

Subscribers: RKSimon, llvm-commits

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

llvm-svn: 241806

9 years agoExtract printBSDMemberHeader.
Rafael Espindola [Thu, 9 Jul 2015 14:54:12 +0000 (14:54 +0000)]
Extract printBSDMemberHeader.

It will get another use in the following patch. Also rename the other helper to
printGNUSmallMemberHeader for consistency.

llvm-svn: 241805

9 years ago[Hexagon] Add support for atomic RMW operations
Krzysztof Parzyszek [Thu, 9 Jul 2015 14:51:21 +0000 (14:51 +0000)]
[Hexagon] Add support for atomic RMW operations

llvm-svn: 241804

9 years ago[AArch64] Select SBFIZ or UBFIZ instead of left + right shifts
Arnaud A. de Grandmaison [Thu, 9 Jul 2015 14:33:38 +0000 (14:33 +0000)]
[AArch64] Select SBFIZ or UBFIZ instead of left + right shifts

And rename LSB to Immr / MSB to Imms to match the ARM ARM terminology.

llvm-svn: 241803

9 years ago[ARM] Thumb1 3 to 2 operand convertion for commutative operations
Scott Douglass [Thu, 9 Jul 2015 14:13:55 +0000 (14:13 +0000)]
[ARM] Thumb1 3 to 2 operand convertion for commutative operations

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

llvm-svn: 241802

9 years ago[ARM] Don't be overzealous converting Thumb1 3 to 2 operands
Scott Douglass [Thu, 9 Jul 2015 14:13:48 +0000 (14:13 +0000)]
[ARM] Don't be overzealous converting Thumb1 3 to 2 operands

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

llvm-svn: 241801

9 years ago[ARM] Add Thumb2 ADD with PC narrowing from 3 operand to 2
Scott Douglass [Thu, 9 Jul 2015 14:13:41 +0000 (14:13 +0000)]
[ARM] Add Thumb2 ADD with PC narrowing from 3 operand to 2

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

llvm-svn: 241800

9 years ago[ARM] Refactor converting Thumb1 from 3 to 2 operand (nfc)
Scott Douglass [Thu, 9 Jul 2015 14:13:34 +0000 (14:13 +0000)]
[ARM] Refactor converting Thumb1 from 3 to 2 operand (nfc)

Also adds some test cases.

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

llvm-svn: 241799

9 years ago[ARM] Add ADD tests for Thumb2 narrowing (nfc)
Scott Douglass [Thu, 9 Jul 2015 14:13:22 +0000 (14:13 +0000)]
[ARM] Add ADD tests for Thumb2 narrowing (nfc)

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

llvm-svn: 241798

9 years agoTest for 241794 (nest attribute in AArch64)
Renato Golin [Thu, 9 Jul 2015 13:29:35 +0000 (13:29 +0000)]
Test for 241794 (nest attribute in AArch64)

Forgot to git add the test.

Patch by Stephen Cross.

llvm-svn: 241797

9 years agoAvoid going through Platform when creating a NativeProcessProtocol instance
Pavel Labath [Thu, 9 Jul 2015 11:51:11 +0000 (11:51 +0000)]
Avoid going through Platform when creating a NativeProcessProtocol instance

Summary:
This commit avoids the Platform instance when spawning or attaching to a process in lldb-server.
Instead, I have the server call a (static) method of NativeProcessProtocol directly. The reason
for this is that I believe that NativeProcessProtocol should be decoupled from the Platform
(after all, it always knows which platform it is running on, unlike the rest of lldb).
Additionally, the kind of platform actions a NativeProcessProtocol instance is likely to differ
greatly from the platform actions of the lldb client, so I think the separation makes sense.

After this, the only dependency NativeProcessLinux has on PlatformLinux is the ResolveExecutable
method, which needs additional refactoring.

This is a resubmit of r241672, after it was reverted due to build failueres on non-linux
platforms.

Reviewers: ovyalov, clayborg

Subscribers: lldb-commits

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

llvm-svn: 241796

9 years agoFix TestStopHookMultipleThreads and TestNamespace after r241751
Pavel Labath [Thu, 9 Jul 2015 10:57:54 +0000 (10:57 +0000)]
Fix TestStopHookMultipleThreads and TestNamespace after r241751

The mentioned commit introduced a subtle change in behavior when printing variable names. This
occured when we have a variable, for which we only know the demangled name, because the compiler
has failed to provide one (this typically happens for variables in anonymous namespaces). A
Mangled class which contains only a demangled name considers itself to be invalid (this could
possibly be a bug), but it's GetName() method still returns a valid demangled name. The previous
commit introduced the check for the validity of the class, and if it failed, it would fall back
to printing the bare name (without the namespace prefixes, as the tests were expecting). I revert
this part of the commit and check the validity of the string returned by GetName() instead.

llvm-svn: 241795

9 years agoAdd support for nest attribute to AArch64 backend
Renato Golin [Thu, 9 Jul 2015 10:18:02 +0000 (10:18 +0000)]
Add support for nest attribute to AArch64 backend

The nest attribute is currently supported on the x86 (32-bit) and x86-64
backends, but not on ARM (32-bit) or AArch64. This patch adds support for
nest to the AArch64 backend.

Register x18 is used by GCC for this purpose and hence is used here.
As discussed on the GCC mailing list the register choice is an ABI issue
and so choosing the same register as GCC means __builtin_call_with_static_chain
is compatible.

Patch by Stephen Cross.

llvm-svn: 241794

9 years agoAdd getSizeInBits function to the APFloat class
Tamas Berghammer [Thu, 9 Jul 2015 10:13:39 +0000 (10:13 +0000)]
Add getSizeInBits function to the APFloat class

The newly added function returns the size of the specified floating
point semantics in bits.

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

llvm-svn: 241793

9 years agoRevert r241790: Fix shift legalization and lowering for big constants.
Pawel Bylica [Thu, 9 Jul 2015 09:50:54 +0000 (09:50 +0000)]
Revert r241790: Fix shift legalization and lowering for big constants.

llvm-svn: 241792

9 years ago[lldb-mi] Remove unused typedefs.
Bruce Mitchener [Thu, 9 Jul 2015 08:45:26 +0000 (08:45 +0000)]
[lldb-mi] Remove unused typedefs.

Summary: [lldb-mi] Remove unused typedefs.

Reviewers: abidh, ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 241791

9 years agoFix shift legalization and lowering for big constants.
Pawel Bylica [Thu, 9 Jul 2015 08:01:36 +0000 (08:01 +0000)]
Fix shift legalization and lowering for big constants.

Summary: If shift amount is a constant value > 64 bit it is handled incorrectly during type legalization and X86 lowering. This patch the type of shift amount argument in function DAGTypeLegalizer::ExpandShiftByConstant from unsigned to APInt.

Reviewers: nadav, majnemer, sanjoy, RKSimon

Subscribers: RKSimon, llvm-commits

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

llvm-svn: 241790

9 years agoAdd clang_free to libclang to free memory allocated in libclang.
Yaron Keren [Thu, 9 Jul 2015 07:53:23 +0000 (07:53 +0000)]
Add clang_free to libclang to free memory allocated in libclang.

One of the problems libclang tests has running under Windows is memory
allocated in libclang.dll but being freed in the test executable, possibly
by a different memory manager. This patch exposes a new export function,
clang_free(), used to free any allocated memory with the same libclang.dll
memory manager that allocated the memory.

http://reviews.llvm.org/D10949

Reviewed by Reid Kleckner, Douglas Gregor.

llvm-svn: 241789

9 years agoExtended syntax of vector version of getelementptr instruction.
Elena Demikhovsky [Thu, 9 Jul 2015 07:42:48 +0000 (07:42 +0000)]
Extended syntax of vector version of getelementptr instruction.

The justification of this change is here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/082989.html

According to the current GEP syntax, vector GEP requires that each index must be a vector with the same number of elements.

%A = getelementptr i8, <4 x i8*> %ptrs, <4 x i64> %offsets

In this implementation I let each index be or vector or scalar. All vector indices must have the same number of elements. The scalar value will mean the splat vector value.

(1) %A = getelementptr i8, i8* %ptr, <4 x i64> %offsets
or
(2) %A = getelementptr i8, <4 x i8*> %ptrs, i64 %offset

In all cases the %A type is <4 x i8*>

In the case (2) we add the same offset to all pointers.

The case (1) covers C[B[i]] case, when we have the same base C and different offsets B[i].

The documentation is updated.

http://reviews.llvm.org/D10496

llvm-svn: 241788

9 years agoMake non-affine statement names isl compatible
Tobias Grosser [Thu, 9 Jul 2015 07:31:45 +0000 (07:31 +0000)]
Make non-affine statement names isl compatible

Named isl sets can generally have any name if they remain within Polly, but only
certain strings can be parsed by isl. The new names we create ensure that we
can always copy-past isl strings from Polly to other isl tools, e.g. for
debugging.

llvm-svn: 241787

9 years agoDriver: Include the driver arguments in crash reports
Justin Bogner [Thu, 9 Jul 2015 06:58:31 +0000 (06:58 +0000)]
Driver: Include the driver arguments in crash reports

Similarly to r231989, the driver arguments can be quite helpful in
diagnosing a crash.

llvm-svn: 241786

9 years ago[LAA] Fix line break in comment
Adam Nemet [Thu, 9 Jul 2015 06:47:21 +0000 (06:47 +0000)]
[LAA] Fix line break in comment

llvm-svn: 241785

9 years ago[LAA] Rename IsRTNeeded to IsRTCheckAnalysisNeeded
Adam Nemet [Thu, 9 Jul 2015 06:47:18 +0000 (06:47 +0000)]
[LAA] Rename IsRTNeeded to IsRTCheckAnalysisNeeded

The original name was too close to NeedRTCheck which is what the actual
memcheck analysis returns.  This flag, as the new name suggests, is only
used to whether to initiate that analysis.

Also a comment is added to answer one question I had about this code for
a long time.  Namely, how does this flag differ from
isDependencyCheckNeeded since they are seemingly set at the same time.

llvm-svn: 241784

9 years agollvm-readobj: Fix an unused variable after r241764
Justin Bogner [Thu, 9 Jul 2015 04:27:36 +0000 (04:27 +0000)]
llvm-readobj: Fix an unused variable after r241764

llvm-svn: 241783

9 years agoRevert r241770 and add Basic to the dependencies of clang-check instead.
Adrian Prantl [Thu, 9 Jul 2015 02:53:05 +0000 (02:53 +0000)]
Revert r241770 and add Basic to the dependencies of clang-check instead.
PR24067.

llvm-svn: 241782

9 years agoTemporarily reverting 241765, 241768, and 241772 to unbreak the build bots.
Adrian Prantl [Thu, 9 Jul 2015 02:14:49 +0000 (02:14 +0000)]
Temporarily reverting 241765, 241768, and 241772 to unbreak the build bots.

llvm-svn: 241781

9 years agoRemove getDataLayout() from TargetSelectionDAGInfo (had no users)
Mehdi Amini [Thu, 9 Jul 2015 02:10:08 +0000 (02:10 +0000)]
Remove getDataLayout() from TargetSelectionDAGInfo (had no users)

Summary:
Remove empty subclass in the process.

This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: jholewinski, llvm-commits, rafael, yaron.keren, ted

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

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

9 years agoRemove getDataLayout() from TargetLowering
Mehdi Amini [Thu, 9 Jul 2015 02:09:52 +0000 (02:09 +0000)]
Remove getDataLayout() from TargetLowering

Summary:
This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: yaron.keren, rafael, llvm-commits, jholewinski

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

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

9 years agoMake isLegalAddressingMode() taking DataLayout as an argument
Mehdi Amini [Thu, 9 Jul 2015 02:09:40 +0000 (02:09 +0000)]
Make isLegalAddressingMode() taking DataLayout as an argument

Summary:
This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: jholewinski, llvm-commits, rafael, yaron.keren

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

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

9 years agoMake getByValTypeAlignment() taking DataLayout as an argument
Mehdi Amini [Thu, 9 Jul 2015 02:09:28 +0000 (02:09 +0000)]
Make getByValTypeAlignment() taking DataLayout as an argument

Summary:
This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: yaron.keren, rafael, llvm-commits, jholewinski

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

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

9 years agoMake TargetLowering::getShiftAmountTy() taking DataLayout as an argument
Mehdi Amini [Thu, 9 Jul 2015 02:09:20 +0000 (02:09 +0000)]
Make TargetLowering::getShiftAmountTy() taking DataLayout as an argument

Summary:
This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: jholewinski, llvm-commits, rafael, yaron.keren

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

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

9 years agoMake TargetLowering::getPointerTy() taking DataLayout as an argument
Mehdi Amini [Thu, 9 Jul 2015 02:09:04 +0000 (02:09 +0000)]
Make TargetLowering::getPointerTy() taking DataLayout as an argument

Summary:
This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: jholewinski, ted, yaron.keren, rafael, llvm-commits

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

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

9 years agoMake TargetTransformInfo keeping a reference to the Module DataLayout
Mehdi Amini [Thu, 9 Jul 2015 02:08:42 +0000 (02:08 +0000)]
Make TargetTransformInfo keeping a reference to the Module DataLayout

DataLayout is no longer optional. It was initialized with or without
a DataLayout, and the DataLayout when supplied could have been the
one from the TargetMachine.

Summary:
This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: jholewinski, llvm-commits, rafael, yaron.keren

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

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

9 years agoRedirect DataLayout from TargetMachine to Module in ComputeValueVTs()
Mehdi Amini [Thu, 9 Jul 2015 01:57:34 +0000 (01:57 +0000)]
Redirect DataLayout from TargetMachine to Module in ComputeValueVTs()

Summary:
Avoid using the TargetMachine owned DataLayout and use the Module owned
one instead. This requires passing the DataLayout up the stack to
ComputeValueVTs().

This change is part of a series of commits dedicated to have a single
DataLayout during compilation by using always the one owned by the
module.

Reviewers: echristo

Subscribers: jholewinski, yaron.keren, rafael, llvm-commits

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

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

9 years agoSilence a warning, trying to unbreak the build after r241765.
Davide Italiano [Thu, 9 Jul 2015 01:45:02 +0000 (01:45 +0000)]
Silence a warning, trying to unbreak the build after r241765.

llvm-svn: 241772

9 years agoCOFF: Fix import thunks and name mangling for x86.
Rui Ueyama [Thu, 9 Jul 2015 01:25:49 +0000 (01:25 +0000)]
COFF: Fix import thunks and name mangling for x86.

With this patch, LLD is now able to correctly link a "hello world"
program written in assembly for 32-bit x86.

llvm-svn: 241771

9 years agoMove the definition of ~PCHContainerOperations from Basic into Frontend.
Adrian Prantl [Thu, 9 Jul 2015 01:01:52 +0000 (01:01 +0000)]
Move the definition of ~PCHContainerOperations from Basic into Frontend.

Fixes PR24067.

llvm-svn: 241770

9 years agoFix typename issues.
Michael J. Spencer [Thu, 9 Jul 2015 00:46:24 +0000 (00:46 +0000)]
Fix typename issues.

llvm-svn: 241768

9 years agoCOFF: Support 32-bit x86 DLL import table.
Rui Ueyama [Thu, 9 Jul 2015 00:45:50 +0000 (00:45 +0000)]
COFF: Support 32-bit x86 DLL import table.

llvm-svn: 241767

9 years ago[Object][ELF] Support dumping hash-tables from files with no section table.
Michael J. Spencer [Thu, 9 Jul 2015 00:21:06 +0000 (00:21 +0000)]
[Object][ELF] Support dumping hash-tables from files with no section table.

llvm-svn: 241765

9 years ago[CodeView] Add support for emitting column information
David Majnemer [Thu, 9 Jul 2015 00:19:51 +0000 (00:19 +0000)]
[CodeView] Add support for emitting column information

Column information is present in CodeView when the line table subsection
has bit 0 set to 1 in it's flags field.  The column information is
represented as a pair of 16-bit quantities: a starting and ending
column.  This information is present at the end of the chunk, after all
the line-PC pairs.

llvm-svn: 241764

9 years ago[LAA] Fix misleading use of word 'consecutive'
Adam Nemet [Thu, 9 Jul 2015 00:03:22 +0000 (00:03 +0000)]
[LAA] Fix misleading use of word 'consecutive'

Fix some places where the word consecutive is used but the code really
means constant-stride (i.e. not just unit stride).

llvm-svn: 241763