platform/upstream/llvm.git
9 years agoFixed a problem that UBSAN found, where we were calling memcmp(null, p, 0) - which...
Marshall Clow [Thu, 12 Feb 2015 19:58:06 +0000 (19:58 +0000)]
Fixed a problem that UBSAN found, where we were calling memcmp(null, p, 0) - which is undefined behavior

llvm-svn: 228952

9 years agoAdd a testcase for r228432.
Michael Zolotukhin [Thu, 12 Feb 2015 19:57:24 +0000 (19:57 +0000)]
Add a testcase for r228432.

llvm-svn: 228951

9 years agoTry to fix the MSVC build.
Benjamin Kramer [Thu, 12 Feb 2015 19:53:49 +0000 (19:53 +0000)]
Try to fix the MSVC build.

0xFFFFFFFFFFFFFFFFLL doesn't fit in a long long so it should have
type 'unsigned long long'. MSVC thinks it's a (signed) __int64.

llvm-svn: 228950

9 years agogold-plugin: delete the output file for OT_DISABLE
Michael Kuperstein [Thu, 12 Feb 2015 18:21:50 +0000 (18:21 +0000)]
gold-plugin: delete the output file for OT_DISABLE

bfd creates the output file early, so calling exit(0) is not enough, the file needs to be explicitly deleted.

Patch by: H.J. Lu <hjl.tools@gmail.com>

llvm-svn: 228946

9 years ago[clang-tidy] Fixed a false positive case in misc-inefficient-algorithm checker.
Gabor Horvath [Thu, 12 Feb 2015 18:19:34 +0000 (18:19 +0000)]
[clang-tidy] Fixed a false positive case in misc-inefficient-algorithm checker.

llvm-svn: 228945

9 years agoAdd Initialize/Terminate method to Platform base plugin
Tamas Berghammer [Thu, 12 Feb 2015 18:18:27 +0000 (18:18 +0000)]
Add Initialize/Terminate method to Platform base plugin

Platform holds a smart pointer to each platform object created in a
static variable what cause the platform destructors called only on
program exit when other static variables are not availables. With this
change the destructors are called on lldb_private::Terminate()

+ Fix DebuggerRefCount handling in ScriptInterpreterPython

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

llvm-svn: 228944

9 years agoCreate new platform: remote-android
Tamas Berghammer [Thu, 12 Feb 2015 18:13:44 +0000 (18:13 +0000)]
Create new platform: remote-android

* Create new platform plugin for lldb
* Create HostInfo class for android
* Create ProcessLauncher for android

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

llvm-svn: 228943

9 years agoFix broken test in separate build tree.
John Thompson [Thu, 12 Feb 2015 17:52:28 +0000 (17:52 +0000)]
Fix broken test in separate build tree.

llvm-svn: 228941

9 years agoOn ELF, put PIC jump tables in a non executable section.
Rafael Espindola [Thu, 12 Feb 2015 17:46:49 +0000 (17:46 +0000)]
On ELF, put PIC jump tables in a non executable section.

Fixes PR22558.

llvm-svn: 228939

9 years agoAdd an -A option to "break set -p" to search all files for matches. Also add the...
Jim Ingham [Thu, 12 Feb 2015 17:37:46 +0000 (17:37 +0000)]
Add an -A option to "break set -p" to search all files for matches.  Also add the version of
SBTarget::BreakpointCreateBySourceRegex that takes file spec lists to the Python interface,
and add a test for this.

<rdar://problem/19805037>

llvm-svn: 228938

9 years agoPut each jump table in an independent section if the function is too.
Rafael Espindola [Thu, 12 Feb 2015 17:16:46 +0000 (17:16 +0000)]
Put each jump table in an independent section if the function is too.

This allows the linker to GC both, fixing pr22557.

llvm-svn: 228937

9 years agoFix accidental bit flip.
Benjamin Kramer [Thu, 12 Feb 2015 16:30:00 +0000 (16:30 +0000)]
Fix accidental bit flip.

llvm-svn: 228936

9 years agoAdded support for multiple header list files, as a precursor for when we need to...
John Thompson [Thu, 12 Feb 2015 16:22:09 +0000 (16:22 +0000)]
Added support for multiple header list files, as a precursor for when we need to load multiple module maps.

llvm-svn: 228935

9 years agoCoverageMapping: Bitvectorize code. No functionality change.
Benjamin Kramer [Thu, 12 Feb 2015 16:18:07 +0000 (16:18 +0000)]
CoverageMapping: Bitvectorize code. No functionality change.

llvm-svn: 228934

9 years agoUpdate after LLVM API change.
Benjamin Kramer [Thu, 12 Feb 2015 16:16:56 +0000 (16:16 +0000)]
Update after LLVM API change.

llvm-svn: 228933

9 years agoFix the test on Linux.
Hafiz Abid Qadeer [Thu, 12 Feb 2015 16:06:03 +0000 (16:06 +0000)]
Fix the test on Linux.

The exception name that is thrown in Linux is different.
I have |ed it to the already existing one.

llvm-svn: 228932

9 years ago[LoopRerolling] Be more forgiving with instruction order.
James Molloy [Thu, 12 Feb 2015 15:54:14 +0000 (15:54 +0000)]
[LoopRerolling] Be more forgiving with instruction order.

We can't solve the full subgraph isomorphism problem. But we can
allow obvious cases, where for example two instructions of different
types are out of order. Due to them having different types/opcodes,
there is no ambiguity.

