Commit Graph

177310 Commits

Author SHA1 Message Date
JF Bastien 144829d3e9 Random Number Generator (llvm)
Provides an abstraction for a random number generator (RNG) that produces a stream of pseudo-random numbers.
The current implementation uses C++11 facilities and is therefore not cryptographically secure.

The RNG is salted with the text of the current command line invocation.
In addition, a user may specify a seed (reproducible builds).

In clang, the seed can be set via

-frandom-seed=X
In the back end, the seed can be set via

-rng-seed=X
This is the llvm part of the patch.
clang part: D3391

URL: http://reviews.llvm.org/D3390
Author: yln

I'm landing this for the second time, it broke Windows bots the first time around.

llvm-svn: 211705
2014-06-25 15:21:42 +00:00
Tim Northover 1565e56785 [mach-o]: make sure custom sort method is irreflexive.
The previous function returned true for "s < s", which could completely mess up
the sorting of symbols within a section.

Unfortunately, I don't think there's a robust way to write a test for this.
Anything I come up with will be making assumptions about the particular
implementation of std::sort.

llvm-svn: 211704
2014-06-25 15:12:55 +00:00
Alexander Kornienko a9b7ec18f1 Apparently, some versions of diff like -U0 more than -u0.
llvm-svn: 211703
2014-06-25 14:56:58 +00:00
Alexander Kornienko 73ba424506 Add a check to flag the usage of C-style casts (Google Style).
Summary:
Add a check to flag the usage of C-style casts, as per Google Style
Guide:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Casting#Casting

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 211702
2014-06-25 14:52:44 +00:00
Rafael Espindola 9364ac69d8 Simplify AddValueSymbols. No functionality change.
llvm-svn: 211701
2014-06-25 14:42:14 +00:00
Evgeniy Stepanov b163f0276f [msan] Fix bad interaction between with-calls mode and chained origin tracking.
Origin history should only be recorded for uninitialized values, because it is
meaningless otherwise. This change moves __msan_chain_origin to the runtime
library side and makes it conditional on the corresponding shadow value.

Previous code was correct, but _very_ inefficient.

llvm-svn: 211700
2014-06-25 14:41:57 +00:00
Rafael Espindola a8acef6c68 Don't leak a file descriptor.
llvm-svn: 211699
2014-06-25 14:35:59 +00:00
Alexander Kornienko 1de35e719f Add clang-tidy-diff.py script to run clang-tidy and display warnings on changed lines only.
Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 211698
2014-06-25 14:09:52 +00:00
Logan Chien c0f691df74 Code cleanup.
llvm-svn: 211697
2014-06-25 13:46:17 +00:00
Aaron Watry d9ee196eab relational: Implement signbit
v2 Changes:
   - use __builtin_signbit instead of shifting by hand
   - significantly improve vector shuffling
   - Works correctly now for signbit(float16) on radeonsi

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 211696
2014-06-25 13:29:23 +00:00
Chandler Carruth bfa644b91d Add Polly to the ignored trees.
llvm-svn: 211695
2014-06-25 13:13:36 +00:00
Chandler Carruth e5724d7532 [x86] Add intrinsics for the pshufd, pshuflw, and pshufhw instructions.
llvm-svn: 211694
2014-06-25 13:12:54 +00:00
Aaron Ballman ca237b586e Fixing the RST markup for the #pragma loop attribute documentation.
llvm-svn: 211693
2014-06-25 12:49:05 +00:00
Aaron Ballman 120c79f231 Fixing the position of the supported syntax marker when generating attribute documentation.
llvm-svn: 211692
2014-06-25 12:48:06 +00:00
NAKAMURA Takumi 1db5995d14 Re-apply r211399, "Generate native unwind info on Win64" with a fix to ignore SEH pseudo ops in X86 JIT emitter.
--
This patch enables LLVM to emit Win64-native unwind info rather than
DWARF CFI.  It handles all corner cases (I hope), including stack
realignment.

Because the unwind info is not flexible enough to describe stack frames
with a gap of unknown size in the middle, such as the one caused by
stack realignment, I modified register spilling code to place all spills
into the fixed frame slots, so that they can be accessed relative to the
frame pointer.

