platform/upstream/llvm.git
9 years agollvm-pdbdump: Improve printing of functions and signatures.
Zachary Turner [Fri, 13 Feb 2015 17:57:09 +0000 (17:57 +0000)]
llvm-pdbdump: Improve printing of functions and signatures.

This correctly prints the function pointers, and also prints
function signatures for symbols as opposed to just types.  So
actual functions in your program will now be printed with full
name and signature, as opposed to just name as before.

llvm-svn: 229129

9 years ago[mips][microMIPS] Delay slot filler: Replace the microMIPS JR with the JRC
Jozef Kolek [Fri, 13 Feb 2015 17:51:27 +0000 (17:51 +0000)]
[mips][microMIPS] Delay slot filler: Replace the microMIPS JR with the JRC

This patch adds functionality in MIPS delay slot filler such as if delay slot
filler have to put NOP instruction into the delay slot of microMIPS JR
instruction, then instead of emitting NOP this instruction is replaced by
compact jump instruction JRC.

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

llvm-svn: 229128

9 years agotsan: don't initialize trace header in release mode
Dmitry Vyukov [Fri, 13 Feb 2015 17:39:03 +0000 (17:39 +0000)]
tsan: don't initialize trace header in release mode

We are going to use only a small part of the trace with the default
value of history_size. However, the constructor writes to the whole trace.
It writes mostly zeros, so freshly mmaped memory will do.
The only non-zero field if mutex type used for debugging.

Reduces per-goroutine overhead by 8K.

https://code.google.com/p/thread-sanitizer/issues/detail?id=89

llvm-svn: 229127

9 years agounwind: use sizeof() instead of hardcoded sizes
Saleem Abdulrasool [Fri, 13 Feb 2015 17:36:11 +0000 (17:36 +0000)]
unwind: use sizeof() instead of hardcoded sizes

The statically allocated strings have a fixed size which can be computed using
the sizeof operator rather than duplicating the allocation size which can drift.
NFC.

llvm-svn: 229126

9 years agoFix Arg0 argument after r229110. The problem was that Arg0ValueChangedCallback isn...
Ilia K [Fri, 13 Feb 2015 17:07:55 +0000 (17:07 +0000)]
Fix Arg0 argument after r229110. The problem was that Arg0ValueChangedCallback isn't twitching when Arg0 was updated, therefore target was launched with empty 1st argument or without it at all. In this patch I update Arg0 by hand.

llvm-svn: 229125

9 years ago[InstCombine] Fix regression introduced at r227197.
Andrea Di Biagio [Fri, 13 Feb 2015 16:33:34 +0000 (16:33 +0000)]
[InstCombine] Fix regression introduced at r227197.

This patch fixes a problem I accidentally introduced in an instruction combine
on select instructions added at r227197. That revision taught the instruction
combiner how to fold a cttz/ctlz followed by a icmp plus select into a single
cttz/ctlz with flag 'is_zero_undef' cleared.

However, the new rule added at r227197 would have produced wrong results in the
case where a cttz/ctlz with flag 'is_zero_undef' cleared was follwed by a
zero-extend or truncate. In that case, the folded instruction would have
been inserted in a wrong location thus leaving the CFG in an inconsistent
state.

This patch fixes the problem and add two reproducible test cases to
existing test 'InstCombine/select-cmp-cttz-ctlz.ll'.

llvm-svn: 229124

9 years agoRevert r229082 for a bit, it caused PR22577.
Nico Weber [Fri, 13 Feb 2015 16:27:00 +0000 (16:27 +0000)]
Revert r229082 for a bit, it caused PR22577.

llvm-svn: 229123

9 years agoHelp: Document how to build and install with CMake.
Tom Stellard [Fri, 13 Feb 2015 16:15:32 +0000 (16:15 +0000)]
Help: Document how to build and install with CMake.

Resolves PR21569.

Patch by: Stephen Kelly

llvm-svn: 229122

9 years agoHelp: Document the minimum CMake version required.
Tom Stellard [Fri, 13 Feb 2015 16:15:29 +0000 (16:15 +0000)]
Help: Document the minimum CMake version required.

Patch by: Stephen Kelly

llvm-svn: 229121

9 years agotsan: fix build
Dmitry Vyukov [Fri, 13 Feb 2015 16:08:43 +0000 (16:08 +0000)]
tsan: fix build

llvm-svn: 229120

9 years agoRooting out more undefined behavior in char_traits.
Marshall Clow [Fri, 13 Feb 2015 16:04:42 +0000 (16:04 +0000)]
Rooting out more undefined behavior in char_traits.

llvm-svn: 229119

9 years agoAdd run line that was missing in r228999.
Akira Hatanaka [Fri, 13 Feb 2015 16:00:03 +0000 (16:00 +0000)]
Add run line that was missing in r228999.

Also, change the run lines to use -allow-empty.

llvm-svn: 229118

9 years agotsan: reduce history size in Go mode
Dmitry Vyukov [Fri, 13 Feb 2015 15:59:23 +0000 (15:59 +0000)]
tsan: reduce history size in Go mode

