oota-llvm.git
9 years ago[ShrinkWrap] Fix a typo in a comment.
Quentin Colombet [Thu, 12 Nov 2015 18:16:27 +0000 (18:16 +0000)]
[ShrinkWrap] Fix a typo in a comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252918 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ShrinkWrap] Make sure we do not mess up with EH funclet lowering.
Quentin Colombet [Thu, 12 Nov 2015 18:13:42 +0000 (18:13 +0000)]
[ShrinkWrap] Make sure we do not mess up with EH funclet lowering.
ShrinkWrapping does not understand exception handling constraints for now, so
make sure we do not mess with them by aborting on functions that use EH
funclets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252917 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[llvm-profdata] Add check for text profile formats and improve error reporting
Nathan Slingerland [Thu, 12 Nov 2015 18:06:18 +0000 (18:06 +0000)]
[llvm-profdata] Add check for text profile formats and improve error reporting

Summary:
This change addresses two possible instances of user error / confusion when
merging sampled profile data.

Previously any input that didn't match the raw or processed instrumented format
would automatically be interpreted as instrumented profile text format data.
No error would be reported during the merge.

Example:
If foo-sampled.profdata and bar-sampled.profdata are binary sampled profiles:

Old behavior:
$ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -output foobar-sampled.profdata
$ llvm-profdata show -sample foobar-sampled.profdata
error: foobar-sampled.profdata:1: Expected 'mangled_name:NUM:NUM', found  lprofi

This change adds basic checks for valid input data when assuming text input.
It also makes error messages related to file format validity more specific about
the assumbed profile data type.

New behavior:
$ llvm-profdata merge foo-sampled.profdata bar-sampled.profdata -o foobar-sampled.profdata
error: foo.profdata: Unrecognized instrumentation profile encoding format
Perhaps you forgot to use the -sample option?

Reviewers: bogner, davidxl, dnovillo

Subscribers: davidxl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252916 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSamplePGO - Move FunctionSamples::print() to a better location. NFC.
Diego Novillo [Thu, 12 Nov 2015 17:58:14 +0000 (17:58 +0000)]
SamplePGO - Move FunctionSamples::print() to a better location. NFC.

The class is declared in SampleProf.h, so a better home for this is
SampleProf.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252915 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEH] Fix problem with removing an element from a SetVector while iterating.
Andrew Kaylor [Thu, 12 Nov 2015 17:36:03 +0000 (17:36 +0000)]
[WinEH] Fix problem with removing an element from a SetVector while iterating.

Patch provided by Yaron Keren. (Thanks!)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252913 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoComment update. NFC.
Rafael Espindola [Thu, 12 Nov 2015 17:13:45 +0000 (17:13 +0000)]
Comment update. NFC.

Fix the library name.
Don't duplicate the comment in the .cpp file.
Don't repeat the name in the comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252911 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WebAssembly] Reapply r252858, with svn add for the new file.
Dan Gohman [Thu, 12 Nov 2015 17:04:33 +0000 (17:04 +0000)]
[WebAssembly] Reapply r252858, with svn add for the new file.

Switch to MC for instruction printing.

This encompasses several changes which are all interconnected:
 - Use the MC framework for printing almost all instructions.
 - AsmStrings are now live.
 - This introduces an indirection between LLVM vregs and WebAssembly registers,
   and a new pass, WebAssemblyRegNumbering, for computing a basic the mapping.
   This addresses some basic issues with argument registers and unused registers.
 - The way ARGUMENT instructions are handled no longer generates redundant
   get_local+set_local for every argument.

This also changes the assembly syntax somewhat; most notably, MC's printing
does not use sigils on label names, so those are no longer present, and
push/pop now have a sigil to keep them unambiguous.

The usage of set_local/get_local/$push/$pop will continue to evolve
significantly. This patch is just one step of a larger change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252910 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[x86] translating "fp" (floating point) instructions from {fadd,fdiv,fmul,fsub,fsubr...
Michael Zuckerman [Thu, 12 Nov 2015 16:58:51 +0000 (16:58 +0000)]
[x86] translating "fp" (floating point) instructions from {fadd,fdiv,fmul,fsub,fsubr,fdivr} to {faddp,fdivp,fmulp,fsubp,fsubrp,fdivrp}

LLVM Missing the following instructions: fadd\fdiv\fmul\fsub\fsubr\fdivr.
GAS and MS supporting this instruction and lowering them in to a faddp\fdivp\fmulp\fsubp\fsubrp\fdivrp instructions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252908 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCull non-standard variants of ARM architectures (NFC)
Artyom Skrobov [Thu, 12 Nov 2015 15:51:41 +0000 (15:51 +0000)]
Cull non-standard variants of ARM architectures (NFC)

Summary:
This patch changes ARMV5, ARMV5E, ARMV6SM, ARMV6HL, ARMV7, ARMV7L,
ARMV7HL, ARMV7EM to be treated as aliases for the corresponding
standard architectures, instead of as actual architectures.

Reviewers: rengolin

Subscribers: aemerson, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252903 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert r252858: "[WebAssembly] Switch to MC for instruction printing."
Hans Wennborg [Thu, 12 Nov 2015 14:37:56 +0000 (14:37 +0000)]
Revert r252858: "[WebAssembly] Switch to MC for instruction printing."

It broke the CMake build:

"Cannot find source file: WebAssemblyRegNumbering.cpp"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252897 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRe-apply "[mips] Use correct frame register for DWARF info when dynamically realignin...
Vasileios Kalintiris [Thu, 12 Nov 2015 14:11:43 +0000 (14:11 +0000)]
Re-apply "[mips] Use correct frame register for DWARF info when dynamically realigning the stack.""

r252219 reversed the direction of subprogram -> function edge. Fixed the
IR to account for this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252895 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ARM] CMOV->BFI combining: handle both senses of CMPZ
James Molloy [Thu, 12 Nov 2015 13:49:17 +0000 (13:49 +0000)]
[ARM] CMOV->BFI combining: handle both senses of CMPZ