Patch by Vadim Chugunov!

Reviewed By: rnk

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

llvm-svn: 211691
2014-06-25 12:41:52 +00:00
Aaron Ballman 3cf5c9de14 Escaping a literal character to fix an RST warning.
llvm-svn: 211690
2014-06-25 12:41:28 +00:00
NAKAMURA Takumi c403be1991 Reformat.
llvm-svn: 211689
2014-06-25 12:40:56 +00:00
Alexey Volkov 54ff080e39 Align with new GCC options for x86 Android
32-bit: +ssse3
64-bit: +sse4.2 +popcnt

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

llvm-svn: 211688
2014-06-25 12:15:36 +00:00
James Molloy b8fd41926c CHECK-LABEL'ify this test.
llvm-svn: 211687
2014-06-25 11:50:56 +00:00
James Molloy 7d64a0eec4 [AArch32] Fix a stupid error in an architectural guard
The < 8 instead of <= 8 meant that a bunch of vreinterprets were not available on v8 AArch32. Simplify the guard to just !defined(aarch64) while we're at it, and enable some v8 AArch32 testing.

llvm-svn: 211686
2014-06-25 11:46:24 +00:00
Alexey Bataev d3f8dd2d15 [OPENMP] Initial support for 'sections' directive.
llvm-svn: 211685
2014-06-25 11:44:49 +00:00
Evgeniy Stepanov 0b2d93c4f0 [sanitizer] Fix build on platforms where dtls support is disabled.
llvm-svn: 211684
2014-06-25 11:43:46 +00:00
Evgeniy Stepanov 7ad0bde843 [msan] Fix false positive on dynamic tls.
Use existing DTLS code in sanitizer_tls_get_addr.{h,cc} to unpoison DTLS
blocks both on allocation and deallocation.

https://code.google.com/p/memory-sanitizer/issues/detail?id=44

llvm-svn: 211683
2014-06-25 11:30:35 +00:00
Tim Northover f48f0620ed [mach-o]: atomize zero-terminated literals correctly.
When looking through sections with zero-terminated string-literals (__cstring
or __ustring) we were constantly rechecking the first few bytes of the string
for '\0' rather than advancing along. This obviously failed unless all strings
within the section had the same length as that first one.

llvm-svn: 211682
2014-06-25 11:21:51 +00:00
Tim Northover 36bd9ab2c5 [mach-o] don't assume all sections have symbols
We were trying to examine the first symbol in a section that we wanted to
atomize by symbols, even when there wasn't one. Instead, we should make the
initial anonymous symbol cover the entire section in that situation.

llvm-svn: 211681
2014-06-25 10:59:37 +00:00
Jeroen Ketema 42df5d2a8f Add exp10
Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211680
2014-06-25 10:06:35 +00:00
Andrea Di Biagio 6d9b9e125d [X86] Add target combine rule to select ADDSUB instructions from a build_vector
This patch teaches the backend how to combine a build_vector that implements
an 'addsub' between packed float vectors into a sequence of vector add
and vector sub followed by a VSELECT.

The new VSELECT is expected to be lowered into a BLENDI.
At ISel stage, the sequence 'vector add + vector sub + BLENDI' is
pattern-matched against ISel patterns added at r211427 to select
'addsub' instructions.
Added three more ISel patterns for ADDSUB.

Added test sse3-avx-addsub-2.ll to verify that we correctly emit 'addsub'
instructions.

llvm-svn: 211679
2014-06-25 10:02:21 +00:00
Evgeniy Stepanov d99cca2c7a Factor out part of LICM::sink into a helper function.
llvm-svn: 211678
2014-06-25 09:17:21 +00:00
David Majnemer 0c43d8077e AST: Initialization with dllimport functions in C
The C++ language requires that the address of a function be the same
across all translation units.  To make __declspec(dllimport) useful,
this means that a dllimported function must also obey this rule.  MSVC
implements this by dynamically querying the import address table located
in the linked executable.  This means that the address of such a
function in C++ is not constant (which violates other rules).

