platform/upstream/llvm.git
7 years agoPR16106: Correct the docs to reflect the actual behavior of the interface.
Vassil Vassilev [Thu, 6 Apr 2017 10:05:46 +0000 (10:05 +0000)]
PR16106: Correct the docs to reflect the actual behavior of the interface.

llvm-svn: 299639

7 years ago[clang-tidy] Check for forwarding reference overload in constructors.
Gabor Horvath [Thu, 6 Apr 2017 09:56:42 +0000 (09:56 +0000)]
[clang-tidy] Check for forwarding reference overload in constructors.

Patch by AndrĂ¡s Leitereg!

Differential Revision: https://reviews.llvm.org/D30547

llvm-svn: 299638

7 years ago[globalisel][tablegen] Move <Target>InstructionSelector declarations to anonymous...
Daniel Sanders [Thu, 6 Apr 2017 09:49:34 +0000 (09:49 +0000)]
[globalisel][tablegen] Move <Target>InstructionSelector declarations to anonymous namespaces

Summary: This resolves the issue of tablegen-erated includes in the headers for non-GlobalISel builds in a simpler way than before.

Reviewers: qcolombet, ab

Reviewed By: ab

Subscribers: igorb, ab, mgorny, dberris, rovka, llvm-commits, kristof.beyls

Differential Revision: https://reviews.llvm.org/D30998

llvm-svn: 299637

7 years ago[ELF] Remove unnecessary cast and fix comments. NFC.
James Henderson [Thu, 6 Apr 2017 09:40:03 +0000 (09:40 +0000)]
[ELF] Remove unnecessary cast and fix comments. NFC.

llvm-svn: 299636

7 years ago[ELF] Pad x86 executable sections with 0xcc int3 instructions
James Henderson [Thu, 6 Apr 2017 09:29:08 +0000 (09:29 +0000)]
[ELF] Pad x86 executable sections with 0xcc int3 instructions

Executable sections should not be padded with zero by default. On some
architectures, 0x00 is the start of a valid instruction sequence, so can confuse
disassembly between InputSections (and indeed the start of the next InputSection
in some situations). Further, in the case of misjumps into padding, padding may
start to be executed silently.

On x86, the "0xcc" byte represents the int3 trap instruction. It is a single
byte long so can serve well as padding. This change switches x86 (and x86_64) to
use this value for padding in executable sections, if no linker script directive
overrides it. It also puts the behaviour into place making it easy to change the
behaviour of other targets when desired. I do not know the relevant instruction
sequences for trap instructions on other targets however, so somebody should add
this separately.

Because the old behaviour simply wrote padding in the whole section before
overwriting most of it, this change also modifies the padding algorithm to write
padding only where needed. This in turn has caused a small behaviour change with
regards to what values are written via Fill commands in linker scripts, bringing
it into line with ld.bfd. The fill value is now written starting from the end of
the previous block, which means that it always starts from the first byte of the
fill, whereas the old behaviour meant that the padding sometimes started mid-way
through the fill value. See the test changes for more details.

Reviewed by: ruiu

Differential Revision: https://reviews.llvm.org/D30886

Bugzilla: http://bugs.llvm.org/show_bug.cgi?id=32227
llvm-svn: 299635

7 years ago[ARM] Remove a dead ADD during the creation of TBBs
David Green [Thu, 6 Apr 2017 08:32:47 +0000 (08:32 +0000)]
[ARM] Remove a dead ADD during the creation of TBBs

During the optimisation of jump tables in the constant island pass,
an extra ADD could be left over, now dead but not removed.

Differential Revision: https://reviews.llvm.org/D31389

llvm-svn: 299634

7 years ago[Polly] [ScheduleOptimizer] Prevent incorrect tile size computation
Siddharth Bhat [Thu, 6 Apr 2017 08:20:22 +0000 (08:20 +0000)]
[Polly] [ScheduleOptimizer] Prevent incorrect tile size computation

Because Polly exposes parameters that directly influence tile size
calculations, one can setup situations like divide-by-zero.

Check against a possible divide-by-zero in getMacroKernelParams
and return early.

Also assert at the end of getMacroKernelParams that the block sizes
computed for matrices are positive (>= 1).

Tags: #polly

Differential Revision: https://reviews.llvm.org/D31708

llvm-svn: 299633

7 years agoTry to fix MAC buildbot after r299630
Maxim Ostapenko [Thu, 6 Apr 2017 08:17:09 +0000 (08:17 +0000)]
Try to fix MAC buildbot after r299630

llvm-svn: 299632

7 years agoTry to fix windows buildbot after r299630
Maxim Ostapenko [Thu, 6 Apr 2017 07:53:26 +0000 (07:53 +0000)]
Try to fix windows buildbot after r299630

llvm-svn: 299631

7 years ago[lsan] Avoid segfaults during threads destruction under high load
Maxim Ostapenko [Thu, 6 Apr 2017 07:42:27 +0000 (07:42 +0000)]
[lsan] Avoid segfaults during threads destruction under high load

This patch addresses two issues:

* It turned out that suspended thread may have dtls->dtv_size == kDestroyedThread (-1)
and LSan wrongly assumes that DTV is available. This leads to SEGV when LSan tries to
iterate through DTV that is invalid.
* In some rare cases GetRegistersAndSP can fail with errno 3 (ESRCH). In this case LSan
assumes that the whole stack of a given thread is available. This is wrong because ESRCH
can indicate that suspended thread was destroyed and its stack was unmapped. This patch
properly handles ESRCH from GetRegistersAndSP in order to avoid invalid accesses to already
unpapped threads stack.