I completely misunderstood what ARMISD::CMPZ means. It's not "compare equal to zero", it's "compare, only setting the zero/Z flag". It can either be equal-to-zero or not-equal-to-zero, and we weren't checking what sense it was.

If it's equal-to-zero, we can swap the operands around and pretend like it is not-equal-to-zero, which is both a bug fix and lets us handle more cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252891 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "[ARM] Enable shrink-wrapping by default."
Renato Golin [Thu, 12 Nov 2015 13:34:50 +0000 (13:34 +0000)]
Revert "[ARM] Enable shrink-wrapping by default."

This reverts commit r252825, as it broke ASAN on ARM. Investigating...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252889 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoImplement .reloc (constant offset only) with support for R_MIPS_NONE and R_MIPS_32.
Daniel Sanders [Thu, 12 Nov 2015 13:33:00 +0000 (13:33 +0000)]
Implement .reloc (constant offset only) with support for R_MIPS_NONE and R_MIPS_32.

Summary:
Support for R_MIPS_NONE allows us to parse MIPS16's usage of .reloc.
R_MIPS_32 was included to be able to better test the directive.

Targets can add their relocations by overriding MCAsmBackend::getFixupKind().

Subscribers: grosbach, rafael, majnemer, dsanders, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252888 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips][microMIPS] Implement LWM16, SB16, SH16, SW16, SWSP and SWM16 instructions
Zlatko Buljan [Thu, 12 Nov 2015 13:21:33 +0000 (13:21 +0000)]
[mips][microMIPS] Implement LWM16, SB16, SH16, SW16, SWSP and SWM16 instructions
Differential Revision: http://reviews.llvm.org/D11406

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252885 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "[mips] Use correct frame register for DWARF info when dynamically realigning...
Vasileios Kalintiris [Thu, 12 Nov 2015 13:19:11 +0000 (13:19 +0000)]
Revert "[mips] Use correct frame register for DWARF info when dynamically realigning the stack."

This reverts commit r252882. LLParser complains for invalid field 'function'
in DISubprogram.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252884 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove mention of {ADD,SUB}_PARTS. They were removed in r26255.
Hans Wennborg [Thu, 12 Nov 2015 13:18:20 +0000 (13:18 +0000)]
Remove mention of {ADD,SUB}_PARTS. They were removed in r26255.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252883 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips] Use correct frame register for DWARF info when dynamically realigning the...
Vasileios Kalintiris [Thu, 12 Nov 2015 13:04:16 +0000 (13:04 +0000)]
[mips] Use correct frame register for DWARF info when dynamically realigning the stack.

Summary:
This patch overrides TargetFrameLowering::getFrameIndexReference() in order to
specify the correct register when the function needs dynamic stack realignment.
The values returned from this function are used in order to create DW_AT_locations
for DWARF info. These locations would use the wrong registers as it's been
reported in PR25028.

Reviewers: dsanders

Subscribers: dean, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252882 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[InstCombine] Add trivial folding (bitreverse (bitreverse x)) -> x
James Molloy [Thu, 12 Nov 2015 12:39:41 +0000 (12:39 +0000)]
[InstCombine] Add trivial folding (bitreverse (bitreverse x)) -> x

There are plenty more instcombines we could probably do with bitreverse, but this seems like a very obvious and trivial starting point and was brought up by Hal in his review.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252879 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SDAG] Introduce a new BITREVERSE node along with a corresponding LLVM intrinsic
James Molloy [Thu, 12 Nov 2015 12:29:09 +0000 (12:29 +0000)]
[SDAG] Introduce a new BITREVERSE node along with a corresponding LLVM intrinsic

Several backends have instructions to reverse the order of bits in an integer. Conceptually matching such patterns is similar to @llvm.bswap, and it was mentioned in http://reviews.llvm.org/D14234 that it would be best if these patterns were matched in InstCombine instead of reimplemented in every different target.

This patch introduces an intrinsic @llvm.bitreverse.i* that operates similarly to @llvm.bswap. For plumbing purposes there is also a new ISD node ISD::BITREVERSE, with simple expansion and promotion support.

The intention is that InstCombine's BSWAP detection logic will be extended to support BITREVERSE too, and @llvm.bitreverse intrinsics emitted (if the backend supports lowering it efficiently).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252878 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Revert "[FunctionAttrs] Identify norecurse functions""
James Molloy [Thu, 12 Nov 2015 10:55:20 +0000 (10:55 +0000)]
Revert "Revert "[FunctionAttrs] Identify norecurse functions""

This reapplies this patch, with test fixes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252871 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Object, MachO] Mark symbols from DATA and BSS sections as ST_Data
Kuba Brecka [Thu, 12 Nov 2015 09:40:29 +0000 (09:40 +0000)]
[Object, MachO] Mark symbols from DATA and BSS sections as ST_Data