However, the C language has no notion of ODR nor does it permit dynamic
initialization whatsoever.  This requires implementations to _not_
dynamically query the import address table and instead utilize a wrapper
function that will be synthesized by the linker which will eventually
query the import address table.  The effect this has is, to say the
least, perplexing.

Consider the following C program:
__declspec(dllimport) void f(void);

typedef void (*fp)(void);

static const fp var = &f;

const fp fun() { return &f; }

int main() { return fun() == var; }

MSVC will statically initialize "var" with the address of the wrapper
function and "fun" returns the address of the actual imported function.
This means that "main" will return false!

Note that LLVM's optimizers are strong enough to figure out that "main"
should return true.  However, this result is dependent on having
optimizations enabled!

N.B.  This change also permits the usage of dllimport declarators inside
of template arguments; they are sufficiently constant for such a
purpose.  Add tests to make sure we don't regress here.

llvm-svn: 211677
2014-06-25 08:15:07 +00:00
Alexander Kornienko 01ecd3107e Added a test to ensure -Wimplicit-fallthrough works with -fblocks correctly.
llvm-svn: 211676
2014-06-25 08:09:35 +00:00
Alexey Volkov 2ecf636073 Fix unresolved symbols when loading gold plugin
Differential Revision: http://reviews.llvm.org/D4275

llvm-svn: 211675
2014-06-25 08:04:58 +00:00
Simon Atanasyan d449fc8671 [ELF] Add two new virtual functions to the `OutputELFWriter` class to control
dynamic symbol table populating and DT_NEEDED tag creation.

The `isDynSymEntryRequired` function returns true if the specified shared
library atom requires a dynamic symbol table entry. The `isNeededTagRequired`
function returns true if we need to create DT_NEEDED tag for the shared
library defined specified shared atom.

By default the both functions return true. So there is no functional changes
for all targets except MIPS. Probably we need to spread the same modifications
on other ELF targets but I want to implement and fully tested complete set of
changes for MIPS target first.

For MIPS we create a dynamic symbol table entry for a shared library atom iif
this atom is referenced by a regular defined atom. For example, if library L1
defines symbol T1, library L2 defines symbol T2 and uses symbol T1
and executable file E1 uses symbol T2 but does not use symbol T1 we create
an entry in the E1 dynamic symbol table for symbol T2 and do not create
an entry for T1.

The patch creates DT_NEEDED tags for shared libraries contain shared library
atoms which a) referenced by regular defined atoms; b) have corresponding
copy dynamic relocations (R_MIPS_COPY).

Now the patch does not take in account --as-needed / --no-as-needed command
line options. So it is too restrictive and create DT_NEEDED tags for really
needed shared libraries only. I plan to fix that by subsequent patches.

llvm-svn: 211674
2014-06-25 07:55:55 +00:00
Evgeniy Stepanov 10280dac1d [LICM] Don't create more than one copy of an instruction per loop exit block when sinking.
Fixes exponential compilation complexity in PR19835, caused by
LICM::sink not handling the following pattern well:

f = op g
e = op f, g
d = op e
c = op d, e
b = op c
a = op b, c

When an instruction with N uses is sunk, each of its operands gets N
new uses (all of them - phi nodes). In the example above, if a had 1
use, c would have 2, e would have 4, and g would have 8.

llvm-svn: 211673
2014-06-25 07:54:58 +00:00
Alexey Bataev abfc069d6c [OPENMP] OMPSimdDirective and OMPForDirective: added initialization for CollapsedNum member.
llvm-svn: 211672
2014-06-25 06:52:00 +00:00
Tobias Grosser 50a5e6dac0 test/ScopInfo: Remove %defaultOpts and list passes explicitly
Due to bad habit we sometimes used a variable %defaultOpts that listed
a set of passes commonly run to prepare for Polly. None of these test cases
actually needs special preparation and only two of them need the 'basicaa' to
be scheduled. Scheduling the required alias analysis explicitly makes the test
cases clearer.