The ContainsSameAccess optimization substantially reduces pressure
on trace by eliminating duplicate accesses. So now we can reduce
default trace size to reduce per-goroutine memory consumption.
Current default size is 64K events, new -- 32K events.
In either case user can change it with GORACE env var.

Reduces per-goroutine memory consumption from 356K to 226K.

llvm-svn: 229117

9 years agotsan: disable deadlock detector in Go mode
Dmitry Vyukov [Fri, 13 Feb 2015 15:44:50 +0000 (15:44 +0000)]
tsan: disable deadlock detector in Go mode

Go does not use that.
https://code.google.com/p/thread-sanitizer/issues/detail?id=89

llvm-svn: 229116

9 years agotsan: remove internal deadlock detector from ThreadState in Go mode
Dmitry Vyukov [Fri, 13 Feb 2015 15:37:11 +0000 (15:37 +0000)]
tsan: remove internal deadlock detector from ThreadState in Go mode

Go does not use that.
https://code.google.com/p/thread-sanitizer/issues/detail?id=89

llvm-svn: 229115

9 years agoAppease buildbots
Jonathan Roelofs [Fri, 13 Feb 2015 15:34:01 +0000 (15:34 +0000)]
Appease buildbots

llvm-svn: 229114

9 years agotsan: reduce size of vector clock in Go mode
Dmitry Vyukov [Fri, 13 Feb 2015 15:32:34 +0000 (15:32 +0000)]
tsan: reduce size of vector clock in Go mode

Go does not have freed memory.
Reduces per-goroutine overhead from 455K to 356K.

https://code.google.com/p/thread-sanitizer/issues/detail?id=89

llvm-svn: 229113

9 years agotsan: remove stats from ThreadState ifndef TSAN_COLLECT_STATS
Dmitry Vyukov [Fri, 13 Feb 2015 15:25:47 +0000 (15:25 +0000)]
tsan: remove stats from ThreadState ifndef TSAN_COLLECT_STATS

Issue 89: Uses a lot of memory for each goroutine
https://code.google.com/p/thread-sanitizer/issues/detail?id=89

llvm-svn: 229112

9 years agoModularize TargetInfo discovery in the lit config
Jonathan Roelofs [Fri, 13 Feb 2015 15:25:21 +0000 (15:25 +0000)]
Modularize TargetInfo discovery in the lit config

When the remote execution patch lands, this will allow us to drop in a
replacement TargetInfo object for locale support discovery, alleviating
the assumption that host==target.

http://reviews.llvm.org/D7601

llvm-svn: 229111

9 years agoAdd -exec-arguments command
Ilia K [Fri, 13 Feb 2015 14:31:06 +0000 (14:31 +0000)]
Add -exec-arguments command

Summary:
This patch adds -exec-arguments command for lldb-mi. -exec-arguments command allows to specify arguments for executable file in MI mode. Also it contains tests for that command.

Btw, new added files was formatted by clang-format.

Reviewers: abidh, zturner, clayborg

Reviewed By: clayborg

Subscribers: zturner, emaste, clayborg, jingham, lldb-commits

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

llvm-svn: 229110

9 years agoRemove file not used anywhere.
Jean-Daniel Dupas [Fri, 13 Feb 2015 14:30:22 +0000 (14:30 +0000)]
Remove file not used anywhere.

llvm-svn: 229109

9 years agoMoved header list loading to new class. This is staging for adding module map loading...
John Thompson [Fri, 13 Feb 2015 14:29:22 +0000 (14:29 +0000)]
Moved header list loading to new class. This is staging for adding module map loading and checking support.

llvm-svn: 229108

9 years agoUsing 'isa' instead of 'dyn_cast'
Jean-Daniel Dupas [Fri, 13 Feb 2015 14:28:18 +0000 (14:28 +0000)]
Using 'isa' instead of 'dyn_cast'

llvm-svn: 229107

9 years agotsan: fix stack printing
Dmitry Vyukov [Fri, 13 Feb 2015 14:27:43 +0000 (14:27 +0000)]
tsan: fix stack printing

strip_path_prefix was not stripped from file names.

llvm-svn: 229106

9 years ago[CodeGenPrepare] Removed duplicate logic. SimplifyCFG already knows how to speculate...
Andrea Di Biagio [Fri, 13 Feb 2015 14:15:48 +0000 (14:15 +0000)]
[CodeGenPrepare] Removed duplicate logic. SimplifyCFG already knows how to speculate calls to cttz/ctlz.

SimplifyCFG now knows how to speculate calls to intrinsic cttz/ctlz that are
'cheap' for the target. Therefore, some of the logic in CodeGenPrepare
that was originally added at revision 224899 can now be removed.

This patch is basically a no functional change. It removes the duplicated
logic in CodeGenPrepare and converts all the existing target specific tests
for cttz/ctlz into SimplifyCFG tests.

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

llvm-svn: 229105