In `MachOObjectFile::getSymbolType` we currently always return `SymbolRef::ST_Function` for symbols from any section. In order for llvm-symbolizer to correctly symbolize Mach-O globals, symbols from data and BSS sections should return `SymbolRef::ST_Data`.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252867 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agodwarfdump: Added macro support to llvm-dwarfdump tool.
Amjad Aboud [Thu, 12 Nov 2015 09:38:54 +0000 (09:38 +0000)]
dwarfdump: Added macro support to llvm-dwarfdump tool.

Added "macro" option to "-debug-dump" flag, which trigger parsing and dumping of the ".debug_macinfo" section.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252866 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd AVR backend skeleton
Dylan McKay [Thu, 12 Nov 2015 09:26:44 +0000 (09:26 +0000)]
Add AVR backend skeleton

This adds part of the target info code, and adds modifications to
the build scripts so that AVR is recognized a supported, experimental
backend.

It does not include any AVR-specific code, just the bare sources required
for a backend to exist.

From D14039.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252865 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "[FunctionAttrs] Identify norecurse functions"
James Molloy [Thu, 12 Nov 2015 09:05:43 +0000 (09:05 +0000)]
Revert "[FunctionAttrs] Identify norecurse functions"

This reverts commit r252862. This introduced test failures and I'm reverting while I investigate how this happened.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252863 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[FunctionAttrs] Identify norecurse functions
James Molloy [Thu, 12 Nov 2015 08:53:04 +0000 (08:53 +0000)]
[FunctionAttrs] Identify norecurse functions

A function can be marked as norecurse if:
  * The SCC to which it belongs has cardinality 1; and either
    a) It does not call any non-norecurse function. This includes self-recursion; or
    b) It only has one callsite and the function that callsite is within is marked norecurse.

a) is best propagated bottom-up and b) is best propagated top-down.

We build up the norecurse attributes bottom-up using the existing SCC pass, and mark functions with no obvious recursion (but not provably norecurse) to sweep later, top-down.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252862 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMostly revert 252842 due to failures on some buildbots.
David Blaikie [Thu, 12 Nov 2015 06:33:14 +0000 (06:33 +0000)]
Mostly revert 252842 due to failures on some buildbots.

I imagine there's some UB in here somewhere, though Valgrind doesn't
seem to have picked it up (not sure if I have a working asan build right
now to test there).

GDB bot seems to be crashing:
http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/26267/steps/check-all/logs/FAIL%3A%20LLVM%3A%3Adwarfdump-dwp.test

Hexagon ELF bot is, presumably, just getting different output:
http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/32927/steps/check-all/logs/FAIL%3A%20LLVM%3A%3Adwarfdump-dwp.test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252859 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WebAssembly] Switch to MC for instruction printing.
Dan Gohman [Thu, 12 Nov 2015 06:10:03 +0000 (06:10 +0000)]
[WebAssembly] Switch to MC for instruction printing.

This encompasses several changes which are all interconnected:
 - Use the MC framework for printing almost all instructions.
 - AsmStrings are now live.
 - This introduces an indirection between LLVM vregs and WebAssembly registers,
   and a new pass, WebAssemblyRegNumbering, for computing a basic the mapping.
   This addresses some basic issues with argument registers and unused registers.
 - The way ARGUMENT instructions are handled no longer generates redundant
   get_local+set_local for every argument.

This also changes the assembly syntax somewhat; most notably, MC's printing
use sigils on label names, so those are no longer present, and push/pop now
have a sigil to keep them unambiguous.

The usage of set_local/get_local/$push/$pop will continue to evolve
significantly. This patch is just one step of a larger change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252858 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agooutput_csv libfuzzer option
Mike Aizatsky [Thu, 12 Nov 2015 04:38:40 +0000 (04:38 +0000)]
output_csv libfuzzer option

Summary:
The option outputs statistics in CSV format preceded by 1 header line.
This is intended for machine processing of the output.
-verbosity=0 should likely be set.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252856 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agodwarfdump: Add error checking to fix the buildbots/correctness
David Blaikie [Thu, 12 Nov 2015 01:57:33 +0000 (01:57 +0000)]
dwarfdump: Add error checking to fix the buildbots/correctness

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252845 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agodwarfdump: Add some error handling for DWP index sections of the wrong size
David Blaikie [Thu, 12 Nov 2015 01:41:59 +0000 (01:41 +0000)]
dwarfdump: Add some error handling for DWP index sections of the wrong size

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252843 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agodwarfdump: Dump the contents of DWP indexes
David Blaikie [Thu, 12 Nov 2015 01:41:52 +0000 (01:41 +0000)]
dwarfdump: Dump the contents of DWP indexes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252842 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoLegalizeDAG: Fix and improve FCOPYSIGN/FABS legalization
Matthias Braun [Thu, 12 Nov 2015 01:02:47 +0000 (01:02 +0000)]
LegalizeDAG: Fix and improve FCOPYSIGN/FABS legalization

- Factor out code to query and modify the sign bit of a floatingpoint
  value as an integer. This also works if none of the targets integer
  types is big enough to hold all bits of the floatingpoint value.

- Legalize FABS(x) as FCOPYSIGN(x, 0.0) if FCOPYSIGN is available,
  otherwise perform bit manipulation on the sign bit. The previous code
  used "x >u 0 ? x : -x" which is incorrect for x being -0.0! It also
  takes 34 instructions on ARM Cortex-M4. With this patch we only
  require 5:
    vldr d0, LCPI0_0
    vmov r2, r3, d0
    lsrs r2, r3, #31
    bfi r1, r2, #31, #1
    bx lr
  (This could be further improved if the compiler would recognize that
   r2, r3 is zero).