llvm-svn: 228931

9 years agoMathExtras: Bring Count(Trailing|Leading)Ones and CountPopulation in line with countT...
Benjamin Kramer [Thu, 12 Feb 2015 15:35:40 +0000 (15:35 +0000)]
MathExtras: Bring Count(Trailing|Leading)Ones and CountPopulation in line with countTrailingZeros

Update all callers.

llvm-svn: 228930

9 years agoFixed incorrect header inclusion tracking resulting in false error reports.
John Thompson [Thu, 12 Feb 2015 15:26:17 +0000 (15:26 +0000)]
Fixed incorrect header inclusion tracking resulting in false error reports.

llvm-svn: 228929

9 years agoRemove undefined behavior from test; specifically, compare(NULL, XXX, 0)
Marshall Clow [Thu, 12 Feb 2015 15:25:54 +0000 (15:25 +0000)]
Remove undefined behavior from test; specifically, compare(NULL, XXX, 0)

llvm-svn: 228928

9 years agoRemove undefined behavior from test; specifically, compare(NULL, XXX, 0). Thanks...
Marshall Clow [Thu, 12 Feb 2015 15:21:20 +0000 (15:21 +0000)]
Remove undefined behavior from test; specifically, compare(NULL, XXX, 0). Thanks to Eric for the catch

llvm-svn: 228927

9 years agoTriple: refactor redundant code.
Tim Northover [Thu, 12 Feb 2015 15:12:13 +0000 (15:12 +0000)]
Triple: refactor redundant code.

Should be no functional change, since most of the logic removed was
completely pointless (after some previous refactoring) and the rest
duplicated elsewhere.

Patch by Kamil Rytarowski.

llvm-svn: 228926

9 years agoRe-add makefiles of inline tests
Pavel Labath [Thu, 12 Feb 2015 14:43:35 +0000 (14:43 +0000)]
Re-add makefiles of inline tests

llvm-svn: 228925

9 years ago[X86] Call frame optimization - allow stack-relative movs to be folded into a push
Michael Kuperstein [Thu, 12 Feb 2015 14:17:35 +0000 (14:17 +0000)]
[X86] Call frame optimization - allow stack-relative movs to be folded into a push

Since we track esp precisely, there's no reason not to allow this.

llvm-svn: 228924

9 years ago[TTI] Teach the cost heuristic how to query TLI to check if a zext/trunc is 'free...
Andrea Di Biagio [Thu, 12 Feb 2015 14:17:24 +0000 (14:17 +0000)]
[TTI] Teach the cost heuristic how to query TLI to check if a zext/trunc is 'free' for the target.

Now that SimplifyCFG uses TTI for the cost heuristic, we can teach BasicTTIImpl
how to query TLI in order to get a more accurate cost for truncates and
zero-extends.

Before this patch, the basic cost heuristic in TargetTransformInfoImplCRTPBase
would have conservatively returned a 'default' TCC_Basic for all zero-extends,
and TCC_Free for truncates on native types.

This patch improves the heuristic so that we query TLI (if available) to get
more accurate answers. If TLI is available, then methods 'isZExtFree' and
'isTruncateFree' can be used to check if a zext/trunc is free for the target.

Added more test cases to SimplifyCFG/X86/speculate-cttz-ctlz.ll.
With this change, SimplifyCFG is now able to speculate a 'cheap' cttz/ctlz
immediately followed by a free zext/trunc.

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

llvm-svn: 228923

9 years agoBitVector: Remove manual bit width dispatch, this is handled by templates
Benjamin Kramer [Thu, 12 Feb 2015 14:02:58 +0000 (14:02 +0000)]
BitVector: Remove manual bit width dispatch, this is handled by templates

NFC.

llvm-svn: 228922

9 years agoMathExtras: Parametrize count(Trailing|Leading)Zeros on the type size.
Benjamin Kramer [Thu, 12 Feb 2015 13:47:29 +0000 (13:47 +0000)]
MathExtras: Parametrize count(Trailing|Leading)Zeros on the type size.

Otherwise we will always select the generic version for e.g. unsigned
long if uint64_t is typedef'd to 'unsigned long long'. Also remove
enable_if hacks in favor of static_assert.

llvm-svn: 228921

9 years agoARM: Fix another regression introduced in r223113
Asiri Rathnayake [Thu, 12 Feb 2015 13:37:28 +0000 (13:37 +0000)]
ARM: Fix another regression introduced in r223113

The changes in r223113 (ARM modified-immediate syntax) have broken
instructions like:
  mov r0, #~0xffffff00
The problem is that I've added a spurious range check on the immediate
operand to ensure that it lies between INT32_MIN and UINT32_MAX. While
this range check is correct in theory, it causes problems because the
operand is stored in an int64_t (by MC). So valid 32-bit constants like
\#~0xffffff00 become out of range. The solution is to simply remove this
range check. It is not possible to validate the range of the immediate
operand with the current setup because: 1) The operand is stored in an
int64_t by MC, 2) The immediate can be of the forms #imm, #-imm, #~imm
or even #((~imm)) etc. So we just chop the value to 32 bits and use it.

Also noted that the original range check was note tested by any of the
unit tests. I've added a new test to cover #~imm kind of operands.

Change-Id: I411e90d84312a2eff01b732bb238af536c4a7599
llvm-svn: 228920