9 years agoFix configure+make build broken by r228943 (part 2)
Tamas Berghammer [Fri, 13 Feb 2015 12:27:24 +0000 (12:27 +0000)]
Fix configure+make build broken by r228943 (part 2)

llvm-svn: 229104

9 years ago[PBQP] Conservativelly allocatable nodes can be spilled and give a better solution
Arnaud A. de Grandmaison [Fri, 13 Feb 2015 12:04:42 +0000 (12:04 +0000)]
[PBQP] Conservativelly allocatable nodes can be spilled and give a better solution

Although such nodes are allocatable, the cost of spilling may be less than
allocating to register, so spilling the node may provide a better solution.
The assert does not account for this case, so remove it for now.

llvm-svn: 229103

9 years agoFix for http://llvm.org/bugs/show_bug.cgi?id=21744
Hafiz Abid Qadeer [Fri, 13 Feb 2015 11:53:50 +0000 (11:53 +0000)]
Fix for http://llvm.org/bugs/show_bug.cgi?id=21744

GetVariableInfo () collected the values of the variable in a list. But it also
tried to generate the name/value pairs for children. This caused generation of
a wrong value string for may items. This function has been fixed to put value in
the list only.

The handling of --print-value related option has been moved to caller.

GetVariableInfo2 and MIResponseFormVariableInfo3 have been removed. They were
almost the duplicate of functions of similar names. I dont see any difference in
the output of -stack-list-locals and -stack-list-arguments. So these functions
just seemed unnecessary.

Char variable was being printed as a string which caused garbage output. This has
been fixed.

Some misc. cleanup.

Test cases have been added that check -stack-list-locals for struct, array and
pointers. Modified other tests which depended on hard coded line numbers.

Reviewed in http://reviews.llvm.org/D7589

llvm-svn: 229102

9 years ago[SimplifyCFG] Add test for r229099
James Molloy [Fri, 13 Feb 2015 11:08:40 +0000 (11:08 +0000)]
[SimplifyCFG] Add test for r229099

Add extra test that was accidentally not staged.

llvm-svn: 229101

9 years agoFix build after r229094: replace llvm/PassManager.h -> llvm/IR/LegacyPassManager.h
Ilia K [Fri, 13 Feb 2015 10:49:18 +0000 (10:49 +0000)]
Fix build after r229094: replace llvm/PassManager.h -> llvm/IR/LegacyPassManager.h

llvm-svn: 229100

9 years ago[SimplifyCFG] Be more aggressive
James Molloy [Fri, 13 Feb 2015 10:48:30 +0000 (10:48 +0000)]
[SimplifyCFG] Be more aggressive

Up the phi node folding threshold from a cheap "1" to a meagre "2".

Update tests for extra added selects and slight code churn.

llvm-svn: 229099

9 years agoFix configure+make build broken by r228943
Tamas Berghammer [Fri, 13 Feb 2015 10:39:23 +0000 (10:39 +0000)]
Fix configure+make build broken by r228943

llvm-svn: 229098

9 years ago[mips] Improve support for the .set at/noat assembler directives.
Toma Tabacu [Fri, 13 Feb 2015 10:30:57 +0000 (10:30 +0000)]
[mips] Improve support for the .set at/noat assembler directives.

Summary:
Made the following changes:
  Added calls to emitDirectiveSetNoAt() and emitDirectiveSetAt().
  Added special emit function for .set at=$reg, emitDirectiveSetAtWithArg(unsigned RegNo).
  Improved parsing error checks for .set at.
  Refactored parser code for .set at.
  Improved testing of both directives.
  Improved code readability and comments.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 229097

9 years agoDisable a warning for the python modules as the python C API headers
Chandler Carruth [Fri, 13 Feb 2015 10:22:00 +0000 (10:22 +0000)]
Disable a warning for the python modules as the python C API headers
trigger this warning. With this, 'ninja' succeeds without warnings for
me on Linux.

llvm-svn: 229096

9 years ago[PM] Update the examples to reflect the removal of the
Chandler Carruth [Fri, 13 Feb 2015 10:21:05 +0000 (10:21 +0000)]
[PM] Update the examples to reflect the removal of the
llvm/PassManager.h wrapper header and its using declarations. These now
directly use the legacy namespace.

I had updated the #include lines in my large commit but forgot that the
examples weren't being built and didn't update the code to use the
correct namespace. Sorry for the noise here.

llvm-svn: 229095

9 years ago[PM] Remove the old 'PassManager.h' header file at the top level of
Chandler Carruth [Fri, 13 Feb 2015 10:01:29 +0000 (10:01 +0000)]
[PM] Remove the old 'PassManager.h' header file at the top level of
LLVM's include tree and the use of using declarations to hide the
'legacy' namespace for the old pass manager.

This undoes the primary modules-hostile change I made to keep
out-of-tree targets building. I sent an email inquiring about whether
this would be reasonable to do at this phase and people seemed fine with
it, so making it a reality. This should allow us to start bootstrapping
with modules to a certain extent along with making it easier to mix and
match headers in general.