Differential Revision: https://reviews.llvm.org/D30818

llvm-svn: 299630

7 years ago[XRay] [compiler-rt] Unwriting FDR mode buffers when functions are short.
Dean Michael Berris [Thu, 6 Apr 2017 07:14:43 +0000 (07:14 +0000)]
[XRay] [compiler-rt] Unwriting FDR mode buffers when functions are short.

Summary:
"short" is defined as an xray flag, and buffer rewinding happens for both exits
 and tail exits.

 I've made the choice to seek backwards finding pairs of FunctionEntry, TailExit
 record pairs and erasing them if the FunctionEntry occurred before exit from the
 currently exiting function. This is a compromise so that we don't skip logging
 tail calls if the function that they call into takes longer our duration.

 This works by counting the consecutive function and function entry, tail exit
 pairs that proceed the current point in the buffer. The buffer is rewound to
 check whether these entry points happened recently enough to be erased.

 It is still possible we will omit them if they call into a child function that
 is not instrumented which calls a fast grandchild that is instrumented before
 doing other processing.

Reviewers: pelikan, dberris

Reviewed By: dberris

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31345

llvm-svn: 299629

7 years ago[Builtins] Fix div0 error in udivsi3
Weiming Zhao [Thu, 6 Apr 2017 06:13:39 +0000 (06:13 +0000)]
[Builtins] Fix div0 error in udivsi3

Summary: Need to save `lr` before bl to aeabi_div0

Reviewers: rengolin, compnerd

Reviewed By: compnerd

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31716

llvm-svn: 299628

7 years ago[InstSimplify] Add test cases for mixing add/sub i1 with xor of i1. Seems we can...
Craig Topper [Thu, 6 Apr 2017 05:48:06 +0000 (05:48 +0000)]
[InstSimplify] Add test cases for mixing add/sub i1 with xor of i1. Seems we can simplify in one direction but not the other.

llvm-svn: 299627

7 years ago[InstSimplify] Teach SimplifyAddInst and SimplifySubInst that vectors of i1 can be...
Craig Topper [Thu, 6 Apr 2017 05:28:41 +0000 (05:28 +0000)]
[InstSimplify] Teach SimplifyAddInst and SimplifySubInst that vectors of i1 can be treated as Xor too.

llvm-svn: 299626

7 years ago[libc++] Respect Windows Store app CRT restrictions
Shoaib Meenai [Thu, 6 Apr 2017 04:47:49 +0000 (04:47 +0000)]
[libc++] Respect Windows Store app CRT restrictions

Some CRT APIs are unavailable for Windows Store apps [1]. Detect when
we're targeting the Windows Store and don't try to refer to non-existent
CRT functions in that case. (This would otherwise lead to a compile
error when using the libc++ headers and compiling for Windows Store.)

[1] https://docs.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps

Differential Revision: https://reviews.llvm.org/D31737

llvm-svn: 299625

7 years ago[XRay][docs] Fix hyperlink to XRay doc
Dean Michael Berris [Thu, 6 Apr 2017 04:26:26 +0000 (04:26 +0000)]
[XRay][docs] Fix hyperlink to XRay doc

llvm-svn: 299624

7 years ago[Orc] Add missing header include for r299611.
Lang Hames [Thu, 6 Apr 2017 04:12:47 +0000 (04:12 +0000)]
[Orc] Add missing header include for r299611.

llvm-svn: 299623

7 years agoRevert accidental commit of r299619.
Craig Topper [Thu, 6 Apr 2017 04:04:10 +0000 (04:04 +0000)]
Revert accidental commit of r299619.

llvm-svn: 299622

7 years agoRevert accidental commit of r299618
Craig Topper [Thu, 6 Apr 2017 04:03:34 +0000 (04:03 +0000)]
Revert accidental commit of r299618

llvm-svn: 299621

7 years ago[IR] Add commutable matchers for Add and Mul to go with the logic operations that...
Craig Topper [Thu, 6 Apr 2017 04:02:33 +0000 (04:02 +0000)]
[IR] Add commutable matchers for Add and Mul to go with the logic operations that are already present. NFC

llvm-svn: 299620

7 years agobar
Craig Topper [Thu, 6 Apr 2017 04:02:31 +0000 (04:02 +0000)]
bar

llvm-svn: 299619

7 years agofoo
Craig Topper [Thu, 6 Apr 2017 04:02:28 +0000 (04:02 +0000)]
foo

llvm-svn: 299618

7 years agoUpdate to isl-0.18-417-gb9e7334
Tobias Grosser [Thu, 6 Apr 2017 03:41:47 +0000 (03:41 +0000)]
Update to isl-0.18-417-gb9e7334

This is a regular maintenance update.

llvm-svn: 299617

7 years ago[XRay] - Fix spelling error to test commit access.
Keith Wyss [Thu, 6 Apr 2017 03:32:01 +0000 (03:32 +0000)]
[XRay] - Fix spelling error to test commit access.

Just a spelling change in a comment intended to test svn commit access.

llvm-svn: 299616

7 years agoCreate GOT and PLT entries early in scanRelocs().
Rui Ueyama [Thu, 6 Apr 2017 03:30:51 +0000 (03:30 +0000)]
Create GOT and PLT entries early in scanRelocs().

scanRelocs() does a lot of things. It fills InputSection's Relocations vector,
making a decision whether a TLS relocation should be relaxed or not,
and making a decision whether a GOT/PLT slot needs to be created or not.

They don't actually have to be done in a single loop. I want to separate
them so that some of them can be run concurently. As a first step, this
patch moves PLT/GOT slot assignment to beginning of the loop, so that
they just fall through to the next statements. This should make it clear
that that code doesn't affect other parts of the loop.