- Only lower FCOPYSIGN(x, y) = sign(x) ? -FABS(x) : FABS(x) if FABS is
  available otherwise perform bit manipulation on the sign bit.

- Perform the sign(x) test by masking out the sign bit and comparing
  with 0 rather than shifting the sign bit to the highest position and
  testing for "<s 0". For x86 copysignl (on 80bit values) this gets us:
    testl $32768, %eax
  rather than:
    shlq $48, %rax
    sets %al
    testb %al, %al

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252839 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[libFuzzer] experimental flag -drill (another search heuristic; Mike Aizatsky's idea)
Kostya Serebryany [Thu, 12 Nov 2015 01:02:01 +0000 (01:02 +0000)]
[libFuzzer] experimental flag -drill (another search heuristic; Mike Aizatsky's idea)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252838 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[TLS on Darwin] use a different mask for tls calls on x86-64.
Manman Ren [Thu, 12 Nov 2015 00:54:04 +0000 (00:54 +0000)]
[TLS on Darwin] use a different mask for tls calls on x86-64.

Calls involved in thread-local variable lookup save more registers
than normal calls.

rdar://problem/23073171

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252837 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agodwarfdump: Use the right enum for the tu_index section
David Blaikie [Thu, 12 Nov 2015 00:44:35 +0000 (00:44 +0000)]
dwarfdump: Use the right enum for the tu_index section

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252835 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agodwarfdump: add command line support for dumping the tu_index section
David Blaikie [Thu, 12 Nov 2015 00:42:49 +0000 (00:42 +0000)]
dwarfdump: add command line support for dumping the tu_index section

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252830 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix problems in coding style
Xinliang David Li [Thu, 12 Nov 2015 00:32:17 +0000 (00:32 +0000)]
Fix problems in coding style

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252829 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ARM] Enable shrink-wrapping by default.
Quentin Colombet [Wed, 11 Nov 2015 23:31:46 +0000 (23:31 +0000)]
[ARM] Enable shrink-wrapping by default.

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

rdar://problem/21942589

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252825 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEH] Don't forward branches across empty EH pad BBs
Reid Kleckner [Wed, 11 Nov 2015 23:09:31 +0000 (23:09 +0000)]
[WinEH] Don't forward branches across empty EH pad BBs

For really simple SEH catchpads, we tried to forward the invoke unwind
edge across the empty block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252822 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[LIR] General refactor to improve compile-time and simplify code.
Chad Rosier [Wed, 11 Nov 2015 23:00:59 +0000 (23:00 +0000)]
[LIR] General refactor to improve compile-time and simplify code.

First create a list of candidates, then transform.  This simplifies the code in
that you have don't have to worry that you may be using an invalidated
iterator.

Previously, each time we created a memset/memcpy we would reevaluate the entire
loop potentially resulting in lots of redundant work for large basic blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252817 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix docs build break for revision r252798
Hemant Kulkarni [Wed, 11 Nov 2015 22:14:58 +0000 (22:14 +0000)]
Fix docs build break for revision r252798

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252812 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[IR] Add support for empty tokens
David Majnemer [Wed, 11 Nov 2015 21:57:16 +0000 (21:57 +0000)]
[IR] Add support for empty tokens

When working with tokens, it is often the case that one has instructions
which consume a token and produce a new token.  Currently, we have no
mechanism to represent an initial token state.

Instead, we can create a notional "empty token" by inventing a new
constant which captures the semantics we would like.  This new constant
is called ConstantTokenNone and is written textually as "token none".

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252811 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CMake] Fixing passthrough for variables starting with the sub-project name
Chris Bieneman [Wed, 11 Nov 2015 21:54:31 +0000 (21:54 +0000)]
[CMake] Fixing passthrough for variables starting with the sub-project name

This allows TEST_SUITE variables to be passed from the top-level CMake into the external project.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252810 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoIntroduce deoptimization operand bundles
Sanjoy Das [Wed, 11 Nov 2015 21:38:02 +0000 (21:38 +0000)]
Introduce deoptimization operand bundles

Summary:
This change introduces the notion of "deoptimization" operand bundles.
LLVM can recognize and optimize these in more precise ways than it can a
generic "unknown" operand bundles.

The current form of this special recognition / optimization is an enum
entry in LLVMContext, a LangRef blurb and a verifier rule.  Over time we
will teach LLVM to do more aggressive optimization around deoptimization
operand bundles, exploiting known facts about kinds of state
deoptimization operand bundles are allowed to track.

Reviewers: reames, majnemer, chandlerc, dexonsmith

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252806 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdding qualifier for make_unique.
Mike Aizatsky [Wed, 11 Nov 2015 21:28:40 +0000 (21:28 +0000)]
Adding qualifier for make_unique.

Summary: MSVC gets confused.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252804 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agosancov tool in c++
Mike Aizatsky [Wed, 11 Nov 2015 20:58:20 +0000 (20:58 +0000)]
sancov tool in c++

First batch of sancov.py rewrite in c++.
Supports "-print" and "-coveredfns" commands.