The updates to any code for users of LLVM are very mechanical. Switch
from including "llvm/PassManager.h" to "llvm/IR/LegacyPassManager.h".
Qualify the types which now produce compile errors with "legacy::". The
most common ones are "PassManager", "PassManagerBase", and
"FunctionPassManager".

llvm-svn: 229094

9 years agoRemove a stray blank line that my sort_include.py script found.
Chandler Carruth [Fri, 13 Feb 2015 09:57:05 +0000 (09:57 +0000)]
Remove a stray blank line that my sort_include.py script found.

llvm-svn: 229093

9 years ago[PM] Fix #include order here that I forgot to update before changing it.
Chandler Carruth [Fri, 13 Feb 2015 09:57:03 +0000 (09:57 +0000)]
[PM] Fix #include order here that I forgot to update before changing it.

llvm-svn: 229092

9 years ago[PM] Convert Polly over to directly use the legacy pass manager
Chandler Carruth [Fri, 13 Feb 2015 09:51:50 +0000 (09:51 +0000)]
[PM] Convert Polly over to directly use the legacy pass manager
namespace and header rather than the top-level header and using
declarations. These helpers impede modular builds and are going away.
Migrating away from them will also be necessary to start mixing in any
usage of the new pass manager.

llvm-svn: 229091

9 years ago[PM] Move away from the old llvm/PassManager.h header and its using
Chandler Carruth [Fri, 13 Feb 2015 09:47:49 +0000 (09:47 +0000)]
[PM] Move away from the old llvm/PassManager.h header and its using
declarations and just use the legacy namespace qualifier in this file
and the permanent header name.

The old wrapper header is going away to make LLVM's build more modular,
and without updating Clang I can't easily start to add usage of the new
pass manager to Clang. This should make it more clear in the code which
set of types is doing what.

llvm-svn: 229090

9 years agoRe-sort the #include lines in bindings and examples which I managed to
Chandler Carruth [Fri, 13 Feb 2015 09:14:30 +0000 (09:14 +0000)]
Re-sort the #include lines in bindings and examples which I managed to
miss previously.

llvm-svn: 229089

9 years agoRe-sort #include lines using my handy dandy ./utils/sort_includes.py
Chandler Carruth [Fri, 13 Feb 2015 09:09:03 +0000 (09:09 +0000)]
Re-sort #include lines using my handy dandy ./utils/sort_includes.py
script. This is in preparation for changes to lots of include lines.

llvm-svn: 229088

9 years agoRe-sort includes using the LLVM utils/sort_includes.py script.
Chandler Carruth [Fri, 13 Feb 2015 09:07:58 +0000 (09:07 +0000)]
Re-sort includes using the LLVM utils/sort_includes.py script.

llvm-svn: 229087

9 years agoFix the last two warnings I see on Linx building 'lldb': mismatched
Chandler Carruth [Fri, 13 Feb 2015 08:16:15 +0000 (08:16 +0000)]
Fix the last two warnings I see on Linx building 'lldb': mismatched
signed and unsigned types in comparisons.

For the text offset, use the addr_t type that is used elsewhere to get
these kinds of offsets, and which it is being compared against. This
seems to make things more consistent.

For the other, the numbers are clearly small and uninteresting, so just
cast them to the most boring 'int' type.

llvm-svn: 229085

9 years agoFix four missing 'override' specifiers found with the Clang
Chandler Carruth [Fri, 13 Feb 2015 08:07:00 +0000 (08:07 +0000)]
Fix four missing 'override' specifiers found with the Clang
'-Winconsistent-missing-override' warning. I suggest folks use this to
ensure that override is consistently used to mark virtual function
overrides.

llvm-svn: 229084

9 years agoRemove an unused variable found with a Clang warning.
Chandler Carruth [Fri, 13 Feb 2015 08:04:18 +0000 (08:04 +0000)]
Remove an unused variable found with a Clang warning.

llvm-svn: 229083

9 years agoMS ABI: Implement /volatile:ms
David Majnemer [Fri, 13 Feb 2015 07:55:47 +0000 (07:55 +0000)]
MS ABI: Implement /volatile:ms

The /volatile:ms semantics turn volatile loads and stores into atomic
acquire and release operations.  This distinction is important because
volatile memory operations do not form a happens-before relationship
with non-atomic memory.  This means that a volatile store is not
sufficient for implementing a mutex unlock routine.

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

llvm-svn: 229082

9 years agoFix the windows build *again*. Grrr, MSVC.
Zachary Turner [Fri, 13 Feb 2015 07:55:29 +0000 (07:55 +0000)]
Fix the windows build *again*.  Grrr, MSVC.

llvm-svn: 229081

9 years agoRevert a series of commits starting at r228886 which is triggering some
Chandler Carruth [Fri, 13 Feb 2015 07:52:39 +0000 (07:52 +0000)]
Revert a series of commits starting at r228886 which is triggering some
regressions for LLDB on Linux. Rafael indicated on lldb-dev that we
should just go ahead and revert these but that he wasn't at a computer.
The patches backed out are as follows:

r228980: Add support for having multiple sections with the name and ...
r228889: Invert the section relocation map.
r228888: Use the existing SymbolTableIndex intsead of doing a lookup.
r228886: Create the Section -> Rel Section map when it is first needed.

These patches look pretty nice to me, so hoping its not too hard to get
them re-instated. =D

llvm-svn: 229080

9 years agoFix non-windows builds unhappy about a missing header.
Zachary Turner [Fri, 13 Feb 2015 07:45:49 +0000 (07:45 +0000)]
Fix non-windows builds unhappy about a missing header.

llvm-svn: 229079

9 years ago[X86] Add support for parsing and printing the mnemonic aliases for the XOP VPCOM...
Craig Topper [Fri, 13 Feb 2015 07:42:25 +0000 (07:42 +0000)]
[X86] Add support for parsing and printing the mnemonic aliases for the XOP VPCOM instructions.

llvm-svn: 229078

9 years ago[X86] Fix XOP vpcom intrinsic autoupgrade to map 'true' and 'false' to the correct...
Craig Topper [Fri, 13 Feb 2015 07:42:15 +0000 (07:42 +0000)]
[X86] Fix XOP vpcom intrinsic autoupgrade to map 'true' and 'false' to the correct immediates. Seems they were swapped.

llvm-svn: 229077

9 years agollvm-pdbdump: Add more comprehensive dumping of symbol types.
Zachary Turner [Fri, 13 Feb 2015 07:40:03 +0000 (07:40 +0000)]
llvm-pdbdump: Add more comprehensive dumping of symbol types.

In particular this patch adds the ability to dump complete
function signature information including argument types as
correctly formatted strings.  A side effect of this is that
almost all symbol and meta types are now formatted.

llvm-svn: 229076

9 years agoInstCombine: cleanup redundant dyn_cast<> (NFC)
Mehdi Amini [Fri, 13 Feb 2015 07:38:04 +0000 (07:38 +0000)]
InstCombine: cleanup redundant dyn_cast<> (NFC)

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

9 years agoDon't use bzero() and strcpy().
Ed Schouten [Fri, 13 Feb 2015 07:18:22 +0000 (07:18 +0000)]
Don't use bzero() and strcpy().

Instead of bzero(), we can simply use memset(). The strcpy() calls are
unneeded, as we can simply keep track of a pointer to the constant
strings we are copying.

Reviewed by: Jonathan Roelofs

llvm-svn: 229074

9 years ago[X86] Fix test cases that I foolishly copied and modified from another file that...
Craig Topper [Fri, 13 Feb 2015 06:27:39 +0000 (06:27 +0000)]
[X86] Fix test cases that I foolishly copied and modified from another file that had optimizations on. This caused the check patterns to not quite match.

llvm-svn: 229073

9 years agoELF/AArch64: Add support for checking for ABS32 overflow
Will Newton [Fri, 13 Feb 2015 06:22:31 +0000 (06:22 +0000)]
ELF/AArch64: Add support for checking for ABS32 overflow

Add support for checking overflow when applying a R_AARCH64_ABS32
relocation and add a test to ensure it behaves correctly.

llvm-svn: 229072

9 years agoFix a typo in a comment. NFC
Craig Topper [Fri, 13 Feb 2015 06:07:29 +0000 (06:07 +0000)]
Fix a typo in a comment. NFC

llvm-svn: 229071

9 years agoFix probable typo in test.
Craig Topper [Fri, 13 Feb 2015 06:07:27 +0000 (06:07 +0000)]
Fix probable typo in test.

llvm-svn: 229070

9 years ago[X86] Remove int_x86_sse2_psll_dq_bs and int_x86_sse2_psrl_dq_bs intrinsics. The...
Craig Topper [Fri, 13 Feb 2015 06:07:24 +0000 (06:07 +0000)]
[X86] Remove int_x86_sse2_psll_dq_bs and int_x86_sse2_psrl_dq_bs intrinsics. The builtins aren't used by clang.

llvm-svn: 229069

9 years ago[X86] Remove references to builtin names that have been removed from clang. Hope...
Craig Topper [Fri, 13 Feb 2015 06:07:14 +0000 (06:07 +0000)]
[X86] Remove references to builtin names that have been removed from clang. Hope to remove the intrinsics themselves soon.

llvm-svn: 229068

9 years ago[X86] Add range checking on immediate arguments on XOP vpcom builtins.
Craig Topper [Fri, 13 Feb 2015 06:04:48 +0000 (06:04 +0000)]
[X86] Add range checking on immediate arguments on XOP vpcom builtins.

llvm-svn: 229067

9 years ago[X86] Add _mm_bslli_si128 and _mm_bsrli_si128 as aliases of _mm_slli_si128 and _mm_sr...
Craig Topper [Fri, 13 Feb 2015 06:04:45 +0000 (06:04 +0000)]
[X86] Add _mm_bslli_si128 and _mm_bsrli_si128 as aliases of _mm_slli_si128 and _mm_srli_si128. This matches Intel documentation and gcc.