llvm-svn: 299615

7 years agoRemove Target::isTlsGlobalDynamicRel()
Rui Ueyama [Thu, 6 Apr 2017 03:30:32 +0000 (03:30 +0000)]
Remove Target::isTlsGlobalDynamicRel()

Relocations are abstracted as platform-independent R_TLS_* relocations,
so we don't need to check platform-specific ones to see if a relocation
is TLS GD.

llvm-svn: 299614

7 years agoUpdate unittests/Host/SocketTest.cpp to also use the new
Jason Molenda [Thu, 6 Apr 2017 03:16:44 +0000 (03:16 +0000)]
Update unittests/Host/SocketTest.cpp to also use the new
one-socket API.

llvm-svn: 299613

7 years agoSome old mach-o core files have an LC_IDENT load command
Jason Molenda [Thu, 6 Apr 2017 01:50:11 +0000 (01:50 +0000)]
Some old mach-o core files have an LC_IDENT load command
and there's a string in there that can be helpful in locating
the kernel binary.  Use it.
<rdar://problem/31444711>

llvm-svn: 299612

7 years ago[Orc] Break QueueChannel out into its own header and add a utility,
Lang Hames [Thu, 6 Apr 2017 01:49:21 +0000 (01:49 +0000)]
[Orc] Break QueueChannel out into its own header and add a utility,
createPairedQueueChannels, to simplify channel creation in the RPC unit tests.

llvm-svn: 299611

7 years ago[Orc] Make orcError return an error_code rather than Error.
Lang Hames [Thu, 6 Apr 2017 01:35:13 +0000 (01:35 +0000)]
[Orc] Make orcError return an error_code rather than Error.

This will allow orcError to be used in convertToErrorCode implementations,
which will help in transitioning Orc RPC to Error.

llvm-svn: 299610

7 years agogetAsInteger is not a equivalent replacement for strtol
Jim Ingham [Thu, 6 Apr 2017 01:33:38 +0000 (01:33 +0000)]
getAsInteger is not a equivalent replacement for strtol

work around that fact for CommandObjectMemoryWrite.

<rdar://problem/31457148>

llvm-svn: 299609

7 years agoChange how UDP sockets are set up -- use the same one socket for
Jason Molenda [Thu, 6 Apr 2017 01:21:44 +0000 (01:21 +0000)]
Change how UDP sockets are set up -- use the same one socket for
both sending and receiving information, instead of using one socket
to send and another to receive.  The two socket arrangement fails over
when a firewall is between the two systems.
<rdar://problem/31286757>

llvm-svn: 299608

7 years agoFix remote test execution in lit
Mehdi Amini [Thu, 6 Apr 2017 01:14:57 +0000 (01:14 +0000)]
Fix remote test execution in lit

Can be used as such:

  $ python /path/to/lit.py -sv /path/to/llvm/build/projects/libcxx/test/ \
    --param=use_system_cxx_lib=true \
    --param=executor='SSHExecutor("remote.domain", "username")'

llvm-svn: 299607

7 years agoUse alternate string layout for ARMv7k
Mehdi Amini [Thu, 6 Apr 2017 01:10:22 +0000 (01:10 +0000)]
Use alternate string layout for ARMv7k

llvm-svn: 299606

7 years ago[lit] Implement timeouts and max_time for process pool testing
Reid Kleckner [Thu, 6 Apr 2017 00:38:28 +0000 (00:38 +0000)]
[lit] Implement timeouts and max_time for process pool testing

This is necessary to pass the lit test suite at llvm/utils/lit/tests.

There are some pre-existing failures here, but now switching to pools
doesn't regress any tests.

I had to change test-data/lit.cfg to import DummyConfig from a module to
fix pickling problems, but I think it'll be OK if we require test
formats to be written in real .py modules outside lit.cfg files.

I also discovered that in some circumstances AsyncResult.wait() will not
raise KeyboardInterrupt in a timely manner, but you can pass a non-zero
timeout to work around this. This makes threading.Condition.wait use a
polling loop that runs through the interpreter, so it's capable of
asynchronously raising KeyboardInterrupt.

llvm-svn: 299605

7 years ago[cfi] Fix symbol lookup hack in cross-dso cfi to handle LLD binaries.
Evgeniy Stepanov [Thu, 6 Apr 2017 00:34:45 +0000 (00:34 +0000)]
[cfi] Fix symbol lookup hack in cross-dso cfi to handle LLD binaries.

llvm-svn: 299604

7 years ago[Sema] Update CheckOverload docs
George Burgess IV [Thu, 6 Apr 2017 00:23:31 +0000 (00:23 +0000)]
[Sema] Update CheckOverload docs

- Replace documented return values (true/false) with what's actually
  returned
- Doxygenify the comment
- Reflow said comment to 80 cols

Not overly familiar with Doxygen, so nits are welcome. :)

llvm-svn: 299603

7 years agoStringTableBuilder: Don't assert when writing an empty raw string table.
Peter Collingbourne [Thu, 6 Apr 2017 00:10:17 +0000 (00:10 +0000)]
StringTableBuilder: Don't assert when writing an empty raw string table.

llvm-svn: 299602

7 years agoSimplify. NFC.
George Burgess IV [Thu, 6 Apr 2017 00:08:35 +0000 (00:08 +0000)]
Simplify. NFC.

Two simplifications:
- We check `!Previous.empty()` above and only use `Previous` in const
  contexts after that check, so the `!Previous.empty()` check seems
  redundant.
- The null check looks pointless, as well: AFAICT, `LookupResults`
  should never contain null entries, and `OldDecl` should always be
  non-null if `Redeclaration` is true.