Followup to http://reviews.llvm.org/D14356 in a better location.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252801 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReport Windows error code in a fatal error after a system call.
Paul Robinson [Wed, 11 Nov 2015 20:49:32 +0000 (20:49 +0000)]
Report Windows error code in a fatal error after a system call.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252800 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agounique_ptrify the AllocValueProfData helper function introduced in r252783
David Blaikie [Wed, 11 Nov 2015 20:44:52 +0000 (20:44 +0000)]
unique_ptrify the AllocValueProfData helper function introduced in r252783

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252799 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Symbolizer]: Add -pretty-print option
Hemant Kulkarni [Wed, 11 Nov 2015 20:41:43 +0000 (20:41 +0000)]
[Symbolizer]: Add -pretty-print option

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252798 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMove the enum attributes defined in Attributes.h to a table-gen file.
Akira Hatanaka [Wed, 11 Nov 2015 20:35:42 +0000 (20:35 +0000)]
Move the enum attributes defined in Attributes.h to a table-gen file.

This is a step towards consolidating some of the information regarding
attributes in a single place.

This patch moves the enum attributes in Attributes.h to the table-gen
file. Additionally, it adds definitions of target independent string
attributes that will be used in follow-up commits by the inliner to
check attribute compatibility.

rdar://problem/19836465

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252796 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd a libLTO diagnostic handler that supports lto_get_error_message API
Yunzhong Gao [Wed, 11 Nov 2015 19:59:08 +0000 (19:59 +0000)]
Add a libLTO diagnostic handler that supports lto_get_error_message API

This is a follow-up from the previous discussion on the thread:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151019/307763.html

The LibLTO lto_get_error_message() API reads error messages from a std::string
sLastErrorString. Instead of passing this string around as an argument, this
patch creates a diagnostic handler and then sends this handler to the
constructor of LTOCodeGenerator.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252791 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[DAGCombiner] Improve zextload optimization.
Geoff Berry [Wed, 11 Nov 2015 19:42:52 +0000 (19:42 +0000)]
[DAGCombiner] Improve zextload optimization.

Summary:
Don't fold
  (zext (and (load x), cst)) -> (and (zextload x), (zext cst))
if
  (and (load x) cst)
will match as a zextload already and has additional users.

For example, the following IR:

  %load = load i32, i32* %ptr, align 8
  %load16 = and i32 %load, 65535
  %load64 = zext i32 %load16 to i64
  store i32 %load16, i32* %dst1, align 4
  store i64 %load64, i64* %dst2, align 8

used to produce the following aarch64 code:

ldr w8, [x0]
and w9, w8, #0xffff
and x8, x8, #0xffff
str w9, [x1]
str x8, [x2]

but with this change produces the following aarch64 code:

ldrh w8, [x0]
str w8, [x1]
str x8, [x2]

Reviewers: resistor, mcrosier

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252789 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agodwarfdump: DWP type unit index dumping skeleton
David Blaikie [Wed, 11 Nov 2015 19:40:49 +0000 (19:40 +0000)]
dwarfdump: DWP type unit index dumping skeleton

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252786 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactoring and fix another instance of asan error
Xinliang David Li [Wed, 11 Nov 2015 19:31:53 +0000 (19:31 +0000)]
Refactoring and fix another instance of asan error

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252783 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFormat my previous commit
David Blaikie [Wed, 11 Nov 2015 19:30:47 +0000 (19:30 +0000)]
Format my previous commit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252782 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agodwarfdump: First piece of support for DWP dumping
David Blaikie [Wed, 11 Nov 2015 19:28:21 +0000 (19:28 +0000)]
dwarfdump: First piece of support for DWP dumping

Just a tiny piece of index dumping - the header in this instance.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252781 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTest commit after password reset
Hemant Kulkarni [Wed, 11 Nov 2015 19:24:08 +0000 (19:24 +0000)]
Test commit after password reset

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252779 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEH] Only generate UnwindHelp slot for MSVCXX
Joseph Tremoulet [Wed, 11 Nov 2015 19:21:09 +0000 (19:21 +0000)]
[WinEH] Only generate UnwindHelp slot for MSVCXX

Summary: Other personalities don't use this special frame slot.

Reviewers: majnemer, andrew.w.kaylor, rnk

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252778 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSupport: Recognize Borland DWARF extensions.
Dawn Perchik [Wed, 11 Nov 2015 18:47:36 +0000 (18:47 +0000)]
Support: Recognize Borland DWARF extensions.

This patch adds DWARF values for the Delphi language and Borland C++
language extensions.

Reviewed by: dblaikie
Subscribers: llvm-commits, majnemer
Differential Revision: http://reviews.llvm.org/D14522

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252776 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd target preference for GatherAllAliases max depth
Matt Arsenault [Wed, 11 Nov 2015 18:44:33 +0000 (18:44 +0000)]
Add target preference for GatherAllAliases max depth

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252775 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReverting r252760
Colin LeMahieu [Wed, 11 Nov 2015 18:11:06 +0000 (18:11 +0000)]
Reverting r252760

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252770 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoclang-format lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Dehao Chen [Wed, 11 Nov 2015 18:09:47 +0000 (18:09 +0000)]
clang-format lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252769 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoEmit discriminator for inlined callsites.
Dehao Chen [Wed, 11 Nov 2015 18:08:18 +0000 (18:08 +0000)]
Emit discriminator for inlined callsites.

Summary: Inlined callsites need to be emitted in debug info so that sample profile can be annotated to the correct inlined instance.

Reviewers: dnovillo, dblaikie