llvm-svn: 229066

9 years ago[X86] Simplify some code and remove some -Wshadow disables from intrinsic header.
Craig Topper [Fri, 13 Feb 2015 06:04:43 +0000 (06:04 +0000)]
[X86] Simplify some code and remove some -Wshadow disables from intrinsic header.

llvm-svn: 229065

9 years ago[unroll] Concede defeat and disable the unroll analyzer for now.
Chandler Carruth [Fri, 13 Feb 2015 05:31:46 +0000 (05:31 +0000)]
[unroll] Concede defeat and disable the unroll analyzer for now.

The issues with the new unroll analyzer are more fundamental than code
cleanup, algorithm, or data structure changes. I've sent an email to the
original commit thread with details and a proposal for how to redesign
things. I'm disabling this for now so that we don't spend time
debugging issues with it in its current state.

llvm-svn: 229064

9 years ago[InstCombine] Fix a bug when combining `icmp` from `ptrtoint`
Michael Liao [Fri, 13 Feb 2015 04:51:26 +0000 (04:51 +0000)]
[InstCombine] Fix a bug when combining `icmp` from `ptrtoint`

- First, there's a crash when we try to combine that pointers into `icmp`
  directly by creating a `bitcast`, which is invalid if that two pointers are
  from different address spaces.

- It's not always appropriate to cast one pointer to another if they are from
  different address spaces as that is not no-op cast. Instead, we only combine
  `icmp` from `ptrtoint` if that two pointers are of the same address space.

llvm-svn: 229063

9 years ago[unroll] Merge the simplification and DCE estimation methods on the
Chandler Carruth [Fri, 13 Feb 2015 04:39:05 +0000 (04:39 +0000)]
[unroll] Merge the simplification and DCE estimation methods on the
UnrollAnalyzer.

Now they share a single worklist and have less implicit state between
them. There was no real benefit to separating these two things out.

I'm going to subsequently refactor things to share even more code.

llvm-svn: 229062

9 years ago[unroll] Remove pointless dyn_cast<>s to Instruction - the users of an
Chandler Carruth [Fri, 13 Feb 2015 04:33:21 +0000 (04:33 +0000)]
[unroll] Remove pointless dyn_cast<>s to Instruction - the users of an
instruction must by definition be instructions.

llvm-svn: 229061

9 years ago[unroll] Don't check the loop set for whether an instruction is
Chandler Carruth [Fri, 13 Feb 2015 04:30:44 +0000 (04:30 +0000)]
[unroll] Don't check the loop set for whether an instruction is
contained in it each time we try to add it to the worklist, just check
this when pulling it off the worklist. That way we do it at most once
per instruction with the cost of the worklist set we would need to pay
anyways.

llvm-svn: 229060

9 years ago[unroll] Change the other worklist in the unroll analyzer to be a set
Chandler Carruth [Fri, 13 Feb 2015 04:27:50 +0000 (04:27 +0000)]
[unroll] Change the other worklist in the unroll analyzer to be a set
vector.

In addition to dramatically reducing the work required for contrived
example loops, this also has to correct some serious latent bugs in the
cost computation. Previously, we might add an instruction onto the
worklist once for every load which it used and was simplified. Then we
would visit it many times and accumulate "savings" each time.

I mean, fortunately this couldn't matter for things like calls with 100s
of operands, but even for binary operators this code seems like it must
be double counting the savings.

I just noticed this by inspection and due to the runtime problems it can
introduce, I don't have any test cases for cases where the cost produced
by this routine is unacceptable.

llvm-svn: 229059

9 years ago[unroll] Replace a boolean, for loop, condition, and break with
Chandler Carruth [Fri, 13 Feb 2015 04:18:14 +0000 (04:18 +0000)]
[unroll] Replace a boolean, for loop, condition, and break with
std::all_of and a lambda. Much cleaner, no functionality
changed.

llvm-svn: 229058

9 years ago[unroll] Directly query for dead instructions.
Chandler Carruth [Fri, 13 Feb 2015 04:14:05 +0000 (04:14 +0000)]
[unroll] Directly query for dead instructions.

In the unroll analyzer, it is checking each user to see if that user
will become dead. However, it first checked if that user was missing
from the simplified values map, and then if was also missing from the
dead instructions set. We add everything from the simplified values map
to the dead instructions set, so the first step is completely subsumed
by the second. Moreover, the first step requires *inserting* something
into the simplified value map which isn't what we want at all.

This also replaces a dyn_cast with a cast as an instruction cannot be
used by a non-instruction.

llvm-svn: 229057

9 years ago[unroll] Replace a linear time check for no uses with a constant time
Chandler Carruth [Fri, 13 Feb 2015 04:06:08 +0000 (04:06 +0000)]
[unroll] Replace a linear time check for no uses with a constant time
check.

Also hoist this into the enqueue process as it is faster even than
testing the worklist set, we should just directly filter these out much
like we filter out constants and such.