llvm-svn: 299601

7 years agoReturn Optional<uint64_t> from readInteger instead of returning just success/failure.
Rui Ueyama [Wed, 5 Apr 2017 23:22:11 +0000 (23:22 +0000)]
Return Optional<uint64_t> from readInteger instead of returning just success/failure.

llvm-svn: 299600

7 years ago[CMake][libcxx] Use builtins rather than gcc_s when compiler-rt is requested
Petr Hosek [Wed, 5 Apr 2017 22:53:05 +0000 (22:53 +0000)]
[CMake][libcxx] Use builtins rather than gcc_s when compiler-rt is requested

When compiler-rt is requested, we should attempt to link compiler-rt
builtins library rather than gcc_s.

Differential Revision: https://reviews.llvm.org/D31617

llvm-svn: 299599

7 years agoBitcode: Remove an unused declaration. NFC.
Peter Collingbourne [Wed, 5 Apr 2017 22:49:52 +0000 (22:49 +0000)]
Bitcode: Remove an unused declaration. NFC.

llvm-svn: 299598

7 years ago[Driver] Print a newline when invoking `-print-resource-dir`
Meador Inge [Wed, 5 Apr 2017 22:27:20 +0000 (22:27 +0000)]
[Driver] Print a newline when invoking `-print-resource-dir`

The commit yesterday (r299473) to add the `-print-resource-dir`
option was supposed to emit a newline after the resource dir.

Differential Revision: https://reviews.llvm.org/D31447

llvm-svn: 299597

7 years ago[Bugpoint] Use `unique_ptr` correctly.
Bryant Wong [Wed, 5 Apr 2017 22:23:48 +0000 (22:23 +0000)]
[Bugpoint] Use `unique_ptr` correctly.

Moving Modules into `testMergedProgram` is incorrect (and causes segmentation
faults) since all callers expect to retain ownership. This is evidenced by the
later calls to `unique_ptr<Module>::get` in the same function.

Differential Revision: https://reviews.llvm.org/D31727

llvm-svn: 299596

7 years agoRemove unused typedefs.
Rui Ueyama [Wed, 5 Apr 2017 21:46:06 +0000 (21:46 +0000)]
Remove unused typedefs.

llvm-svn: 299594

7 years agoInline a small function. NFC.
Rui Ueyama [Wed, 5 Apr 2017 21:45:47 +0000 (21:45 +0000)]
Inline a small function. NFC.

llvm-svn: 299593

7 years agoUse uint64_t to keep file size even on 32-bit machines.
Rui Ueyama [Wed, 5 Apr 2017 21:37:09 +0000 (21:37 +0000)]
Use uint64_t to keep file size even on 32-bit machines.

If an output file is too large for 32-bit, we should report an error.

llvm-svn: 299592

7 years agoAddressSpace: fix DWARF based unwinding handling on Android
Saleem Abdulrasool [Wed, 5 Apr 2017 21:29:38 +0000 (21:29 +0000)]
AddressSpace: fix DWARF based unwinding handling on Android

It is possible that there are no program headers in the module.  Do not
attempt to dereference nullptr as a program header.

llvm-svn: 299591

7 years agoInline a small function. NFC.
Rui Ueyama [Wed, 5 Apr 2017 21:08:47 +0000 (21:08 +0000)]
Inline a small function. NFC.

llvm-svn: 299590

7 years ago[X86 TTI] Implement LSV hook
Keno Fischer [Wed, 5 Apr 2017 20:51:38 +0000 (20:51 +0000)]
[X86 TTI] Implement LSV hook

Summary:
LSV wants to know the maximum size that can be loaded to a vector register.
On X86, this always matches the maximum register width. Implement this
accordingly and add a test to make sure that LSV can vectorize up to the
maximum permissible width on X86.

Reviewers: delena, arsenm

Reviewed By: arsenm

Subscribers: wdng, llvm-commits

Differential Revision: https://reviews.llvm.org/D31504

llvm-svn: 299589

7 years agoAnnotate some more libc++ tests with the new category
Pavel Labath [Wed, 5 Apr 2017 20:34:26 +0000 (20:34 +0000)]
Annotate some more libc++ tests with the new category

This makes sure we are able to run them properly on android.

llvm-svn: 299588

7 years agoThe darwin_log tests are very fragile and currently do not properly assess the state...
Sean Callanan [Wed, 5 Apr 2017 20:33:39 +0000 (20:33 +0000)]
The darwin_log tests are very fragile and currently do not properly assess the state of that functionality.
I have put them all in their own category, and made that category disabled by default.

Differential revision: https://reviews.llvm.org/D31718

llvm-svn: 299587

7 years agoSimplify test a bit.
Rafael Espindola [Wed, 5 Apr 2017 20:26:33 +0000 (20:26 +0000)]
Simplify test a bit.

There are two cases to consider:

We are using the internal shell. This will still fail because of
ulimit.
We are using an external shell. In this case the difference is that we
now also constrain FileCheck to use less than 4 MB of of stack, which
it should :-)

llvm-svn: 299586

7 years agoRemove llvm.lifetime.start/end in original region.
Michael Kruse [Wed, 5 Apr 2017 20:09:59 +0000 (20:09 +0000)]
Remove llvm.lifetime.start/end in original region.

The current StackColoring algorithm does not correctly handle the
situation when some, but not all paths from a BB to the entry node
cross a llvm.lifetime.start. According to an interpretation of the
language reference at
http://llvm.org/docs/LangRef.html#llvm-lifetime-start-intrinsic
this might be correct, but it would cost too much effort to handle
in StackColoring.