Subscribers: dblaikie, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252768 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSamplePGO - Fix PR 25482 - Do not rely on llvm.dbg.cu for discriminators
Diego Novillo [Wed, 11 Nov 2015 17:54:37 +0000 (17:54 +0000)]
SamplePGO - Fix PR 25482 - Do not rely on llvm.dbg.cu for discriminators

The discriminators pass relied on the presence of llvm.dbg.cu to decide
whether to add discriminators, but this fails in the case where debug
info is only enabled partially when -fprofile-sample-use is active.

The reason llvm.dbg.cu is not present in these cases is to prevent
codegen from emitting debug info (as it is only used for the sample
profile pass).

This changes the discriminators pass to also emit discriminators even
when debug info is not being emitted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252763 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agollvm-config.cpp: Prune an obsolete \param. [-Wdocumentation]
NAKAMURA Takumi [Wed, 11 Nov 2015 17:50:20 +0000 (17:50 +0000)]
llvm-config.cpp: Prune an obsolete \param. [-Wdocumentation]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252762 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Symbolizer]: Add -pretty-print option
Hemant Kulkarni [Wed, 11 Nov 2015 17:47:54 +0000 (17:47 +0000)]
[Symbolizer]: Add -pretty-print option

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252760 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[MIPS] add overrides for isCheapToSpeculateCttz() and isCheapToSpeculateCtlz()
Sanjay Patel [Wed, 11 Nov 2015 17:24:56 +0000 (17:24 +0000)]
[MIPS] add overrides for isCheapToSpeculateCttz() and isCheapToSpeculateCtlz()

MIPS32 has instructions for efficient count-leading/trailing-zeros, so this should be
considered a cheap operation (and therefore fair game for speculation) for any MIPS32
implementation.

The net result of allowing this speculation for the regression tests in this patch is
that we get this code:

ctlz:
  jr  $ra
  clz  $2, $4

cttz:
  addiu  $1, $4, -1
  not  $2, $4
  and  $1, $2, $1
  clz  $1, $1
  addiu  $2, $zero, 32
  jr  $ra
  subu  $2, $2, $1

Instead of:

ctlz:
  beqz  $4, $BB0_2
  addiu  $2, $zero, 32
  clz  $2, $4
$BB0_2:
  jr  $ra
  nop

cttz:
  beqz  $4, $BB1_2
  addiu  $2, $zero, 32
  addiu  $1, $4, -1
  not  $2, $4
  and  $1, $2, $1
  clz  $1, $1
  addiu  $2, $zero, 32
  subu  $2, $2, $1
$BB1_2:
  jr  $ra
  nop

See D14469 for the larger motivation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252755 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agotest/DebugInfo/ARM/prologue_end.ll references thumbv1, which is invalid.
Artyom Skrobov [Wed, 11 Nov 2015 17:22:18 +0000 (17:22 +0000)]
test/DebugInfo/ARM/prologue_end.ll references thumbv1, which is invalid.

The committer didn't respond at http://reviews.llvm.org/D14338, so we've got to fix this for them.

This test doesn't pass with thumbv6, so I suppose what they meant is thumbv7.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252754 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[mips] Move MC tests for the DSP ASE into the standard format.
Daniel Sanders [Wed, 11 Nov 2015 16:50:13 +0000 (16:50 +0000)]
[mips] Move MC tests for the DSP ASE into the standard format.

Summary:
Only DSPr2 is present because it appears we've never added DSPr1 tests.
We'll have to correct that in a later patch.

Reviewers: vkalintiris

Subscribers: llvm-commits, dsanders

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252752 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoProperly fix unused variable in disable-assert builds.
Diego Novillo [Wed, 11 Nov 2015 16:39:22 +0000 (16:39 +0000)]
Properly fix unused variable in disable-assert builds.

I missed the side-effects of ParseBFI in my previous attempt (r252748).
Thanks dblaikie for the suggestion of adding a void use of the unused
variable instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252751 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CMake] Make llvm_install_library_symlink respect LLVM_LIBDIR_SUFFIX.
Chris Bieneman [Wed, 11 Nov 2015 16:19:39 +0000 (16:19 +0000)]
[CMake] Make llvm_install_library_symlink respect LLVM_LIBDIR_SUFFIX.

This is required to support multilib install targets, and addresses a regression introduced in r252093.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252749 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove unused variable in disable-assert builds. NFC.
Diego Novillo [Wed, 11 Nov 2015 16:14:52 +0000 (16:14 +0000)]
Remove unused variable in disable-assert builds.  NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252748 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CMake] Add support for building the llvm test-suite as part of an LLVM build using...
Chris Bieneman [Wed, 11 Nov 2015 16:14:03 +0000 (16:14 +0000)]
[CMake] Add support for building the llvm test-suite as part of an LLVM build using clang and lld

Summary:
This patch adds a new CMake module for working with ExternalProjects. This wrapper for ExternalProject supports using just-built tools and can hook up dependencies properly so that projects get cleared out.

The example usage here is for the llvm test-suite. In this example, the test-suite is setup as dependent on clang and lld if they are in-tree. If the clang or lld binaries change the test-suite is re-configured, cleaned, and rebuilt.

This cleanup and abstraction wrapping ExternalProject can be extended and applied to other runtime libraries like compiler-rt and libcxx.

Reviewers: samsonov, jroelofs, rengolin, jmolloy