llvm-svn: 229056

9 years agoRemove unused parameters.
Rui Ueyama [Fri, 13 Feb 2015 04:02:55 +0000 (04:02 +0000)]
Remove unused parameters.

llvm-svn: 229055

9 years ago[unroll] Rather than an operand set, use a setvector for the worklist.
Chandler Carruth [Fri, 13 Feb 2015 03:57:40 +0000 (03:57 +0000)]
[unroll] Rather than an operand set, use a setvector for the worklist.

We don't just want to handle duplicate operands within an instruction,
but also duplicates across operands of different instructions. I should
have gone straight to this, but I had convinced myself that it wasn't
going to be necessary briefly. I've come to my senses after chatting
more with Nick, and am now happier here.

llvm-svn: 229054

9 years ago[unroll] Extract the code to enqueue operansd for the worklist in the
Chandler Carruth [Fri, 13 Feb 2015 03:49:41 +0000 (03:49 +0000)]
[unroll] Extract the code to enqueue operansd for the worklist in the
unroll analysis into a lambda and call it. That's much simpler than
duplicating all the code.

llvm-svn: 229053

9 years ago[unroll] Use a small set to de-duplicate operands prior to putting them
Chandler Carruth [Fri, 13 Feb 2015 03:48:38 +0000 (03:48 +0000)]
[unroll] Use a small set to de-duplicate operands prior to putting them
into the worklist. This avoids allocating lots of worklist memory for
them when there are large numbers of repeated operands.

llvm-svn: 229052

9 years agoRemove KindArcH::PowerPC and sort enums alphabetically.
Rui Ueyama [Fri, 13 Feb 2015 03:47:34 +0000 (03:47 +0000)]
Remove KindArcH::PowerPC and sort enums alphabetically.

llvm-svn: 229051

9 years ago[unroll] Make the unroll cost analysis terminate deterministically and
Chandler Carruth [Fri, 13 Feb 2015 03:40:58 +0000 (03:40 +0000)]
[unroll] Make the unroll cost analysis terminate deterministically and
reasonably quickly.

I don't have a reduced test case, but for a version of FFMPEG, this
makes the loop unroller start finishing at all (after over 15 minutes of
running, it hadn't terminated for me, no idea if it was a true infloop
or just exponential work).

The key thing here is to check the DeadInstructions set when pulling
things off the worklist. Without this, we would re-walk the user list of
already dead instructions again and again and again. Consider phi nodes
with many, many operands and other patterns.

The other important aspect of this is that because we would keep
re-visiting instructions that were already known dead, we kept adding
their cost savings to this! This would cause our cost savings to be
*insanely* inflated from this.

While I was here, I also rotated the operand walk out of the worklist
loop to make the code easier to read. There is still work to be done to
minimize worklist traffic because we don't de-duplicate operands. This
means we may add the same instruction onto the worklist 1000s of times
if it shows up in 1000s of operansd to a PHI node for example.

Still, with this patch, the ffmpeg testcase I have finishes quickly and
I can't measure the runtime impact of the unroll analysis any more. I'll
probably try to do a few more cleanups to this code, but not sure how
much cleanup I can justify right now.

llvm-svn: 229038

9 years agoIR: Drop never-used defaults for DIBuilder::createTemplate*(), NFC
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 03:35:29 +0000 (03:35 +0000)]
IR: Drop never-used defaults for DIBuilder::createTemplate*(), NFC

No caller specifies anything different; these parameters are dead code
and probably always have been.  The new hierarchy doesn't bother with
the fields at all (see r228607 and r228652).

llvm-svn: 229037

9 years agoFix error checking in get_temp_file_name().
Dan Albert [Fri, 13 Feb 2015 03:02:28 +0000 (03:02 +0000)]
Fix error checking in get_temp_file_name().

Checking errno without first checking that the call failed means that
if some other call prior to mkstemp failed with EINVAL prior to this,
the assert would fire even if mkstemp succeeded. If something failed
with EEXIST, it would go in to an infinite loop.

Change-Id: I3f140a3e15fe08664a38a8c9a950c4ed547eb481
llvm-svn: 229035

9 years agoR600/SI: Remove unnecessary check for fpimm
Matt Arsenault [Fri, 13 Feb 2015 02:47:22 +0000 (02:47 +0000)]
R600/SI: Remove unnecessary check for fpimm

llvm-svn: 229034

9 years ago[unroll] Make range based for loops a bit more explicit and more
Chandler Carruth [Fri, 13 Feb 2015 02:45:17 +0000 (02:45 +0000)]
[unroll] Make range based for loops a bit more explicit and more
readable.

The biggest thing that was causing me problems is recognizing the
references vs. poniters here. I also found that for maps naming the loop
variable as KeyValue helps make it obvious why you don't actually use it
directly. Finally, using 'auto' instead of 'User *' doesn't seem like
a good tradeoff. Much like with the other cases, I like to know its
a pointer, and 'User' is just as long and tells the reader a lot more.

llvm-svn: 229033