To be on the safe side, remove all lifetime markers even in the original
code version (they have never been copied to the optimized version)
to ensure that no path to the entry block will cross a
llvm.lifetime.start.

The same principle applies to paths the a function return and the
llvm.lifetime.end marker, so we remove them as well.

This fixes llvm.org/PR32251.

Also see the discussion at
http://lists.llvm.org/pipermail/llvm-dev/2017-March/111551.html

llvm-svn: 299585

7 years agoRemove accidental debug printf. Follow up to r299583.
Ivan Krasin [Wed, 5 Apr 2017 20:07:43 +0000 (20:07 +0000)]
Remove accidental debug printf. Follow up to r299583.

llvm-svn: 299584

7 years agoRevert r299536. [AMDGPU] SDWA peephole: enable by default.
Ivan Krasin [Wed, 5 Apr 2017 19:58:12 +0000 (19:58 +0000)]
Revert r299536. [AMDGPU] SDWA peephole: enable by default.

Reason: breaks multiple bots:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/3988
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/1173

Original Review URL: https://reviews.llvm.org/D31671

llvm-svn: 299583

7 years ago[Hexagon] Use -mattr to select HVX mode in a testcase, NFC
Krzysztof Parzyszek [Wed, 5 Apr 2017 19:46:37 +0000 (19:46 +0000)]
[Hexagon] Use -mattr to select HVX mode in a testcase, NFC

llvm-svn: 299582

7 years agoRemove unnecessary virtual dtor.
Rui Ueyama [Wed, 5 Apr 2017 19:21:35 +0000 (19:21 +0000)]
Remove unnecessary virtual dtor.

This class doesn't have virtual member functions, and no instances
of this class is deleted through base pointers.

llvm-svn: 299581

7 years agoInline small functions that are used only once.
Rui Ueyama [Wed, 5 Apr 2017 19:21:15 +0000 (19:21 +0000)]
Inline small functions that are used only once.

llvm-svn: 299580

7 years agoFix comments.
Rui Ueyama [Wed, 5 Apr 2017 19:20:54 +0000 (19:20 +0000)]
Fix comments.

llvm-svn: 299579

7 years agoMemorySSA: Remove MemorySSA walker caching.
Daniel Berlin [Wed, 5 Apr 2017 19:01:58 +0000 (19:01 +0000)]
MemorySSA: Remove MemorySSA walker caching.

Summary:
Remove all the caching the clobber walker does, and that the
caching walker does.  With the patch to enable storing clobbering
access results for stores, i can find no improvement with the cache
turned on (and a number of degradations, both time and memory, from
the cost of caching.  For a large program i have, we do millions of
lookups and inserts with zero hits).

I haven't tried to rename or simplify the walker otherwise yet.

(Appreciate some perf testing on this past my own testing)

Reviewers: george.burgess.iv, davide

Subscribers: Prazek, llvm-commits

Differential Revision: https://reviews.llvm.org/D31576

llvm-svn: 299578

7 years ago[lit] Fix Analysis test format pickling error
Reid Kleckner [Wed, 5 Apr 2017 18:56:48 +0000 (18:56 +0000)]
[lit] Fix Analysis test format pickling error

Move the test format into a standalone .py file and add it to the site
module search path. This allows us to run the test on Windows, and it
makes it compatible with the multiprocessing.Pool lit test execution
strategy.

I think this test was only passing everywhere else because
multiprocessing uses 'fork' to spawn workers, so the test format never
needs to be pickled.

llvm-svn: 299577

7 years ago[llvm-readobj] Only print the real size of the note
Petr Hosek [Wed, 5 Apr 2017 18:55:50 +0000 (18:55 +0000)]
[llvm-readobj] Only print the real size of the note

Note payloads are padded to a multiple of 4 bytes in size, but the size
of the string that should be print can be smaller e.g. the n_descsz
field in gold's version note is 9, so that's the whole size of the
string that should be printed. The padding is part of the format of a
SHT_NOTE section or PT_NOTE segment, but it's not part of the note
itself.

Printing the extra null bytes may confuse some tools, e.g. when the
llvm-readobj is sent to grep, it treats the output as binary because
it contains a null byte.

Differential Revision: https://reviews.llvm.org/D30804

llvm-svn: 299576

7 years agoFix invalid memory access on android x86
Saleem Abdulrasool [Wed, 5 Apr 2017 18:33:23 +0000 (18:33 +0000)]
Fix invalid memory access on android x86

On certain versions of android x86, the main module `app_process` is not
built as PIE.  When accessing the PT_GNU_EH_FRAME_HDR in such a
scenario, the `dlpi_addr` is 0, but the virtual address is not
relocated.  Manually rebase the address to avoid an invalid memory
access.

llvm-svn: 299575

7 years agoclang-format: Support formatting utf-8 character literals in C++11+ mode.
Nico Weber [Wed, 5 Apr 2017 18:10:42 +0000 (18:10 +0000)]
clang-format: Support formatting utf-8 character literals in C++11+ mode.

clang-format <<END
auto c1 = u8'a';
auto c2 = u'a';
END

Before:
  auto c1 = u8 'a';
  auto c2 = u'a';

Now:
  auto c1 = u8'a';
  auto c2 = u'a';

Patch from Denis Gladkikh <llvm@denis.gladkikh.email>!

llvm-svn: 299574

7 years agoRename ScriptConfig::UndefinedSymbols ReferencedSymbols.
Rui Ueyama [Wed, 5 Apr 2017 18:02:30 +0000 (18:02 +0000)]
Rename ScriptConfig::UndefinedSymbols ReferencedSymbols.