Subscribers: jmolloy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252747 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoVisibly fail if attempting to encode register AH,BH,CH,DH in a REX-prefixed instruction.
Douglas Katzman [Wed, 11 Nov 2015 15:51:16 +0000 (15:51 +0000)]
Visibly fail if attempting to encode register AH,BH,CH,DH in a REX-prefixed instruction.

Differential Revision: http://reviews.llvm.org/D13316
Fixes PR25003

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252743 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ARM] Combine BFIs together
James Molloy [Wed, 11 Nov 2015 15:40:40 +0000 (15:40 +0000)]
[ARM] Combine BFIs together

If we have a chain of BFIs, we may be able to combine several together into one merged BFI. We can do this if the "from" bits from one BFI OR'd with the "from" bits from the other BFI form a contiguous range, and the same with the "to" bits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252740 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SLP] Enable -slp-vectorize-hor by default.
Charlie Turner [Wed, 11 Nov 2015 15:03:46 +0000 (15:03 +0000)]
[SLP] Enable -slp-vectorize-hor by default.

Measurements primarily on AArch64 have shown this feature does not
significantly effect compile-time. The are no significant perf changes in LNT,
but for AArch64 at least, there are wins in third party benchmarks.

As discussed on llvm-dev, we're going to try turning this on by default and see
how other targets react to the change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252733 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilencing a signed vs unsigned type mismatch warning.
Aaron Ballman [Wed, 11 Nov 2015 14:57:28 +0000 (14:57 +0000)]
Silencing a signed vs unsigned type mismatch warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252732 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilencing nine warnings for "enumeral and non-enumeral type in conditional expression...
Aaron Ballman [Wed, 11 Nov 2015 13:44:06 +0000 (13:44 +0000)]
Silencing nine warnings for "enumeral and non-enumeral type in conditional expression"; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252728 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86] Replace LEAs with INC/DEC when profitable
Michael Kuperstein [Wed, 11 Nov 2015 11:44:31 +0000 (11:44 +0000)]
[X86] Replace LEAs with INC/DEC when profitable

If possible and profitable, replace lea %reg, 1(%reg) and lea %reg, -1(%reg) with inc %reg and dec %reg respectively.

Patch by: anton.nadolsky@intel.com
Differential Revision: http://reviews.llvm.org/D14059

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252722 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ASan] Enable optional ASan recovery.
Yury Gribov [Wed, 11 Nov 2015 10:36:49 +0000 (10:36 +0000)]
[ASan] Enable optional ASan recovery.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252719 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86] Fix feature flags on some MMX register instructions that really were introduced...
Craig Topper [Wed, 11 Nov 2015 07:29:25 +0000 (07:29 +0000)]
[X86] Fix feature flags on some MMX register instructions that really were introduced with SSE or SSE2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252709 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[X86] Remove redundant MMX isel patterns.
Craig Topper [Wed, 11 Nov 2015 07:29:22 +0000 (07:29 +0000)]
[X86] Remove redundant MMX isel patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252708 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[libFuzzer] better links
Kostya Serebryany [Wed, 11 Nov 2015 05:25:24 +0000 (05:25 +0000)]
[libFuzzer] better links

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252705 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[libFuzzer] more trophies
Kostya Serebryany [Wed, 11 Nov 2015 05:20:55 +0000 (05:20 +0000)]
[libFuzzer] more trophies

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252704 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agolit: Show all output with --show-all, even in combination with --succinct
Matthias Braun [Wed, 11 Nov 2015 03:03:54 +0000 (03:03 +0000)]
lit: Show all output with --show-all, even in combination with --succinct

I missed an earlier exit for the --succinct case when I introduced the
-a option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252698 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoADT: Avoid relying on UB in ilist_node::getNextNode()
Duncan P. N. Exon Smith [Wed, 11 Nov 2015 02:26:42 +0000 (02:26 +0000)]
ADT: Avoid relying on UB in ilist_node::getNextNode()

Re-implement `ilist_node::getNextNode()` and `getPrevNode()` without
relying on the sentinel having a "next" pointer.  Instead, get access to
the owning list and compare against the `begin()` and `end()` iterators.

This only works when the node *can* get access to the owning list.  The
new support is in `ilist_node_with_parent<>`, and any class `Ty`
inheriting from `ilist_node<NodeTy>` that wants `getNextNode()` and/or
`getPrevNode()` should inherit from
`ilist_node_with_parent<NodeTy, ParentTy>` instead.  The requirements:

  - `NodeTy` must have a `getParent()` function that returns the parent.
  - `ParentTy` must have a `getSublistAccess()` static that, given a(n
    ignored) `NodeTy*` (to determine which list), returns a member field
    pointer to the appropriate `ilist<>`.

This isn't the cleanest way to get access to the owning list, but it
leverages the API already used in the IR hierarchy (see, e.g.,
`Instruction::getSublistAccess()`).

If anyone feels like ripping out the calls to `getNextNode()` and
`getPrevNode()` and replacing with direct iterator logic, they can also
remove the access function, etc., but as an incremental step, I'm
maintaining the API where it's currently used in tree.

If these requirements are *not* met, call sites with access to the ilist
can call `iplist<NodeTy>::getNextNode(NodeTy*)` directly, as in
ilistTest.cpp.

Why rewrite this?

The old code was broken, calling `getNext()` on a sentinel that possibly
didn't have a "next" pointer at all!  The new code avoids that
particular flavour of UB (see the commit message for r252538 for more
details about the "lucky" memory layout that made this function so
interesting).