9 years agoFix dependency generation crash test to run clang and clean up after itself.
Greg Bedwell [Thu, 12 Feb 2015 12:41:28 +0000 (12:41 +0000)]
Fix dependency generation crash test to run clang and clean up after itself.

Previously the test did not have a RUN: prefix for the clang command.
In addition it was leaving behind a tmp file with no permissions causing issues when
deleting the build directory on Windows.

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

llvm-svn: 228919

9 years ago[mips] Partially revert r223927: Removing __SIZEOF_INT128__ macro for MIPS64
Vasileios Kalintiris [Thu, 12 Feb 2015 11:36:56 +0000 (11:36 +0000)]
[mips] Partially revert r223927: Removing __SIZEOF_INT128__ macro for MIPS64

Partially revert r223927 because LLVM gained support for 128-bit integers
in r227089. Modify and keep the tests that verify the definition of the
macro __SIZEOF_INT128__ for MIPS64 BE & LE in the preprocessor.

llvm-svn: 228918

9 years agotsan: do not instrument not captured values
Dmitry Vyukov [Thu, 12 Feb 2015 09:55:28 +0000 (09:55 +0000)]
tsan: do not instrument not captured values

I've built some tests in WebRTC with and without this change. With this change number of __tsan_read/write calls is reduced by 20-40%, binary size decreases by 5-10% and execution time drops by ~5%. For example:

$ ls -l old/modules_unittests new/modules_unittests
-rwxr-x--- 1 dvyukov 41708976 Jan 20 18:35 old/modules_unittests
-rwxr-x--- 1 dvyukov 38294008 Jan 20 18:29 new/modules_unittests
$ objdump -d old/modules_unittests | egrep "callq.*__tsan_(read|write|unaligned)" | wc -l
239871
$ objdump -d new/modules_unittests | egrep "callq.*__tsan_(read|write|unaligned)" | wc -l
148365

http://reviews.llvm.org/D7069

llvm-svn: 228917

9 years agoAVX-512: Fixed the "test" operation for i1 type
Elena Demikhovsky [Thu, 12 Feb 2015 08:40:34 +0000 (08:40 +0000)]
AVX-512: Fixed the "test" operation for i1 type

Using KORTESTW for comparison i1 value with zero was wrong since the instruction tests 16 bits.
KORTESTW may be used with KSHIFTL+KSHIFTR that clean the 15 upper bits.
I removed (X86cmp i1, 0) pattern and zero-extend i1 to i8 and then use TESTB.

There are some cases where i1 is in the mask register and the upper bits are already zeroed.
Then KORTESTW is the better solution, but it is subject for optimization.
Meanwhile, I'm fixing the correctness issue.

llvm-svn: 228916

9 years ago[X86] A heuristic to estimate the size impact for converting stack-relative parameter...
Michael Kuperstein [Thu, 12 Feb 2015 08:36:35 +0000 (08:36 +0000)]
[X86] A heuristic to estimate the size impact for converting stack-relative parameter movs to pushes

This gives a rough estimate of whether using pushes instead of movs is profitable, in terms of size.
We go over all calls in the MachineFunction and compute:
a) For each callsite that can not use pushes, the penalty of not having a reserved call frame.
b) For each callsite that can use pushes, the gain of actually replacing the movs with pushes (and the potential penalty of having to readjust the stack).

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

llvm-svn: 228915

9 years agoLink LLVM libraries into libLLVMPolly if BUILD_SHARED_LIBS=ON is set
Tobias Grosser [Thu, 12 Feb 2015 08:27:19 +0000 (08:27 +0000)]
Link LLVM libraries into libLLVMPolly if BUILD_SHARED_LIBS=ON is set