Symbols referenced by linker scripts are not necessarily be undefined,
so the previous name didn't convey the meaining of the variable.

llvm-svn: 299573

7 years ago[DAGCombine] Support FMF contract in fused multiple-and-sub too
Adam Nemet [Wed, 5 Apr 2017 17:58:48 +0000 (17:58 +0000)]
[DAGCombine] Support FMF contract in fused multiple-and-sub too

This is a follow-on to r299096 which added support for fmadd.

Subtract does not have the case where with two multiply operands we commute in
order to fuse with the multiply with the fewer uses.

llvm-svn: 299572

7 years ago[DAGCombine] Remove commented-out code from r299096
Adam Nemet [Wed, 5 Apr 2017 17:58:44 +0000 (17:58 +0000)]
[DAGCombine] Remove commented-out code from r299096

llvm-svn: 299571

7 years ago[InstCombine] add fold for icmp with or mask of low bits (PR32542)
Sanjay Patel [Wed, 5 Apr 2017 17:57:05 +0000 (17:57 +0000)]
[InstCombine] add fold for icmp with or mask of low bits (PR32542)

We already have these 'and' folds:

// X & -C == -C -> X >  u ~C
// X & -C != -C -> X <= u ~C
//   iff C is a power of 2

...but we were missing the 'or' siblings.

http://rise4fun.com/Alive/n6

This should improve:
https://bugs.llvm.org/show_bug.cgi?id=32524
...but there are 2 or more other pieces to fix still.

Differential Revision: https://reviews.llvm.org/D31712

llvm-svn: 299570

7 years ago[ExecutionDepsFix] Don't recurse over the CFG
Keno Fischer [Wed, 5 Apr 2017 17:42:56 +0000 (17:42 +0000)]
[ExecutionDepsFix] Don't recurse over the CFG

Summary:
Use an explicit work queue instead, to avoid accidentally
causing stack overflows for input with very large CFGs.

Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D31681

llvm-svn: 299569

7 years ago[InstCombine] fix formatting and variable names; NFCI
Sanjay Patel [Wed, 5 Apr 2017 17:38:34 +0000 (17:38 +0000)]
[InstCombine] fix formatting and variable names; NFCI

There must be some opportunity to refactor big chunks of nearly duplicated code in FoldOrOfICmps / FoldAndOfICmps.
Also, none of this works with vectors, but it should.

llvm-svn: 299568

7 years ago[AMDGPU][MC] Fix for Bug 28158 + LIT tests
Dmitry Preobrazhensky [Wed, 5 Apr 2017 17:26:45 +0000 (17:26 +0000)]
[AMDGPU][MC] Fix for Bug 28158 + LIT tests

Added support of the following instructions:
- s_cbranch_cdbgsys
- s_cbranch_cdbgsys_and_user
- s_cbranch_cdbgsys_or_user
- s_cbranch_cdbguser
- s_setkill

Reviewers: vpykhtin

Differential Revision: https://reviews.llvm.org/D31469

llvm-svn: 299567

7 years agoMemorySSA: Fix and use optimized_def_chain
Daniel Berlin [Wed, 5 Apr 2017 17:26:25 +0000 (17:26 +0000)]
MemorySSA: Fix and use optimized_def_chain

llvm-svn: 299566

7 years ago[lit] Revert to old execution strategy while I debug these pickling errors
Reid Kleckner [Wed, 5 Apr 2017 17:16:37 +0000 (17:16 +0000)]
[lit] Revert to old execution strategy while I debug these pickling errors

llvm-svn: 299565

7 years ago[lit] Use Python 3 style print to satisfy some bots
Reid Kleckner [Wed, 5 Apr 2017 17:05:31 +0000 (17:05 +0000)]
[lit] Use Python 3 style print to satisfy some bots

llvm-svn: 299564

7 years agoARMFrameLowering: Slight cleanups; NFC
Matthias Braun [Wed, 5 Apr 2017 16:58:41 +0000 (16:58 +0000)]
ARMFrameLowering: Slight cleanups; NFC

llvm-svn: 299562

7 years agoFix -Wmissing-field-initializer warnings to unbreak the -Werror build
David Blaikie [Wed, 5 Apr 2017 16:50:19 +0000 (16:50 +0000)]
Fix -Wmissing-field-initializer warnings to unbreak the -Werror build

llvm-svn: 299561

7 years ago[lit] Use process pools for test execution by default
Reid Kleckner [Wed, 5 Apr 2017 16:44:56 +0000 (16:44 +0000)]
[lit] Use process pools for test execution by default

Summary:
This drastically reduces lit test execution startup time on Windows. Our
previous strategy was to manually create one Process per job and manage
the worker pool ourselves. Instead, let's use the worker pool provided
by multiprocessing.  multiprocessing.Pool(jobs) returns almost
immediately, and initializes the appropriate number of workers, so they
can all start executing tests immediately. This avoids the ramp-up
period that the old implementation suffers from.  This appears to speed
up small test runs.

Here are some timings of the llvm-readobj tests on Windows using the
various execution strategies:

 # multiprocessing.Pool:
$ for i in `seq 1 3`; do tim python ./bin/llvm-lit.py -sv ../llvm/test/tools/llvm-readobj/ --use-process-pool |& grep real: ; done
real: 0m1.156s
real: 0m1.078s
real: 0m1.094s

 # multiprocessing.Process:
$ for i in `seq 1 3`; do tim python ./bin/llvm-lit.py -sv ../llvm/test/tools/llvm-readobj/ --use-processes |& grep real: ; done
real: 0m6.062s
real: 0m5.860s
real: 0m5.984s

 # threading.Thread:
$ for i in `seq 1 3`; do tim python ./bin/llvm-lit.py -sv ../llvm/test/tools/llvm-readobj/ --use-threads |& grep real: ; done
real: 0m9.438s
real: 0m10.765s
real: 0m11.079s

I kept the old code to launch processes in case this change doesn't work
on all platforms that LLVM supports, but at some point I would like to
remove both the threading and old multiprocessing execution strategies.

Reviewers: modocache, rafael

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31677

llvm-svn: 299560

7 years agoDo not use relocateOne() to just write 32-bit words.
Rui Ueyama [Wed, 5 Apr 2017 16:33:44 +0000 (16:33 +0000)]
Do not use relocateOne() to just write 32-bit words.

llvm-svn: 299559

7 years ago[ARM] Try to re-enable MachineBranchProb.ll for ARM/AArch64
Renato Golin [Wed, 5 Apr 2017 16:27:11 +0000 (16:27 +0000)]
[ARM] Try to re-enable MachineBranchProb.ll for ARM/AArch64

Commit r298799 changed code that made the XFAIL on MachineBranchProb.ll
irrelevant, but some configurations still failed. I can't reproduce it
locally, so I'm hoping that enabling this will tell me if some
configurations will really fail or if they were just too slow.

llvm-svn: 299558

7 years ago[InstCombine] add tests for missing icmp fold (PR32524)
Sanjay Patel [Wed, 5 Apr 2017 16:21:38 +0000 (16:21 +0000)]
[InstCombine] add tests for missing icmp fold (PR32524)

llvm-svn: 299557

7 years agoRename GotEntryAddr -> GotPltEntryAddr.
Rui Ueyama [Wed, 5 Apr 2017 16:15:59 +0000 (16:15 +0000)]
Rename GotEntryAddr -> GotPltEntryAddr.

Because they are addresses in .got.plt and not in .got.

llvm-svn: 299556

7 years ago[AMDGPU][MC] Fix for Bug 28167 + LIT tests
Dmitry Preobrazhensky [Wed, 5 Apr 2017 16:08:21 +0000 (16:08 +0000)]
[AMDGPU][MC] Fix for Bug 28167 + LIT tests

Corrected src0 for v_writelane_b32:
- Enabled inline constants and literals for SI/CI (VOP2)
- Enabled inline constants for VI (VOP3)

Reviewers: vpykhtin, arsenm

https://reviews.llvm.org/D31463

llvm-svn: 299555

7 years agoRemove unnecessary local variable.
Rui Ueyama [Wed, 5 Apr 2017 16:07:44 +0000 (16:07 +0000)]
Remove unnecessary local variable.

This patch does what r299506 was trying to do in a different way.

llvm-svn: 299554

7 years agoFix PLT and GOTPLT entries for 32-bit x86 PIC.
Rui Ueyama [Wed, 5 Apr 2017 16:01:33 +0000 (16:01 +0000)]
Fix PLT and GOTPLT entries for 32-bit x86 PIC.

Previously, the code we set to our .plt entries expected that .got
and .got.plt are consecutive in the virtual address space.
Since %ebx points to the last entry of .got for position-independent
code, it assumed that .got is accessible with small negative
displacements and .got.plt are accessible with small positive
displacements.

That assumption was simply wrong. We don't impose any restrictions on
relative layout of .got and .got.plt. As a result, the control is
transferred to a bogus address from .plt at runtime, which resulted in
segfaults.

This patch removes that wrong assumption. We still assume that .got.plt
has a fixed relative address to .got, but we no longer assume that they
are consecutive in memory.

With this change, a "hello world" program compiled with -fPIC works.

Fixes https://bugs.llvm.org/show_bug.cgi?id=31332.

Differential Revision: https://reviews.llvm.org/D31682

llvm-svn: 299553

7 years ago[SystemZ] Prevent Merging Bitcast with non-normal loads
Nirav Dave [Wed, 5 Apr 2017 15:42:48 +0000 (15:42 +0000)]
[SystemZ] Prevent Merging Bitcast with non-normal loads

Fixes PR32505.

Reviewers: uweigand, jonpa

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D31609

llvm-svn: 299552

7 years ago[yaml2obj] Factor out error handling code.
Davide Italiano [Wed, 5 Apr 2017 15:18:16 +0000 (15:18 +0000)]
[yaml2obj] Factor out error handling code.

llvm-svn: 299551

7 years agoRevert "[analyzer] Add a modular constraint system to the CloneDetector"
Artem Dergachev [Wed, 5 Apr 2017 15:06:17 +0000 (15:06 +0000)]
Revert "[analyzer] Add a modular constraint system to the CloneDetector"

This reverts commit r299544.

Crashes on tests on some buildbots.

llvm-svn: 299550

7 years ago[llvm-ar] Remove unneeded std::, NFCI.
Davide Italiano [Wed, 5 Apr 2017 15:05:05 +0000 (15:05 +0000)]
[llvm-ar] Remove unneeded std::, NFCI.

This makes it more consistent with other exit() calls in llvm-ar
(and the tools in general).

llvm-svn: 299549

7 years ago[llvm-ar] errors go on stderr and not on stdout.
Davide Italiano [Wed, 5 Apr 2017 14:52:17 +0000 (14:52 +0000)]
[llvm-ar] errors go on stderr and not on stdout.

llvm-svn: 299548

7 years agoRespect CMAKE_INSTALL_MANDIR for sphinx generated manpages
Jonathan Roelofs [Wed, 5 Apr 2017 14:49:46 +0000 (14:49 +0000)]
Respect CMAKE_INSTALL_MANDIR for sphinx generated manpages

