platform/upstream/llvm.git
9 years agoAdd missing builtins to altivec.h for ABI compliance (vol. 3)
Nemanja Ivanovic [Fri, 10 Jul 2015 13:11:34 +0000 (13:11 +0000)]
Add missing builtins to altivec.h for ABI compliance (vol. 3)

This patch corresponds to review:
http://reviews.llvm.org/D10972

Fix for the handling of dependent features that are enabled by default
on some CPU's (such as -mvsx, -mpower8-vector).

Also provides a number of new interfaces or fixes existing ones in
altivec.h.

Changed signatures to conform to ABI:
vector short vec_perm(vector signed short, vector signed short, vector unsigned char)
vector int vec_perm(vector signed int, vector signed int, vector unsigned char)
vector long long vec_perm(vector signed long long, vector signed long long, vector unsigned char)
vector signed char vec_sld(vector signed char, vector signed char, const int)
vector unsigned char vec_sld(vector unsigned char, vector unsigned char, const int)
vector bool char vec_sld(vector bool char, vector bool char, const int)
vector unsigned short vec_sld(vector unsigned short, vector unsigned short, const int)
vector signed short vec_sld(vector signed short, vector signed short, const int)
vector signed int vec_sld(vector signed int, vector signed int, const int)
vector unsigned int vec_sld(vector unsigned int, vector unsigned int, const int)
vector float vec_sld(vector float, vector float, const int)
vector signed char vec_splat(vector signed char, const int)
vector unsigned char vec_splat(vector unsigned char, const int)
vector bool char vec_splat(vector bool char, const int)
vector signed short vec_splat(vector signed short, const int)
vector unsigned short vec_splat(vector unsigned short, const int)
vector bool short vec_splat(vector bool short, const int)
vector pixel vec_splat(vector pixel, const int)
vector signed int vec_splat(vector signed int, const int)
vector unsigned int vec_splat(vector unsigned int, const int)
vector bool int vec_splat(vector bool int, const int)
vector float vec_splat(vector float, const int)

Added a VSX path to:
vector float vec_round(vector float)