Without this change we get linker errors such as:

  undefined reference to `llvm::dbgs()'

We only conditionally link in these libraries, as in BUILD_SHARED_LIBS=OFF mode,
linking in these libraries causes such functions (and especially global options)
to be defined twice. The "solution" I choose is most likely not ideal, but seems
to work. If any cmake specialist can suggest a better approach, this would be
appreciated.

We also drop a .c file that is not needed as it caused linker errors as well.

llvm-svn: 228914

9 years ago[CodeGen] Don't blindly combine (fp_round (fp_round x)) to (fp_round x).
Ahmed Bougacha [Thu, 12 Feb 2015 06:15:29 +0000 (06:15 +0000)]
[CodeGen] Don't blindly combine (fp_round (fp_round x)) to (fp_round x).

We used to do this DAG combine, but it's not always correct:
If the first fp_round isn't a value preserving truncation, it might
introduce a tie in the second fp_round, that wouldn't occur in the
single-step fp_round we want to fold to.
In other words, double rounding isn't the same as rounding.

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

llvm-svn: 228911

9 years agoSearch through all memory regions of the core file for
Jason Molenda [Thu, 12 Feb 2015 06:14:23 +0000 (06:14 +0000)]
Search through all memory regions of the core file for
both a user process dyld and for a kernel binary -- we
will decide which to prefer after one or both have been
located.

It would be faster to stop the search thorugh the core
segments one we've found a dyld/kernel binary - but that
may trick us into missing the one we would prefer.

<rdar://problem/19806413>

llvm-svn: 228910

9 years agoCast EOF to get a proper comparison.
Justin Hibbits [Thu, 12 Feb 2015 05:31:46 +0000 (05:31 +0000)]
Cast EOF to get a proper comparison.

On PowerPC, and maybe some other architectures, 'char' is unsigned.  Comparing
an unsigned char with a signed int (-1) is always false.  To fix this, down-cast
EOF to a char.

llvm-svn: 228909

9 years agoQuiet Coverity
Justin Hibbits [Thu, 12 Feb 2015 05:31:31 +0000 (05:31 +0000)]
Quiet Coverity

Summary: Coverity warns that unsigned >= 0 is always true, and k_first_gpr_powerpc happens to be 0.  Quiet Coverity by changing that comparison instead to a static_assert(), in case things change in the future.

Reviewers: emaste

Reviewed By: emaste

Subscribers: lldb-commits

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

llvm-svn: 228908

9 years ago[ELF][Cleanup] Remove unused function
Shankar Easwaran [Thu, 12 Feb 2015 05:29:50 +0000 (05:29 +0000)]
[ELF][Cleanup] Remove unused function

We can add this function when we really have a need.

llvm-svn: 228907

9 years ago[ELF] Support --wrap option
Shankar Easwaran [Thu, 12 Feb 2015 05:02:46 +0000 (05:02 +0000)]
[ELF] Support --wrap option

Use a wrapper function for symbol. Any undefined reference to symbol will be
resolved to "__wrap_symbol". Any undefined reference to "__real_symbol" will be
resolved to symbol.

This can be used to provide a wrapper for a system function. The wrapper
function should be called "__wrap_symbol". If it wishes to call the system
function, it should call "__real_symbol".

Here is a trivial example:

void * __wrap_malloc (size_t c)
{
  printf ("malloc called with %zu\n", c);
  return __real_malloc (c);
}

If you link other code with this file using --wrap malloc, then all calls
to "malloc" will call the function "__wrap_malloc" instead. The call to
"__real_malloc" in "__wrap_malloc" will call the real "malloc" function.

llvm-svn: 228906

9 years ago[ELF] Add LinkingContext to the ELFReader.
Shankar Easwaran [Thu, 12 Feb 2015 05:02:41 +0000 (05:02 +0000)]
[ELF] Add LinkingContext to the ELFReader.

This adds the LinkingContext parameter to the ELFReader. Previously the flags in
that were needed in the Context was passed to the ELFReader, this made it very
hard to access data structures in the LinkingContext when reading an ELF file.

This change makes the ELFReader more flexible so that required parameters can be
grabbed directly from the LinkingContext.

Future patches make use of the changes.

There is no change in functionality though.

llvm-svn: 228905

9 years agounwind: use explicit memcpy for register saving
Saleem Abdulrasool [Thu, 12 Feb 2015 04:25:05 +0000 (04:25 +0000)]
unwind: use explicit memcpy for register saving

Convert the register saving code to use an explicit memcpy rather than the
implicit memcpy from the assignment.  This avoids warnings from -Wcast-qual on
GCC and makes the code more explicit.  Furthermore, use sizeof to calculate the
offsets rather than adding magic numbers, improving legibility of the code.
NFC.

llvm-svn: 228904

9 years agounwind: move exported APIs out of header
Saleem Abdulrasool [Thu, 12 Feb 2015 04:25:03 +0000 (04:25 +0000)]
unwind: move exported APIs out of header

Ideally, we would do something like inline __declspec(dllexport) to ensure that
the symbol was inlined within libunwind as well as emitted into the final DSO.
This simply moves the definition out of the header to ensure that the *public*
interfaces are defined and exported into the final DSO.

This change also has "gratuitous" code movement so that the EHABI and generic
implementations are co-located making it easier to find them.

The movement from the header has one minor change introduced into the code:
additional tracing to mirror the behaviour of the non-EHABI interfaces.

llvm-svn: 228903

9 years agoFix tests so they work when the linker is gcc
Filipe Cabecinhas [Thu, 12 Feb 2015 03:37:55 +0000 (03:37 +0000)]
Fix tests so they work when the linker is gcc

If the linker is gcc (the default for Generic_ELF toolchains), we end up
passing most of the arguments to the linker.

Some tests were failing to account for this in their usage of *-NOT: lines
and would fail if compiled with
-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-unknown

llvm-svn: 228902

9 years agoFixed a bug where CFLAA would crash the compiler.
George Burgess IV [Thu, 12 Feb 2015 03:07:07 +0000 (03:07 +0000)]
Fixed a bug where CFLAA would crash the compiler.

We would crash if we couldn't locate a Function that either Location's
Value belonged to. Now we just print out a debug message and return
conservatively.

llvm-svn: 228901

9 years agoPECOFF: make dumpbin tool happy.
Rui Ueyama [Thu, 12 Feb 2015 02:50:05 +0000 (02:50 +0000)]
PECOFF: make dumpbin tool happy.

The dumpbin tool in the MSVC toolchain cannot handle an executable created
by LLD if the executable contains a long section name.

In PE/COFF, a section name is stored to a section table entry. Because the
section name field in the table is only 8 byte long, a name longer than
that is stored to the string table and the offset in the string table is
stored to the section table entry instead.

In order to look up a string from the string table, tools need to handle
the symbol table, because the string table is defined as it immediately
follows the symbol table.

And seems the dumpbin doesn't like zero-length symbol table.

This patch teaches LLD how to emit a dummy symbol table. The dummy table
has one dummy entry in it.

llvm-svn: 228900

9 years ago[slp] Fix a nasty bug in the SLP vectorizer that Joerg pointed out.
Chandler Carruth [Thu, 12 Feb 2015 02:30:56 +0000 (02:30 +0000)]
[slp] Fix a nasty bug in the SLP vectorizer that Joerg pointed out.
Apparently some code finally started to tickle this after my
canonicalization changes to instcombine.

The bug stems from trying to form a vector type out of scalars that
aren't compatible at all. In this example, from x86_mmx values. The code
in the vectorizer that checks for reasonable types whas checking for
aggregates or vectors, but there are lots of other types that should
just never reach the vectorizer.

Debugging this was made more confusing by the lie in an assert in
VectorType::get() -- it isn't that the types are *primitive*. The types
must be integer, pointer, or floating point types. No other types are
allowed.

I've improved the assert and added a helper to the vectorizer to handle
the element type validity checks. It now re-uses the VectorType static
function and then further excludes weird target-specific types that we
probably shouldn't be touching here (x86_fp80 and ppc_fp128). Neither of
these are really reachable anyways (neither 80-bit nor 128-bit things
will get vectorized) but it seems better to just eagerly exclude such
nonesense.

I've added a test case, but while it definitely covers two of the paths
through this code there may be more paths that would benefit from test
coverage. I'm not familiar enough with the SLP vectorizer to synthesize
test cases for all of these, but was able to update the code itself by
inspection.

llvm-svn: 228899

9 years agoAdd InlineAsmDiagnosticHandler for bitcode input
Steven Wu [Thu, 12 Feb 2015 02:06:55 +0000 (02:06 +0000)]
Add InlineAsmDiagnosticHandler for bitcode input

Summary:
This patch installs an InlineAsmDiagnosticsHandler to avoid the crash
report when the input is bitcode and the bitcode contains invalid inline
assembly. The handler will simply print the same error message that will
print from the backend.

Add CHECK in test-case

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: rafael, cfe-commits

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

llvm-svn: 228898

9 years agoMore for DR1467: In C++, when initializing an element of an aggregate,
Richard Smith [Thu, 12 Feb 2015 01:55:09 +0000 (01:55 +0000)]
More for DR1467: In C++, when initializing an element of an aggregate,
always use the normal copy-initialization rules. Remove a special case that
tries to stay within the list initialization checker here; that makes us do the
wrong thing when list-initialization of an aggregate would not perform
aggregate initialization.

llvm-svn: 228897

9 years agoImprove the "braces around scalar init" warning to determine whether to warn
Richard Smith [Thu, 12 Feb 2015 01:50:05 +0000 (01:50 +0000)]
Improve the "braces around scalar init" warning to determine whether to warn
based on whether "redundant" braces are ever reasonable as part of the
initialization of the entity, rather than whether the initialization is
"top-level". In passing, add a warning flag for it.

llvm-svn: 228896

9 years ago[PowerPC] Mark jumps as expensive (using using CR bits)
Hal Finkel [Thu, 12 Feb 2015 01:02:52 +0000 (01:02 +0000)]
[PowerPC] Mark jumps as expensive (using using CR bits)

On PowerPC, which has a full set of logical operations on (its multiple sets
of) condition-register bits, it is not profitable to break of complex
conditions feeding a jump into multiple jumps. We can turn off this feature of
CGP/SDAGBuilder by marking jumps as "expensive".

P7 test-suite speedups (no regressions):
MultiSource/Benchmarks/FreeBench/pcompress2/pcompress2
-0.626647% +/- 0.323583%
MultiSource/Benchmarks/Olden/power/power
-18.2821% +/- 8.06481%

llvm-svn: 228895

9 years ago[Sanitizer] Change InitializeFlags() signatures. NFC.
Alexey Samsonov [Thu, 12 Feb 2015 00:36:42 +0000 (00:36 +0000)]
[Sanitizer] Change InitializeFlags() signatures. NFC.

These functions are always used to initialize singleton flags(), as
well as other global data (common_flags()).

llvm-svn: 228894

9 years ago[Sanitizer] Add "final" specifier to FlagHandlerBase::Parse overrides. NFC.
Alexey Samsonov [Thu, 12 Feb 2015 00:36:39 +0000 (00:36 +0000)]
[Sanitizer] Add "final" specifier to FlagHandlerBase::Parse overrides. NFC.

llvm-svn: 228893

9 years agoMake a more complete fix for always supplying an execution context when getting byte...
Greg Clayton [Thu, 12 Feb 2015 00:34:25 +0000 (00:34 +0000)]
Make a more complete fix for always supplying an execution context when getting byte sizes from types.

There was a test in the test suite that was triggering the backtrace logging output that requested that the client pass an execution context. Sometimes we need the process for Objective C types because our static notion of the type might not align with the reality when being run in a live runtime.

Switched from an "ExecutionContext *" to an "ExecutionContextScope *" for greater ease of use.

llvm-svn: 228892

9 years agoRevert "Change Path::filename_pos() to skip the drive letter."
Zachary Turner [Thu, 12 Feb 2015 00:05:49 +0000 (00:05 +0000)]
Revert "Change Path::filename_pos() to skip the drive letter."

This reverts commit 228874.  For some reason users reported
seeing Clang taking up 25+GB of memory and bringing down
machines with this change.  Reverting until we figure it out.

llvm-svn: 228890

9 years agoInvert the section relocation map.
Rafael Espindola [Wed, 11 Feb 2015 23:38:33 +0000 (23:38 +0000)]
Invert the section relocation map.

It now points from rel section to section. Use it to set sh_info, avoiding
a brittle name lookup.

llvm-svn: 228889

9 years agoUse the existing SymbolTableIndex instead of doing a lookup. NFC.
Rafael Espindola [Wed, 11 Feb 2015 23:33:46 +0000 (23:33 +0000)]
Use the existing SymbolTableIndex instead of doing a lookup. NFC.

llvm-svn: 228888

9 years agoRemove unused parameter.
Rui Ueyama [Wed, 11 Feb 2015 23:22:34 +0000 (23:22 +0000)]
Remove unused parameter.

llvm-svn: 228887

9 years agoCreate the Seciton -> Rel Section map when it is first needed. NFC.
Rafael Espindola [Wed, 11 Feb 2015 23:17:48 +0000 (23:17 +0000)]
Create the Seciton -> Rel Section map when it is first needed. NFC.

Saves a walk over every section.

llvm-svn: 228886

9 years agoDeadArgElim: aggregate Return assessment properly.
Tim Northover [Wed, 11 Feb 2015 23:13:11 +0000 (23:13 +0000)]
DeadArgElim: aggregate Return assessment properly.

I mistakenly thought the liveness of each "RetVal(F, i)" depended only on F. It
actually depends on the index too, which means we need to be careful about how
the results are combined before return. In particular if a single Use returns
Live, that counts for the entire object, at the granularity we're considering.

llvm-svn: 228885

9 years agoRemove unused argument. NFC.
Rafael Espindola [Wed, 11 Feb 2015 23:11:18 +0000 (23:11 +0000)]
Remove unused argument. NFC.

llvm-svn: 228884

9 years agoUnbreak buildbots
David Majnemer [Wed, 11 Feb 2015 22:51:55 +0000 (22:51 +0000)]
Unbreak buildbots

The next offset should be updated as well.

llvm-svn: 228883

9 years agoDon't recompute the entire section map just to add 3 entries. NFC.
Rafael Espindola [Wed, 11 Feb 2015 22:41:26 +0000 (22:41 +0000)]
Don't recompute the entire section map just to add 3 entries. NFC.

llvm-svn: 228881

9 years agoWrap to 80 columns. No behavior change.
Nico Weber [Wed, 11 Feb 2015 22:33:32 +0000 (22:33 +0000)]
Wrap to 80 columns. No behavior change.

llvm-svn: 228880

9 years agoMC, COFF: Align section contents to a four byte boundary
David Majnemer [Wed, 11 Feb 2015 22:22:30 +0000 (22:22 +0000)]
MC, COFF: Align section contents to a four byte boundary

llvm-svn: 228879

9 years agoOn second thought, a const ValueObject& has too many limitations on what it can do...
Enrico Granata [Wed, 11 Feb 2015 21:53:08 +0000 (21:53 +0000)]
On second thought, a const ValueObject& has too many limitations on what it can do. Strip the constness away

llvm-svn: 228878

9 years agoExcept only EIO errors of OSError exception in Base.deletePexpectChild() in lldbtest...
Ilia K [Wed, 11 Feb 2015 21:41:58 +0000 (21:41 +0000)]
Except only EIO errors of OSError exception in Base.deletePexpectChild() in lldbtest.py after r227086

llvm-svn: 228877

9 years agoAdd the 'noinline' attribute to call sites within __try bodies
Reid Kleckner [Wed, 11 Feb 2015 21:40:48 +0000 (21:40 +0000)]
Add the 'noinline' attribute to call sites within __try bodies

LLVM doesn't support non-call exceptions, so inlining makes it harder to
catch such asynchronous exceptions.

llvm-svn: 228876

9 years agoAdd clang-tidy check google-global-names-in-headers.
Samuel Benzaquen [Wed, 11 Feb 2015 21:21:05 +0000 (21:21 +0000)]
Add clang-tidy check google-global-names-in-headers.

Summary:
google-global-names-in-headers flags global namespace pollution in header files.
Right now it only triggers on using declarations and directives.

Reviewers: alexfh

Subscribers: curdeius

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

llvm-svn: 228875

9 years agoChange Path::filename_pos() to skip the drive letter.
Zachary Turner [Wed, 11 Feb 2015 21:16:35 +0000 (21:16 +0000)]
Change Path::filename_pos() to skip the drive letter.

For Windows, filename_pos() tries to find the filename by
searching for separators after the last :.  Instead, it should
really check for the only location that a : is valid, which is
in the second character, and search for separators after that.

llvm-svn: 228874

9 years agoRemove unused argument. NFC.
Rafael Espindola [Wed, 11 Feb 2015 21:08:00 +0000 (21:08 +0000)]
Remove unused argument. NFC.

llvm-svn: 228873

9 years agoReassociate: cannot negate a INT_MIN value
Mehdi Amini [Wed, 11 Feb 2015 19:54:44 +0000 (19:54 +0000)]
Reassociate: cannot negate a INT_MIN value

Summary:
When trying to canonicalize negative constants out of
multiplication expressions, we need to check that the
constant is not INT_MIN which cannot be negated.

Reviewers: mcrosier

Reviewed By: mcrosier

Subscribers: llvm-commits

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

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

9 years ago[Sanitizers] The MAP_NORESERVE define has been removed in FreeBSD 11.x,
Dimitry Andric [Wed, 11 Feb 2015 19:48:27 +0000 (19:48 +0000)]
[Sanitizers] The MAP_NORESERVE define has been removed in FreeBSD 11.x,
and even before that, it was never implemented.  Just define it to zero
instead, so compiler-rt can compile on FreeBSD 11 and later.

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

llvm-svn: 228871

9 years agoFix REQUIRES lines on tests from r228735. Thanks Kristof for pointing out the missin...
Pete Cooper [Wed, 11 Feb 2015 19:45:13 +0000 (19:45 +0000)]
Fix REQUIRES lines on tests from r228735.  Thanks Kristof for pointing out the missing commas

llvm-svn: 228870

9 years ago[UBSan] Allow UBSan location to store frames returned by symbolizer.
Alexey Samsonov [Wed, 11 Feb 2015 19:45:07 +0000 (19:45 +0000)]
[UBSan] Allow UBSan location to store frames returned by symbolizer.

Summary:
__ubsan::getFunctionLocation() used to issue a call to symbolizer, and
convert the result (SymbolizedStack) to one of UBSan structures:
SourceLocation, ModuleLocation or MemoryLocation. This:
(1) is inefficient: we do an extra allocation/deallocation to copy data,
while we can instead can just pass SymbolizedStack around (which
contains all the necessary data).
(2) leaks memory: strings stored in SourceLocation/MemoryLocation are
never deallocated, and Filipe Cabecinhas suggests this causes crashes
of UBSan-ified programs in the wild.

Instead, let Location store a pointer to SymbolizedStack object, and
make sure it's properly deallocated when UBSan handler exits.

ModuleLocation is made obsolete by this change, and is deleted.

Test Plan: check-ubsan test suite

Reviewers: rsmith, filcab

Subscribers: llvm-commits

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

llvm-svn: 228869

9 years ago[FIX] Remove XFAIL again
Johannes Doerfert [Wed, 11 Feb 2015 19:28:39 +0000 (19:28 +0000)]
[FIX] Remove XFAIL again

llvm-svn: 228868

9 years agoFixed SBModule::GetUUIDString() to not use a static character buffer.
Greg Clayton [Wed, 11 Feb 2015 19:16:38 +0000 (19:16 +0000)]
Fixed SBModule::GetUUIDString() to not use a static character buffer.

Rules for returning "const char *" from functions in the public lldb::SB* API are that you must constify the string using "ConstString(cstr).GetCString()" and return that. This puts the string into a string pool that never goes away. This is only when there is nothing that can hold onto the string. It is OK to specify that a string value lives as long as its SB class counterpart, but this should be made clear in the API if this is done. Many classes already constify their strings (symbol mangled and demangled names, variable names, type names, etc), so be sure to verify you string isn't already constified before you re-constify it. It won't do any harm to re-constify it, it will just cause you a little performance by having to rehash the string.

llvm-svn: 228867

9 years ago[FIX] Correctly handle scalar dependences of branch instructions
Johannes Doerfert [Wed, 11 Feb 2015 19:12:19 +0000 (19:12 +0000)]
[FIX] Correctly handle scalar dependences of branch instructions

llvm-svn: 228866

9 years ago[FIX] Fix test case that was affected by the early exit patch
Johannes Doerfert [Wed, 11 Feb 2015 19:11:57 +0000 (19:11 +0000)]
[FIX] Fix test case that was affected by the early exit patch

llvm-svn: 228865

9 years agoCXXInheritance: Modernize removal of hidden virtual base class decls.
Benjamin Kramer [Wed, 11 Feb 2015 19:09:16 +0000 (19:09 +0000)]
CXXInheritance: Modernize removal of hidden virtual base class decls.

NFC.

llvm-svn: 228864

9 years agoAdd a comdat to __clang_call_terminate
Reid Kleckner [Wed, 11 Feb 2015 18:50:13 +0000 (18:50 +0000)]
Add a comdat to __clang_call_terminate

llvm-svn: 228863

9 years agoDrop an assert and XFAIL two test cases
Tobias Grosser [Wed, 11 Feb 2015 18:46:33 +0000 (18:46 +0000)]
Drop an assert and XFAIL two test cases

This gets the buildbot green to avoid further emails. Johannes will fix this
later in the evening.

llvm-svn: 228862

9 years agoR600/SI: Disable subreg liveness
Tom Stellard [Wed, 11 Feb 2015 18:24:53 +0000 (18:24 +0000)]
R600/SI: Disable subreg liveness

This is temporary while we try to fix a crash in the register coalescer.

llvm-svn: 228861

9 years agoUpdate the coding standard to reflect recent changes.
Zachary Turner [Wed, 11 Feb 2015 18:24:38 +0000 (18:24 +0000)]
Update the coding standard to reflect recent changes.

This removes the rule from the LLDB coding standard about putting
a space after function names and before parentheses.  We now
conform to the LLVM style guide.  If you previously wrote
pointer->func (args), it would now be written pointer->func(args).

Using clang-format will do this automatically.

llvm-svn: 228860

9 years agoMake PipeWindows::CreateWithUniqueName() use GUIDs on Windows.
Zachary Turner [Wed, 11 Feb 2015 18:21:28 +0000 (18:21 +0000)]
Make PipeWindows::CreateWithUniqueName() use GUIDs on Windows.

Patch by Adrian McCarthy
Differential Revision: http://reviews.llvm.org/D7509

llvm-svn: 228859

9 years agoUpdate TODO list.
Johannes Doerfert [Wed, 11 Feb 2015 18:18:19 +0000 (18:18 +0000)]
Update TODO list.

llvm-svn: 228858

9 years ago[X86][SSE] Added dual vector truncation tests.
Simon Pilgrim [Wed, 11 Feb 2015 18:14:35 +0000 (18:14 +0000)]
[X86][SSE] Added dual vector truncation tests.

llvm-svn: 228857

9 years agoAdd missing check for LLDB_DISABLE_PYTHON in FormatManager
Tamas Berghammer [Wed, 11 Feb 2015 17:51:49 +0000 (17:51 +0000)]
Add missing check for LLDB_DISABLE_PYTHON in FormatManager

llvm-svn: 228856

9 years agoFix PR19351. While building up a composite type it is important to use
Adrian Prantl [Wed, 11 Feb 2015 17:45:15 +0000 (17:45 +0000)]
Fix PR19351. While building up a composite type it is important to use
a non-uniqueable temporary node that is only turned into a permanent
unique or distinct node after it is finished.
Otherwise an intermediate node may get accidentally uniqued with another
node as illustrated by the testcase.

Paired commit with LLVM.

llvm-svn: 228855

9 years agoAllow DIBuilder::replaceVTableHolder() to work with temporary nodes,
Adrian Prantl [Wed, 11 Feb 2015 17:45:10 +0000 (17:45 +0000)]
Allow DIBuilder::replaceVTableHolder() to work with temporary nodes,
tested via the clang test CodeGenCXX/vtable-holder-self-reference.cpp .

llvm-svn: 228854

9 years agoAdd a trackIfUnresolved to DIBuilder::createInheritance(),
Adrian Prantl [Wed, 11 Feb 2015 17:45:08 +0000 (17:45 +0000)]
Add a trackIfUnresolved to DIBuilder::createInheritance(),
tested via the clang test CodeGenCXX/vtable-holder-self-reference.cpp .

llvm-svn: 228853

9 years agoGeneralize DIBuilder's createReplaceableForwardDecl() to a more flexible
Adrian Prantl [Wed, 11 Feb 2015 17:45:05 +0000 (17:45 +0000)]
Generalize DIBuilder's createReplaceableForwardDecl() to a more flexible
createReplaceableCompositeType() that allows to create non-forward-declared
temporary nodes.

Paired commit with CFE.

llvm-svn: 228852

9 years agoAdd early exits for SCoPs we did not optimize
Johannes Doerfert [Wed, 11 Feb 2015 17:25:09 +0000 (17:25 +0000)]
Add early exits for SCoPs we did not optimize

  This allows us to skip ast and code generation if we did not optimize
  a SCoP and will not generate parallel or alias annotations. The
  initial heuristic to exit is simple but allows improvements later on.

  All failing test cases have been modified to disable early exit, thus
  to keep their coverage.

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

llvm-svn: 228851

9 years agoR600: Split AMDGPUPassConfig into R600PassConfig and GCNPassConfig
Tom Stellard [Wed, 11 Feb 2015 17:11:51 +0000 (17:11 +0000)]
R600: Split AMDGPUPassConfig into R600PassConfig and GCNPassConfig

llvm-svn: 228850

9 years agoR600: Create an R600TargetMachine for pre-gcn GPUs
Tom Stellard [Wed, 11 Feb 2015 17:11:50 +0000 (17:11 +0000)]
R600: Create an R600TargetMachine for pre-gcn GPUs

No functinality change. R600TargetMachine inherits from
AMDGPUTargetMachine.

llvm-svn: 228849

9 years agoR600/SI: Fix -march in test
Tom Stellard [Wed, 11 Feb 2015 17:11:48 +0000 (17:11 +0000)]
R600/SI: Fix -march in test

llvm-svn: 228848

9 years agoModel scalar writes with uses outside the SCoP
Johannes Doerfert [Wed, 11 Feb 2015 17:02:52 +0000 (17:02 +0000)]
Model scalar writes with uses outside the SCoP

  These write are important as they will force the scheduling and code
  generation of an otherwise trivial statement and also impose an order of
  execution needed to guarantee the correct final value for a scalar in a loop.

  Added test case modeled after ClamAV/clamscan.

llvm-svn: 228847

9 years agoAdded -block-check-header-list-only option. This is a work-around for private includ...
John Thompson [Wed, 11 Feb 2015 16:58:36 +0000 (16:58 +0000)]
Added -block-check-header-list-only option.  This is a work-around for private includes that purposefully get included inside blocks.

llvm-svn: 228846

9 years agoCentralize canonical path conversion.
John Thompson [Wed, 11 Feb 2015 16:45:50 +0000 (16:45 +0000)]
Centralize canonical path conversion.

llvm-svn: 228845

9 years agoLock mutex in the same order.
Hafiz Abid Qadeer [Wed, 11 Feb 2015 16:37:17 +0000 (16:37 +0000)]
Lock mutex in the same order.
SBProcess uses 2 mutexex; RunLock and APILock. Apart from 2 places, RunLock
is locked before API lock. I have fixed the 2 places where order was different.
I observed a deadlock due to this different order in lldb-mi once. Although
lldb-mi command and event thread dont run at the same time now. So it can not deadlock
there but can still be problem for some other clients.

Pre-approved by Greg in http://lists.cs.uiuc.edu/pipermail/lldb-dev/2015-February/006509.html

llvm-svn: 228844