llvm-svn: 211671
2014-06-25 06:38:18 +00:00
Tobias Grosser 08031390d5 Clean up XFAILed test cases
We had a set of test cases that have been incomplete and XFAILED. This patch
completes a couple of the interesting ones and removes the ones which seem
redundant or not sufficiently reduced to be useful.

llvm-svn: 211670
2014-06-25 06:31:19 +00:00
Zachary Turner 736d4d85db Replace GCC-specific intrinsic with portable alternative.
Not all supported compilers have GCC intrinsics, so this patch
uses the correct portable alternative.

Additionally, this patch fixes an off-by-one error.  __builtin_ffs
returns the 1-based index of the least-significant 1-bit, but the
function expects the base 2 logarithm of the number, which is
equivalent to the 0-based index of the least-significant 1-bit.

Reviewed by: Keno Fischer

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

llvm-svn: 211669
2014-06-25 05:42:32 +00:00
Rafael Espindola 6804d450cd Fix another asserting method in the null streamer.
llvm-svn: 211668
2014-06-25 05:37:58 +00:00
Zachary Turner 87422d9457 Don't go through the TypeSourceInfo when getting the SourceRange.
VarDecl provides a method getSourceRange(), which provides a more
robust way of getting the SourceRange since the TypeSourceInfo can
be null in certain cases.

Reviewed by: majnemer

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

llvm-svn: 211667
2014-06-25 05:37:25 +00:00
Rafael Espindola c00d875d35 Fix a regression from r211653.
The method was empty in the null streamer but I mistakenly replaced it with
the aborting one in MCStreamer.

llvm-svn: 211666
2014-06-25 05:31:22 +00:00
Simon Atanasyan 14ce18d577 [Driver] Follow-up to r211598, r211663. Do not build a dynamic linker
path using sub-strings concatenation. Return the whole string explicitly.

llvm-svn: 211665
2014-06-25 05:00:59 +00:00
NAKAMURA Takumi 6d9bb5cbb7 MCNullStreamer.cpp: Roll back a few empty methods that have been marked as unreachable in MCStreamer.cpp.
void EmitCOFFSecRel32(MCSymbol const *Symbol) override {}
  void EmitGPRel32Value(const MCExpr *Value) override {}

It should fix crash like "llc -mtriple=i686-cygwin -filetype=null".

llvm-svn: 211664
2014-06-25 04:34:36 +00:00
NAKAMURA Takumi 4286651821 Tools.cpp: Update getLinuxDynamicLinker() to return Twine instead of StringRef, since r211598 has introduced manipulation of return string.
llvm-svn: 211663
2014-06-25 04:34:20 +00:00
NAKAMURA Takumi 4669bd49a2 VirtualFileSystemTest.cpp: Get rid of initializer list on std::vector, to appease msc17.
llvm-svn: 211662
2014-06-25 04:34:10 +00:00
NAKAMURA Takumi d3235e0529 Reformat.
llvm-svn: 211661
2014-06-25 04:34:00 +00:00
Alexey Bataev df9b15905f [OPENMP] Improved code and replaced struct by lambda.
llvm-svn: 211660
2014-06-25 04:09:13 +00:00
NAKAMURA Takumi 78d8ebfc28 CodeGen/X86/pr20088.ll: Add -march=x86-64, or llc fails due to non-x86 default target.
llvm-svn: 211659
2014-06-25 03:05:47 +00:00
Jim Ingham 106d02866d Added an option to turn OFF the "detach on error" behavior that was added
to debugserver when launching processes.

<rdar://problem/16216199>

llvm-svn: 211658
2014-06-25 02:32:56 +00:00
JF Bastien ab8d0a0dd5 Implement predefined stdint macros
Add predefined stdint macros that match the given patterns:

U?INT{_,_FAST,_LEAST}{8,16,32,64}_{MAX,TYPE}
U?INT{PTR,MAX}_{MAX,TYPE}

http://reviews.llvm.org/D4141

Author: binji
llvm-svn: 211657
2014-06-25 01:31:33 +00:00
Alp Toker 7899d5049b Use SourceMgr::getMemoryBuffer() in a couple of places
Cleanup only.

llvm-svn: 211656
2014-06-25 00:41:15 +00:00