9 years agoBitcode: Remove confusing '?' from r229004, NFC
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 02:43:38 +0000 (02:43 +0000)]
Bitcode: Remove confusing '?' from r229004, NFC

The name is always part of the record, it just might be empty.  Remove
the `?` for clarity.

llvm-svn: 229032

9 years agoBitcode: Add trailing comma to MetadataCodes, NFC
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 02:41:36 +0000 (02:41 +0000)]
Bitcode: Add trailing comma to MetadataCodes, NFC

Suggested in the review of r229004, this should simplify diffs
in the future.

llvm-svn: 229031

9 years agoRemove class that really does nothing.
Rui Ueyama [Fri, 13 Feb 2015 02:34:08 +0000 (02:34 +0000)]
Remove class that really does nothing.

llvm-svn: 229030

9 years ago[IC] Fix a bug with the instcombine canonicalizing of loads and
Chandler Carruth [Fri, 13 Feb 2015 02:30:01 +0000 (02:30 +0000)]
[IC] Fix a bug with the instcombine canonicalizing of loads and
propagating of metadata.

We were propagating !nonnull metadata even when the newly formed load is
no longer of a pointer type. This is clearly broken and results in LLVM
failing the verifier and aborting. This patch just restricts the
propagation of !nonnull metadata to when we actually have a pointer
type.

This bug report and the initial version of this patch was provided by
Charles Davis! Many thanks for finding this!

We still need to add logic to round-trip the metadata correctly if we
combine from pointer types to integer types and then back by using range
metadata for the integer type loads. But this is the minimal and safe
version of the patch, which is important so we can backport it into 3.6.

llvm-svn: 229029

9 years ago[unroll] Avoid the "Insn" abbreviation of Instruction. This is quite
Chandler Carruth [Fri, 13 Feb 2015 02:17:39 +0000 (02:17 +0000)]
[unroll] Avoid the "Insn" abbreviation of Instruction. This is quite
hard to type and read for me, and is inconsistent with the other
abbreviation in the base class "Inst". For most of these (where they are
used widely) I prefer just spelling it out as Instruction. I've changed
two of the short-lived variables to use "Inst" to match the base class.

llvm-svn: 229028

9 years agoCheck interleaving without relying on debug output.
Olivier Sallenave [Fri, 13 Feb 2015 02:13:57 +0000 (02:13 +0000)]
Check interleaving without relying on debug output.

llvm-svn: 229027

9 years ago[unroll] Tidy up the integer we use to accumululate the number of
Chandler Carruth [Fri, 13 Feb 2015 02:10:56 +0000 (02:10 +0000)]
[unroll] Tidy up the integer we use to accumululate the number of
instructions optimized. NFC, just separating this out from the
functionality changing commit.

llvm-svn: 229026

9 years agoAsmWriter/Bitcode: MDImportedEntity
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 01:46:02 +0000 (01:46 +0000)]
AsmWriter/Bitcode: MDImportedEntity

llvm-svn: 229025

9 years agoAsmWriter/Bitcode: MDObjCProperty
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 01:43:22 +0000 (01:43 +0000)]
AsmWriter/Bitcode: MDObjCProperty

llvm-svn: 229024

9 years agoAsmWriter/Bitcode: MDExpression
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 01:42:09 +0000 (01:42 +0000)]
AsmWriter/Bitcode: MDExpression

llvm-svn: 229023

9 years agoAsmWriter/Bitcode: MDLocalVariable
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 01:39:44 +0000 (01:39 +0000)]
AsmWriter/Bitcode: MDLocalVariable

llvm-svn: 229022

9 years agoFix the build, I forgot to check that UnitTests still built.
Zachary Turner [Fri, 13 Feb 2015 01:39:22 +0000 (01:39 +0000)]
Fix the build, I forgot to check that UnitTests still built.

llvm-svn: 229021

9 years agoAsmWriter/Bitcode: MDGlobalVariable
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 01:35:40 +0000 (01:35 +0000)]
AsmWriter/Bitcode: MDGlobalVariable

llvm-svn: 229020

9 years agoAsmWriter/Bitcode: MDTemplate{Type,Value}Parameter
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 01:34:32 +0000 (01:34 +0000)]
AsmWriter/Bitcode: MDTemplate{Type,Value}Parameter

llvm-svn: 229019

9 years agoAsmWriter/Bitcode: MDNamespace
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 01:32:09 +0000 (01:32 +0000)]
AsmWriter/Bitcode: MDNamespace

llvm-svn: 229018

9 years agoAsmWriter/Bitcode: MDLexicalBlockFile
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 01:30:42 +0000 (01:30 +0000)]
AsmWriter/Bitcode: MDLexicalBlockFile

llvm-svn: 229017

9 years agoAsmWriter/Bitcode: MDLexicalBlock
Duncan P. N. Exon Smith [Fri, 13 Feb 2015 01:29:28 +0000 (01:29 +0000)]
AsmWriter/Bitcode: MDLexicalBlock

llvm-svn: 229016