Added interfaces:
vector signed char vec_eqv(vector signed char, vector signed char)
vector signed char vec_eqv(vector bool char, vector signed char)
vector signed char vec_eqv(vector signed char, vector bool char)
vector unsigned char vec_eqv(vector unsigned char, vector unsigned char)
vector unsigned char vec_eqv(vector bool char, vector unsigned char)
vector unsigned char vec_eqv(vector unsigned char, vector bool char)
vector signed short vec_eqv(vector signed short, vector signed short)
vector signed short vec_eqv(vector bool short, vector signed short)
vector signed short vec_eqv(vector signed short, vector bool short)
vector unsigned short vec_eqv(vector unsigned short, vector unsigned short)
vector unsigned short vec_eqv(vector bool short, vector unsigned short)
vector unsigned short vec_eqv(vector unsigned short, vector bool short)
vector signed int vec_eqv(vector signed int, vector signed int)
vector signed int vec_eqv(vector bool int, vector signed int)
vector signed int vec_eqv(vector signed int, vector bool int)
vector unsigned int vec_eqv(vector unsigned int, vector unsigned int)
vector unsigned int vec_eqv(vector bool int, vector unsigned int)
vector unsigned int vec_eqv(vector unsigned int, vector bool int)
vector signed long long vec_eqv(vector signed long long, vector signed long long)
vector signed long long vec_eqv(vector bool long long, vector signed long long)
vector signed long long vec_eqv(vector signed long long, vector bool long long)
vector unsigned long long vec_eqv(vector unsigned long long, vector unsigned long long)
vector unsigned long long vec_eqv(vector bool long long, vector unsigned long long)
vector unsigned long long vec_eqv(vector unsigned long long, vector bool long long)
vector float vec_eqv(vector float, vector float)
vector float vec_eqv(vector bool int, vector float)
vector float vec_eqv(vector float, vector bool int)
vector double vec_eqv(vector double, vector double)
vector double vec_eqv(vector bool long long, vector double)
vector double vec_eqv(vector double, vector bool long long)
vector bool long long vec_perm(vector bool long long, vector bool long long, vector unsigned char)
vector double vec_round(vector double)
vector double vec_splat(vector double, const int)
vector bool long long vec_splat(vector bool long long, const int)
vector signed long long vec_splat(vector signed long long, const int)
vector unsigned long long vec_splat(vector unsigned long long,
vector bool int vec_sld(vector bool int, vector bool int, const int)
vector bool short vec_sld(vector bool short, vector bool short, const int)

llvm-svn: 241904

9 years agoTweak a couple of -fprofile tests in clang/test to accept backslash in path.
NAKAMURA Takumi [Fri, 10 Jul 2015 13:11:08 +0000 (13:11 +0000)]
Tweak a couple of -fprofile tests in clang/test to accept backslash in path.

llvm-svn: 241903

9 years agoTry to fix the test harder, it still fails on windows for unknown reasons.
Benjamin Kramer [Fri, 10 Jul 2015 13:04:41 +0000 (13:04 +0000)]
Try to fix the test harder, it still fails on windows for unknown reasons.

llvm-svn: 241902

9 years agoAdd support for fast-math flags to the FCmp instruction.
James Molloy [Fri, 10 Jul 2015 12:52:00 +0000 (12:52 +0000)]
Add support for fast-math flags to the FCmp instruction.

FCmp behaves a lot like a floating-point binary operator in many ways,
and can benefit from fast-math information. Flags such as nsz and nnan
can affect if this fcmp (in combination with a select) can be treated
as a fminnum/fmaxnum operation.

This adds backwards-compatible bitcode support, IR parsing and writing,
LangRef changes and IRBuilder changes. I'll need to audit InstSimplify
and InstCombine in a followup to find places where flags should be
copied.

llvm-svn: 241901

9 years agoAdd missing builtins to the PPC back end for ABI compliance (vol. 3)
Nemanja Ivanovic [Fri, 10 Jul 2015 12:38:08 +0000 (12:38 +0000)]
Add missing builtins to the PPC back end for ABI compliance (vol. 3)

This patch corresponds to review:
http://reviews.llvm.org/D10973

Back end portion of the third round of additions to altivec.h.

llvm-svn: 241900

9 years agoReapply test for r241811 with a fix for msvc compat mode.
Benjamin Kramer [Fri, 10 Jul 2015 11:37:54 +0000 (11:37 +0000)]
Reapply test for r241811 with a fix for msvc compat mode.

Delayed template parsing interferes with code completion, just distable it for
this test. This reverts r241811.

llvm-svn: 241899

9 years agoRespect alignment when loading up a coerced function argument
Ulrich Weigand [Fri, 10 Jul 2015 11:31:43 +0000 (11:31 +0000)]
Respect alignment when loading up a coerced function argument

Code in CGCall.cpp that loads up function arguments that need to be
coerced to a different type may in some cases ignore the fact that
the source of the argument is not naturally aligned. This may cause
incorrect code to be generated. In some places in CreateCoercedLoad,
we already have setAlignment calls to address this, but I ran into one
where it was missing, causing wrong code generation on SystemZ.

However, in that location, we do not actually know what alignment of
the source location we can rely on; the callers do not pass anything
to this routine. This is already an issue in other places in
CreateCoercedLoad; and the same problem exists for CreateCoercedStore.

To avoid pessimising code, and to fix the FIXMEs already in place,
this patch also adds an alignment argument to the CreateCoerced*
routines and uses it instead of forcing an alignment of 1. The
callers are changed to pass in the best information they have.

This actually requires changes in a number of existing test cases
since we now get better alignment in many places.

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

llvm-svn: 241898

9 years agoDisable loop re-rotation for -Oz (patch by Andrey Turetsky)
Alexey Bataev [Fri, 10 Jul 2015 10:37:09 +0000 (10:37 +0000)]
Disable loop re-rotation for -Oz (patch by Andrey Turetsky)

After changes in rL231820 loop re-rotation is performed even in -Oz mode. Since loop rotation is disabled for -Oz, it seems loop re-rotation should be disabled too.
Differential Revision: http://reviews.llvm.org/D10961

llvm-svn: 241897

9 years ago[llvm-stress] Enhance scalar type selection from command line.
Pawel Bylica [Fri, 10 Jul 2015 10:01:47 +0000 (10:01 +0000)]
[llvm-stress] Enhance scalar type selection from command line.

llvm-stress command line options like -generate-x86-fp80 has been replaced with one list-like option -types. E.g. llvm-stress -types=x86_fp80,i100,i256,half. Default types (i1, i8, i16, i32, i64, float, double) are always added at the beginning of that list.

Reviewers: hfinkel

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

llvm-svn: 241896

9 years agollvm/Object/ELF.h: Appease g++-4.7.2.
NAKAMURA Takumi [Fri, 10 Jul 2015 08:43:41 +0000 (08:43 +0000)]
llvm/Object/ELF.h: Appease g++-4.7.2.

llvm-svn: 241895

9 years agoRe-use a single SmallString instance to reduce the stack frame size
Daniel Jasper [Fri, 10 Jul 2015 08:25:54 +0000 (08:25 +0000)]
Re-use a single SmallString instance to reduce the stack frame size

In certain builds (msan), this can otherwise exceed the stack frame
limit set for certain environments.

llvm-svn: 241894

9 years agoRevert the new EH instructions
David Majnemer [Fri, 10 Jul 2015 07:15:17 +0000 (07:15 +0000)]
Revert the new EH instructions

This reverts commits r241888-r241891, I didn't mean to commit them.

llvm-svn: 241893

9 years agoAdd missing 'const'. I don't think this is strictly required, but some
Daniel Jasper [Fri, 10 Jul 2015 07:09:20 +0000 (07:09 +0000)]
Add missing 'const'. I don't think this is strictly required, but some
compiler configuration is giving me an error and it seems to be
recommended anyway.

llvm-svn: 241892

9 years agoTighten the verifier check for catchblock.
David Majnemer [Fri, 10 Jul 2015 07:01:07 +0000 (07:01 +0000)]
Tighten the verifier check for catchblock.

llvm-svn: 241891

9 years agoAddress Joseph's review comments.
David Majnemer [Fri, 10 Jul 2015 07:01:03 +0000 (07:01 +0000)]
Address Joseph's review comments.

llvm-svn: 241890

9 years agoAddress Reid's review feedback.
David Majnemer [Fri, 10 Jul 2015 07:00:58 +0000 (07:00 +0000)]
Address Reid's review feedback.

llvm-svn: 241889

9 years agoNew EH representation for MSVC compatibility
David Majnemer [Fri, 10 Jul 2015 07:00:44 +0000 (07:00 +0000)]
New EH representation for MSVC compatibility

Summary:
This introduces new instructions neccessary to implement MSVC-compatible
exception handling support.  Most of the middle-end and none of the
back-end haven't been audited or updated to take them into account.

Reviewers: rnk, JosephTremoulet, reames, nlewycky, rjmccall

Subscribers: llvm-commits

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

llvm-svn: 241888

9 years ago[InstCombine] Employ AliasAnalysis in FindAvailableLoadedValue
Bjorn Steinbrink [Fri, 10 Jul 2015 06:55:49 +0000 (06:55 +0000)]
[InstCombine] Employ AliasAnalysis in FindAvailableLoadedValue

llvm-svn: 241887

9 years ago[InstCombine] Properly combine metadata when replacing a load with another
Bjorn Steinbrink [Fri, 10 Jul 2015 06:55:44 +0000 (06:55 +0000)]
[InstCombine] Properly combine metadata when replacing a load with another

Not doing this can lead to misoptimizations down the line, e.g. because
of range metadata on the replacing load excluding values that are valid
for the load that is being replaced.

llvm-svn: 241886

9 years agoRemove test that tests referring to the current working directory. You
Daniel Jasper [Fri, 10 Jul 2015 05:57:23 +0000 (05:57 +0000)]
Remove test that tests referring to the current working directory. You
cannot assume that the current working directory is writable in all test
environments. I don't know a better way to write this test of hand, lets
discuss. Possibly, a better option would be to put these together with
other test testing the driver directly.

llvm-svn: 241885

9 years ago[NVPTX] declare no vector registers
Jingyue Wu [Fri, 10 Jul 2015 04:31:56 +0000 (04:31 +0000)]
[NVPTX] declare no vector registers

Summary:
Without this patch, LoopVectorizer in certain cases (see loop-vectorize.ll)
produces code with complex control flow which hurts later optimizations. Since
NVPTX doesn't have vector registers in LLVM's sense
(NVPTXTTI::getRegisterBitWidth(true) == 32), we for now declare no vector
registers to effectively disable loop vectorization.

Reviewers: jholewinski

Subscribers: jingyue, llvm-commits, jholewinski

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

llvm-svn: 241884

9 years agoCOFF: Fix locally-imported symbol's base relocations.
Rui Ueyama [Fri, 10 Jul 2015 04:30:54 +0000 (04:30 +0000)]
COFF: Fix locally-imported symbol's base relocations.

Base relocations are RVA and not VA, so we shouldn't add ImageBase.

llvm-svn: 241883

9 years agoRevert test lines added in r241811, "[CodeCompletion] Don't crash on member inits...
NAKAMURA Takumi [Fri, 10 Jul 2015 03:09:19 +0000 (03:09 +0000)]
Revert test lines added in r241811, "[CodeCompletion] Don't crash on member inits of templated constructors.", for now.

It doesn't pass for targeting MS mode.

llvm-svn: 241882

9 years agoDriver: Make all of -f{,no-}sanitize{,-recover,-trap} core options.
Peter Collingbourne [Fri, 10 Jul 2015 02:17:22 +0000 (02:17 +0000)]
Driver: Make all of -f{,no-}sanitize{,-recover,-trap} core options.

This allows them to be used from clang-cl.

llvm-svn: 241881

9 years agoAdded mechanism to modularize for doing a compilation precheck
John Thompson [Fri, 10 Jul 2015 00:37:25 +0000 (00:37 +0000)]
Added mechanism to modularize for doing a compilation precheck
to determine files that have comnpilation or dependency problems.
A new -display-file-lists option use this to display lists of good files
(no compile errors), problem files, and a combined list with
problem files preceded by a '#'.  The problem files list can be
used in the module map generation assistant mode to exclude
problem files.  The combined files list can be used during module
map development.  See added docs.

llvm-svn: 241880

9 years agoDon't let a test fail because of a teardown command returning an error. Use a functio...
Greg Clayton [Fri, 10 Jul 2015 00:30:22 +0000 (00:30 +0000)]
Don't let a test fail because of a teardown command returning an error. Use a function that doesn't check the return value.

llvm-svn: 241879

9 years agoRe-enable 32-bit SEH after the alignment fix
Reid Kleckner [Fri, 10 Jul 2015 00:16:25 +0000 (00:16 +0000)]
Re-enable 32-bit SEH after the alignment fix

llvm-svn: 241878

9 years ago[WinEH] Make sure LSDA tables are 4 byte aligned
Reid Kleckner [Fri, 10 Jul 2015 00:08:49 +0000 (00:08 +0000)]
[WinEH] Make sure LSDA tables are 4 byte aligned

Apparently this is important, otherwise _except_handler3 assumes that
the registration node is corrupted and ignores it.

Also fix a bug in WinEHPrepare where we would insert code after a
terminator instruction.

llvm-svn: 241877

9 years ago[TSan] Fix dl_iterate_phdr callback for the case when info->dlpi_name is overwritten...
Alexey Samsonov [Fri, 10 Jul 2015 00:03:54 +0000 (00:03 +0000)]
[TSan] Fix dl_iterate_phdr callback for the case when info->dlpi_name is overwritten by user.

llvm-svn: 241876

9 years agoReplace index-loops by range-based loops
Eli Bendersky [Thu, 9 Jul 2015 23:06:03 +0000 (23:06 +0000)]
Replace index-loops by range-based loops

NFC

llvm-svn: 241875

9 years agoCOFF: Find C++ mangled name for symbols starting with underscore.
Rui Ueyama [Thu, 9 Jul 2015 23:03:51 +0000 (23:03 +0000)]
COFF: Find C++ mangled name for symbols starting with underscore.

Symbol foo is mangled as _foo in C and ?foo@@... in C++ on x86.
findMangle has to remove prefix underscore before mangle a given name
as a C++ symbol.

llvm-svn: 241874

9 years ago[x86] enable machine combiner reassociations for scalar double-precision multiplies
Sanjay Patel [Thu, 9 Jul 2015 22:58:39 +0000 (22:58 +0000)]
[x86] enable machine combiner reassociations for scalar double-precision multiplies

llvm-svn: 241873

9 years agoCOFF: Fix dllexported symbol names on x86.
Rui Ueyama [Thu, 9 Jul 2015 22:51:41 +0000 (22:51 +0000)]
COFF: Fix dllexported symbol names on x86.

Symbol names are usually mangled by appending "_" prefix on x86.
But the mangled name is not used in DLL export table. The export
table contains unmangled names.

llvm-svn: 241872

9 years ago[x86] enable machine combiner reassociations for scalar double-precision adds
Sanjay Patel [Thu, 9 Jul 2015 22:48:54 +0000 (22:48 +0000)]
[x86] enable machine combiner reassociations for scalar double-precision adds

llvm-svn: 241871

9 years agoFix shadowing.
Michael J. Spencer [Thu, 9 Jul 2015 22:42:21 +0000 (22:42 +0000)]
Fix shadowing.

llvm-svn: 241870

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