This is a re-work of r297516, which was reverted in r297545.

https://reviews.llvm.org/D30906

llvm-svn: 299547

7 years ago[yaml2obj] Improve error message when output file cannot be opened.
Davide Italiano [Wed, 5 Apr 2017 14:44:00 +0000 (14:44 +0000)]
[yaml2obj] Improve error message when output file cannot be opened.

Patch by Sam Clegg!

Differential Revision:  https://reviews.llvm.org/D31351

llvm-svn: 299546

7 years ago[LV] Make test case more robust
Matthew Simpson [Wed, 5 Apr 2017 14:34:13 +0000 (14:34 +0000)]
[LV] Make test case more robust

This test case depends on the loop being vectorized without forcing the
vectorization factor. If the profitability ever changes in the future (due to
cost model improvements), the test may no longer work as intended. Instead of
checking the resulting IR, we should just check the instruction costs. The
costs will be computed regardless if vectorization is profitable.

llvm-svn: 299545

7 years ago[analyzer] Add a modular constraint system to the CloneDetector
Artem Dergachev [Wed, 5 Apr 2017 14:17:36 +0000 (14:17 +0000)]
[analyzer] Add a modular constraint system to the CloneDetector

A big part of the clone detection code is functionality for filtering clones and
clone groups based on different criteria. So far this filtering process was
hardcoded into the CloneDetector class, which made it hard to understand and,
ultimately, to extend.

This patch splits the CloneDetector's logic into a sequence of reusable
constraints that are used for filtering clone groups. These constraints
can be turned on and off and reodreder at will, and new constraints are easy
to implement if necessary.

Unit tests are added for the new constraint interface.

This is a refactoring patch - no functional change intended.

Patch by Raphael Isemann!

Differential Revision: https://reviews.llvm.org/D23418

llvm-svn: 299544

7 years agoclang-format-vsix: Add "Format on Save" feature
Antonio Maiorano [Wed, 5 Apr 2017 14:13:45 +0000 (14:13 +0000)]
clang-format-vsix: Add "Format on Save" feature

This change adds a feature to the clang-format VS extension that optionally
enables the automatic formatting of documents when saving. Since developers
always need to save their files, this eases the workflow of making sure source
files are properly formatted.

Differential Revision: https://reviews.llvm.org/D29221

llvm-svn: 299543

7 years ago[DAGCombiner] add and use TLI hook to convert and-of-seteq / or-of-setne to bitwise...
Sanjay Patel [Wed, 5 Apr 2017 14:09:39 +0000 (14:09 +0000)]
[DAGCombiner] add and use TLI hook to convert and-of-seteq / or-of-setne to bitwise logic+setcc (PR32401)

This is a generic combine enabled via target hook to reduce icmp logic as discussed in:
https://bugs.llvm.org/show_bug.cgi?id=32401

It's likely that other targets will want to enable this hook for scalar transforms,
and there are probably other patterns that can use bitwise logic to reduce comparisons.

Note that we are missing an IR canonicalization for these patterns, and we will probably
prefer the pair-of-compares form in IR (shorter, more likely to fold).

Differential Revision: https://reviews.llvm.org/D31483

llvm-svn: 299542

7 years ago-Wunreachable-code: 'true' and 'false' should not be treated as configuration
Alex Lorenz [Wed, 5 Apr 2017 14:07:21 +0000 (14:07 +0000)]
-Wunreachable-code: 'true' and 'false' should not be treated as configuration
macros

Clang should emit -Wunreachable-code warnings in C mode for code that's
unreachable because of a 'false' or '!true' condition.

llvm-svn: 299541

7 years ago[DAGCombiner] Don't make a BUILD_VECTOR with operands of illegal type.
Jonas Paulsson [Wed, 5 Apr 2017 13:45:37 +0000 (13:45 +0000)]
[DAGCombiner]  Don't make a BUILD_VECTOR with operands of illegal type.

When DAGCombiner visits a SIGN_EXTEND_INREG of a BUILD_VECTOR with
constant operands, a new BUILD_VECTOR node will be created transformed
constants.

Llvm-stress found a case where the new BUILD_VECTOR had constant operands
of an illegal type, because the (legal) element type is in fact not a legal
scalar type.

This patch changes this so that the new BUILD_VECTOR has the same operand
type as the old one.

Review: Eli Friedman, Nirav Dave
https://bugs.llvm.org//show_bug.cgi?id=32422

llvm-svn: 299540

7 years ago[InstCombine] add tests for missing add canonicalization; NFC
Sanjay Patel [Wed, 5 Apr 2017 13:33:10 +0000 (13:33 +0000)]
[InstCombine] add tests for missing add canonicalization; NFC

llvm-svn: 299539

7 years ago[globalisel][tablegen] Fix patterns involving multiple ComplexPatterns.
Daniel Sanders [Wed, 5 Apr 2017 13:14:03 +0000 (13:14 +0000)]
[globalisel][tablegen] Fix patterns involving multiple ComplexPatterns.

Summary:
Temporaries are now allocated to operands instead of predicates and this
allocation is used to correctly pair up the rendered operands with the
matched operands.

Previously, ComplexPatterns were allocated temporaries independently in the
Src Pattern and Dst Pattern, leading to mismatches. Additionally, the Dst
Pattern failed to account for the allocated index and therefore always used
temporary 0, 1, ... when it should have used base+0, base+1, ...

Thanks to Aditya Nandakumar for noticing the bug.

Depends on D30539

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: igorb, dberris, kristof.beyls, llvm-commits

Differential Revision: https://reviews.llvm.org/D31054

llvm-svn: 299538