There's still some UB here: the end iterator gets downcast to `NodeTy*`,
even when it's a sentinel (which is typically
`ilist_half_node<NodeTy*>`).  I'll tackle that in follow-up commits.
See this llvm-dev thread for more details:
http://lists.llvm.org/pipermail/llvm-dev/2015-October/091115.html

What's the danger?

There might be some code that relies on `getNextNode()` or
`getPrevNode()` *never* returning `nullptr` -- i.e., that relies on them
being broken when the sentinel is an `ilist_half_node<NodeTy>`.  I tried
to root out those cases with the audits I did leading up to r252380, but
it's possible I missed one or two.  I hope not.

(If (1) you have out-of-tree code, (2) you've reverted r252380
temporarily, and (3) you get some weird crashes with this commit, then I
recommend un-reverting r252380 and auditing the compile errors looking
for "strange" implicit conversions.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252694 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSort the enums in Attributes.h in case insensitive alphabetical order.
Akira Hatanaka [Wed, 11 Nov 2015 02:11:46 +0000 (02:11 +0000)]
Sort the enums in Attributes.h in case insensitive alphabetical order.

Sort the enums in preparation for moving the attributes to a table-gen
file.

rdar://problem/19836465

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252692 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WebAssembly] Support non-legal argument and return types.
Dan Gohman [Wed, 11 Nov 2015 01:33:02 +0000 (01:33 +0000)]
[WebAssembly] Support non-legal argument and return types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252687 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[MC] Use LShr for constant evaluation of ">>" on non-arm64 darwin.
Ahmed Bougacha [Wed, 11 Nov 2015 00:51:36 +0000 (00:51 +0000)]
[MC] Use LShr for constant evaluation of ">>" on non-arm64 darwin.

Follow-up to r235963: this matches other assemblers and is less
unexpected (e.g. PR23227).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252681 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMachineInstr: addRegisterDefReadUndef() => setRegisterDefReadUndef()
Matthias Braun [Wed, 11 Nov 2015 00:41:58 +0000 (00:41 +0000)]
MachineInstr: addRegisterDefReadUndef() => setRegisterDefReadUndef()

This way we can not only add but also remove read undef flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252678 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAMDGPU: Print more fields in comments
Matt Arsenault [Wed, 11 Nov 2015 00:27:46 +0000 (00:27 +0000)]
AMDGPU: Print more fields in comments

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252677 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ValueTracking] Remove untested / unreachable code, NFC
Sanjoy Das [Wed, 11 Nov 2015 00:16:41 +0000 (00:16 +0000)]
[ValueTracking] Remove untested / unreachable code, NFC

Right now isTruePredicate is only ever called with Pred == ICMP_SLE or
ICMP_ULE, and the ICMP_SLT and ICMP_ULT cases are dead.  This change
removes the untested dead code so that the function is not misleading.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252676 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAMDGPU: Remove dead code
Matt Arsenault [Wed, 11 Nov 2015 00:01:36 +0000 (00:01 +0000)]
AMDGPU: Remove dead code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252675 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAMDGPU: Set isAllocatable = 0 on VS_32/VS_64
Matt Arsenault [Wed, 11 Nov 2015 00:01:32 +0000 (00:01 +0000)]
AMDGPU: Set isAllocatable = 0 on VS_32/VS_64

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252674 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ValueTracking] Teach isImpliedCondition a new bitwise trick
Sanjoy Das [Tue, 10 Nov 2015 23:56:20 +0000 (23:56 +0000)]
[ValueTracking] Teach isImpliedCondition a new bitwise trick

Summary:
This change teaches isImpliedCondition to prove things like

  (A | 15) < L  ==>  (A | 14) < L

if the low 4 bits of A are known to be zero.

Depends on D14391

Reviewers: majnemer, reames, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252673 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ValueTracking] Use m_APInt instead of m_ConstantInt, NFC
Sanjoy Das [Tue, 10 Nov 2015 23:56:15 +0000 (23:56 +0000)]
[ValueTracking] Use m_APInt instead of m_ConstantInt, NFC

This change would add functionality if isImpliedCondition worked on
vector types; but since it bail out on vector predicates this change is
an NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252672 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTableGen: Emit LaneMask for register classes without subregisters as ~0u
Matthias Braun [Tue, 10 Nov 2015 23:23:05 +0000 (23:23 +0000)]
TableGen: Emit LaneMask for register classes without subregisters as ~0u

This makes it slightly easier to handle classes with and without
subregister uniformly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252671 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[WinEH] Insert the MBB for EH_RESTORE after the catchret
Reid Kleckner [Tue, 10 Nov 2015 23:22:20 +0000 (23:22 +0000)]
[WinEH] Insert the MBB for EH_RESTORE after the catchret

Inserting it before the target block could be bad, we might already have
a fallthrough edge to it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252670 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[cmake] move SONAME handling to llvm_add_library
Andrew Wilkins [Tue, 10 Nov 2015 23:19:21 +0000 (23:19 +0000)]
[cmake] move SONAME handling to llvm_add_library

Summary:
Move handling of the SONAME option from add_llvm_library
to llvm_add_library, so that it can be used in sub-projects.
In particular, this makes it possible to have consistently
named shared libraries for LLVM, Clang and LLDB.

Also, base the SONAME and symlinks on the output name
by extracting the OUTPUT_NAME property, rather than assuming
it is the same as the target name.

Reviewers: beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252669 91177308-0d34-0410-b5e6-96231b3b80d8