Commit Graph

182977 Commits

Author SHA1 Message Date
Saleem Abdulrasool b9e9e0d5f3 PECOFF: loosen assumptions about x86-only targets
Rather than saving whether we are targeting 64-bit x86 (x86_64), simply convert
the single use of that information to the actual relocation type.  This will
permit the selection of non-x86 relocation types (e.g. for WoA support).

Inline the access of the machine type field as it is relatively cheap (a couple
of pointer dereferences) rather than storing the relocation type as a member
variable.

llvm-svn: 218104
2014-09-19 06:09:25 +00:00
Saleem Abdulrasool 42c7aab748 ReaderWriter: print magic in hex
When we encounter an unknown machine type, we print out the machine type magic.
However, we would print out the magic in decimal rather than hex.  Perform this
conversion to make it easier to identify what machine is unsupported.

llvm-svn: 218103
2014-09-19 06:09:18 +00:00
Chandler Carruth 398ba9a018 [x86] Add a dedicated lowering path for zext-compatible vector shuffles
to the new vector shuffle lowering code.

This allows us to emit PMOVZX variants consistently for patterns where
it is a viable lowering. This instruction is both fast and allows us to
fold loads into it. This only hooks the new lowering up for i16 and i8
element widths, mostly so I could manage the change to the tests. I'll
add the i32 one next, although it is significantly less interesting.

One thing to note is that we already had some tests for these patterns
but those tests had far less horrible instructions. The problem is that
those tests weren't checking the strict start and end of the instruction
sequence. =[ As a consequence something changed in the lowering making
us generate *TERRIBLE* code for these patterns in SSE2 through SSSE3.
I've consolidated all of the tests and spelled out the madness that we
currently emit for these shuffles. I'm going to try to figure out what
has gone wrong here.

llvm-svn: 218102
2014-09-19 06:07:49 +00:00
Jiangning Liu ffbc690933 Optimize sext/zext insertion algorithm in back-end.
With this optimization, we will not always insert zext for values crossing
basic blocks, but insert sext if the users of a value crossing basic block
has preference of sign predicate.

llvm-svn: 218101
2014-09-19 05:30:35 +00:00
David Blaikie 03c3dbeb62 Omit DW_AT_frame_base under -gmlt for size
llvm-svn: 218100
2014-09-19 04:55:05 +00:00
David Blaikie 0b9438b1c1 Describe the -gmlt optimization committed in the previous revision.
llvm-svn: 218099
2014-09-19 04:47:46 +00:00
David Blaikie 73b65d236c Omit all the extra static attributes on subprograms in -gmlt
This omission will be done in a fancier manner once we're dealing with
"put gmlt in the skeleton CUs under fission" - it'll have to be
conditional on the kind of CU we're emitting into (skeleton or gmlt).

llvm-svn: 218098
2014-09-19 04:30:36 +00:00
Rafael Espindola 9f834735cd Don't use the third field of llvm.global_ctors for MachO.
The field is defined as:

If the third field is present, non-null, and points to a global variable or function, the initializer function will only run if the associated data from the current module is not discarded.

And without COMDATs we can't implement that.

llvm-svn: 218097
2014-09-19 01:54:22 +00:00
Saleem Abdulrasool 8bf8409be8 builtins: 80-column
Re-wrap a couple of lines.  NFC.

llvm-svn: 218096
2014-09-19 01:35:08 +00:00
Saleem Abdulrasool c5ff406f5f builtins: remove definition of __ARM_ARCH
__ARM_ARCH is part of the ACLE specification.  At least clang and GCC have
supported this part of the ACLE for some time now.  Let the compiler provide the
proper definition for the macro rather than try to guess it.

llvm-svn: 218095
2014-09-19 01:34:03 +00:00
Rafael Espindola 5b6fa2f85a Revert "Put more stuff in the comdat used for variables with static init."
This reverts commit r218089.
It looks like it was causing issues on COFF.

llvm-svn: 218094
2014-09-19 01:28:16 +00:00
Hans Wennborg c0f0c511db Fix an it's vs. its typo.
llvm-svn: 218093
2014-09-19 01:14:56 +00:00
Matt Arsenault 46cbc4367b R600: Better fix for bug 20982
Just do the left shift as unsigned to avoid the UB.

llvm-svn: 218092
2014-09-19 00:42:06 +00:00
Chandler Carruth be58fd2f2d [x86] Extend this test to cover SSE4.1. Nothing interesting here, but
paves the way for subsequent changes.

llvm-svn: 218091
2014-09-19 00:30:24 +00:00
Rui Ueyama 68085fda00 [PECOFF] __tls_used is _tls_used on x64.
llvm-svn: 218090
2014-09-19 00:22:22 +00:00
Rafael Espindola c0ce9eca0b Put more stuff in the comdat used for variables with static init.
Clang can already handle

-------------------------------------------
struct S {
  static const int x;
};
template<typename T> struct U {
  static const int k;
};
template<typename T> const int U<T>::k = T::x;

const int S::x = 42;
extern const int *f();
const int *g() { return &U<S>::k; }
int main() {
  return *f() + U<S>::k;
}

const int *f() { return &U<S>::k; }
-------------------------------------------

since r217264 which puts the .inint_array section in the same COMDAT
as the variable.

This patch allows the linker to more easily delete some dead code and data by
putting the guard variable and init function in the same COMDAT.

llvm-svn: 218089
2014-09-18 23:41:44 +00:00
Rui Ueyama 2ea8639696 Fixes wrong Twine uses in FileNode::errStr() and in LayoutPass.cpp
Patch from Rafael Auler!

llvm-svn: 218088
2014-09-18 23:21:39 +00:00
DeLesley Hutchins c60dc2cfb9 Thread Safety Analysis: add new warning flag, -Wthread-safety-reference, which
warns when a guarded variable is passed by reference as a function argument.
This is released as a separate warning flag, because it could potentially
break existing code that uses thread safety analysis.

llvm-svn: 218087
2014-09-18 23:02:26 +00:00
Peter Collingbourne 6b433e4d46 Try to fix i686-cygming bots.
llvm-svn: 218086
2014-09-18 22:56:00 +00:00
Matt Arsenault c1728972e1 Use cast<> instead of unchecked dyn_cast<>
llvm-svn: 218085
2014-09-18 22:28:56 +00:00
David Majnemer 9928106536 MS ABI: Don't ICE for pointers to pointers to members of incomplete classes
CodeGen would try to come up with an LLVM IR type for a pointer to
member type on the way to forming an LLVM IR type for a pointer to
pointer to member type.

However, if the pointer to member representation has not been locked in yet,
we would not be able to come up with a pointer to member IR type.

In these cases, make the pointer to member type an incomplete type.
This will make the pointer to pointer to member type a pointer to an
incomplete type.  If the class eventually obtains an inheritance model,
we will make the pointer to member type represent the actual inheritance
model.

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

llvm-svn: 218084
2014-09-18 22:05:54 +00:00
Rui Ueyama 1f684518c8 Fix buggy Twine storage in ELFLinkingContext::searchLibrary()
This patch fixes a forbidden use of Twine. It should only be used
as an intermediary value, but never stored.

This caused a bug in lld when running on Linux and compiled with
optimizations - it couldn't properly search libs.

Patch from Rafael Auler!

llvm-svn: 218083
2014-09-18 22:05:37 +00:00
Akira Hatanaka e867e422e2 [X86, inlineasm] Do not allow using constraint 'x' for a variable larger than
128-bit unless the target CPU supports AVX.

rdar://problem/11846140

llvm-svn: 218082
2014-09-18 21:58:54 +00:00
Peter Collingbourne 042b7ffd37 Fix sphinx warning.
llvm-svn: 218081
2014-09-18 21:54:02 +00:00
Greg Clayton ee3be91995 Add some tests to be skipped when run remotely and also fixed a test to be more reliable when it comes to stopping on a specific line.
llvm-svn: 218079
2014-09-18 21:32:05 +00:00
Peter Collingbourne 10039c02ea LTO: introduce object file-based on-disk module format.
This format is simply a regular object file with the bitcode stored in a
section named ".llvmbc", plus any number of other (non-allocated) sections.

One immediate use case for this is to accommodate compilation processes
which expect the object file to contain metadata in non-allocated sections,
such as the ".go_export" section used by some Go compilers [1], although I
imagine that in the future we could consider compiling parts of the module
(such as large non-inlinable functions) directly into the object file to
improve LTO efficiency.

[1] http://golang.org/doc/install/gccgo#Imports

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

llvm-svn: 218078
2014-09-18 21:28:49 +00:00
Rui Ueyama 6bf091c656 [PECOFF] /safeseh:no on x64 is not an error
I made LLD to report an error if /safeseh:no option is given on x64,
but it turned out MSVC link.exe doesn't report error on it.
Removing the check.

llvm-svn: 218077
2014-09-18 21:18:05 +00:00
Quentin Colombet 17799fedb7 [ARM] Do not perform a tail call when the caller returns several values.
The fix is slightly different then x86 (see r216117) because the number of values
attached to a return can vary even for a single returned value (e.g., f64 yields
two returned values).

<rdar://problem/18352998>

llvm-svn: 218076
2014-09-18 21:17:50 +00:00
Todd Fiala 87bac59adc llgs: removed some wait-for-stop code in inferior process launch pipeline.
The $A handler was unnecessarily waiting for the launched app to hit a stop
before returning.  Removed this code.

Renamed the llgs inferior launching code to LaunchProcessForDebugging ()
to prevent it from possibly being mistaken as code that lldb-platform uses
to launch a debugserver process.  We probably want to look at breaking out
llgs-specific and lldb-platform-specific code into separate derived classes,
with common code in a shared base class.

llvm-svn: 218075
2014-09-18 21:02:03 +00:00
Justin Bogner 1ae21d1367 llvm-cov: Simplify FunctionInstantiationSetCollector (NFC)
- Replace std::unordered_map with DenseMap
- Use std::pair instead of manually combining two unsigneds
- Assert if insert is called with invalid arguments
- Avoid an unnecessary copy of a std::vector

llvm-svn: 218074
2014-09-18 20:31:26 +00:00
Hans Wennborg 3c619a43d5 [X86, inline-asm] Allow 256-bit wide operands for the 'x' constraints
The 'x' constraint is for "any SSE register", and GCC seems to include the
256-bit ymm registers in that concept.

llvm-svn: 218073
2014-09-18 20:24:04 +00:00
Sergey Matveev 756afb2f82 [asan] Initialize logfile in asan_symbolize.py to sys.stdin.
llvm-svn: 218072
2014-09-18 20:01:28 +00:00
Sergey Matveev 4588de1c22 [asan] Fix a bug in asan_symbolize.py
Do not forget to add newlines between multiple symbolized lines corresponding to
a single input line (i.e. inlining).

llvm-svn: 218071
2014-09-18 19:16:44 +00:00
Dmitry Vyukov 59dce3d4d0 tsan: more careful handling of signals
On some tests we see that signals are not delivered
when a thread is blocked in epoll_wait. The hypothesis
is that the signal is delivered right before epoll_wait
call. The signal is queued as in_blocking_func is not set
yet, and then the thread just blocks in epoll_wait forever.
So double check pending signals *after* setting
in_blocking_func. This way we either queue a signal
and handle it in the beginning of a blocking func,
or process the signal synchronously if it's delivered
when in_blocking_func is set.

llvm-svn: 218070
2014-09-18 19:03:32 +00:00
Dmitry Vyukov c0ae07e98c tsan: fix signal_longjmp test in debug mode
In debug mode tsan checks that user accesses
access user memory. NULL is not user memory.
So the test fails. Allocate real inaccessible
memory for the test.

llvm-svn: 218069
2014-09-18 19:00:02 +00:00
Hans Wennborg dfd8c74a98 [clang-tidy] Don't leak the TodoCommentHandler object
Preprocessor:addCommentHandler() does not take ownership,
so we'd end up leaking the TodoCommentHandler.

This patch makes it owned by the Check object.

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

llvm-svn: 218068
2014-09-18 18:59:50 +00:00
Dmitry Vyukov 9767d2f8da tsan: fix double semicolon ;;
llvm-svn: 218067
2014-09-18 18:58:44 +00:00
Robin Morisset 5349e8e532 Restore "[ARM, Fix] Fix emitLeading/TrailingFence on old ARM processors"
Summary:
This patch was originally in D5304 (I could not find a way to reopen that revision).
It was accepted, commited and broke the build bots because the overloading of
the constructor of ArrayRef for braced initializer lists is not supported by all
toolchains. I then reverted it, and propose this fixed version that uses a plain
C array instead in makeDMB (that array is then converted implicitly to an
ArrayRef, but that is not behind an ifdef). Could someone confirm me whether
initialization lists for plain C arrays are supported by every toolchain used
to build llvm ? Otherwise I can just initialize the array in the old way:
args[0] = ...; .. ; args[5] = ...;

Below is the description of the original patch:
```
I had only tested this code for ARMv7 and ARMv8. This patch adds several
fallback paths if the processor does not support dmb ish:
- dmb sy if a cortex-M with support for dmb
- mcr p15, #0, r0, c7, c10, #5 for ARMv6 (special instruction equivalent to a DMB)
These fallback paths were chosen based on the code for fence seq_cst.

Thanks to luqmana for having noticed this bug.
```

Test Plan: Added more cases to atomic-load-store.ll + make check-all

Reviewers: jfb, t.p.northover, luqmana

Subscribers: llvm-commits, aemerson

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

llvm-svn: 218066
2014-09-18 18:56:04 +00:00
Akira Hatanaka 974131ea88 [X86, inlineasm] Check that the output size is correct for the given constraint.
llvm-svn: 218064
2014-09-18 18:17:18 +00:00
Fariborz Jahanian 3e6a0be4c4 Patch to check at compile time for overflow when
__builtin___memcpy_chk and similar builtins are
being used. Patch by Jacques Fortier (with added 
clang tests).  rdar://11076881

llvm-svn: 218063
2014-09-18 17:58:27 +00:00
Aaron Ballman 0bb041b5f4 Reverting NFC changes from r218050. Instead, the warning was disabled for GCC in r218059, so these changes are no longer required.
llvm-svn: 218062
2014-09-18 17:34:23 +00:00
Lang Hames 8d4d0260a1 [MCJIT] Fix a debugging-output formatting bug in RuntimeDyld.
The mismatched mask (7 vs (ColsPerRow-1)) could lead to partial lines being
printed out of place.

llvm-svn: 218061
2014-09-18 16:43:24 +00:00
Frederic Riss 0baab0cded Revert part of r218041.
The patch moved some logic around in an attempt to generate potentially more
DW_AT_declaration attributes. The patch was flawed though and it stopped
generating the attribute in some cases.

llvm-svn: 218060
2014-09-18 16:41:04 +00:00
David Blaikie 9db82cf45d Disable GCC's -Woverloaded-virtual in the configure+make build. Clang's is better.
Turns out Clang's -Woverloaded-virtual is enabled by -Wall in both CMake
and Configure builds. We were only explicitly specifying it (thus
enabling GCC's version of the warning) in the Configure build.

The specific case of interest is:

  struct base {
    virtual void func();
    virtual void func(int);
  };
  struct derived: base {
    virtual void func(); // GCC warns here, because this causes
                         // func(int) to be hidden
  };

I don't think that's worth getting fussed about (& Clang (indirectly
me... since I improved this warning in Clang) agrees or we would've made
the warning catch these cases.

Technically this could still lead to bugs/confusion if base had
func(int) and func(bool), derived overrode func(bool) and then a caller
with a derived object tried to call func(42) - it would silently call
func(bool). We should probably improve clang's warnings to catch this at
the call site at some point.

llvm-svn: 218059
2014-09-18 16:34:25 +00:00
Hans Wennborg e113c20c1d Revert r217995 and follow-ups:
r218053: Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
r218011: Work around MSVC parser bug by putting redundant braces around the body of
r217997: Skip parens when detecting whether we're instantiating a function declaration.
r217995: Instantiate exception specifications when instantiating function types (other

The Windows build was broken for 16 hours and no one had any good ideas of how to
fix it. Reverting for now to make the builders green. See the cfe-commits thread [1] for
more info.

This was the build error (from [2]):

C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang\lib\Sema\SemaTemplateInstantiate.cpp(1590) : error C2668: '`anonymous-namespace'::TemplateInstantiator::TransformFunctionProtoType' : ambiguous call to overloaded function
        C:\bb-win7\ninja-clang-i686-msc17-R\llvm-project\clang\lib\Sema\SemaTemplateInstantiate.cpp(1313): could be 'clang::QualType `anonymous-namespace'::TemplateInstantiator::TransformFunctionProtoType<clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>>(clang::TypeLocBuilder &,clang::FunctionProtoTypeLoc,clang::CXXRecordDecl *,unsigned int,Fn)'
        with
        [
            Fn=clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>
        ]
        c:\bb-win7\ninja-clang-i686-msc17-r\llvm-project\clang\lib\sema\TreeTransform.h(4532): or       'clang::QualType clang::TreeTransform<Derived>::TransformFunctionProtoType<clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>>(clang::TypeLocBuilder &,clang::FunctionProtoTypeLoc,clang::CXXRecordDecl *,unsigned int,Fn)'
        with
        [
            Derived=`anonymous-namespace'::TemplateInstantiator,
            Fn=clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>
        ]
        while trying to match the argument list '(clang::TypeLocBuilder, clang::FunctionProtoTypeLoc, clang::CXXRecordDecl *, unsigned int, clang::Sema::SubstFunctionDeclType::<lambda_756edcbe7bd5c7584849a6e3a1491735>)'

 1. http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140915/115011.html
 2. http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/10515/steps/build_clang_tools_1/logs/stdio

llvm-svn: 218058
2014-09-18 16:01:32 +00:00
Matt Arsenault 6462f94884 R600: Bug 20982 - Avoid undefined left shift of negative value
I'm not sure what the hardware actually does, so don't
bother trying to fold it for now.

llvm-svn: 218057
2014-09-18 15:52:26 +00:00
Alexander Kornienko 1aa0af2aca Use exceptions() instead of getNumExceptions()/getExceptionType() to avoid
accesses to incorrect exception types when getExceptionSpecType() != EST_Dynamic

This fixes a crash in test/CXX/except/except.spec/template.cpp that happens in
certain build configurations.

llvm-svn: 218053
2014-09-18 15:19:53 +00:00
Tobias Grosser 3ee7cdab53 Report possible aliasing deterministically
This commit drops a call to std::sort, which sorted the base pointers that
possibly alias according to the address at which their corresponding llvm::Value
was allocated. There does not seem to be any good reason, why those pointers
should be (re)sorted and this only makes the output indeterministic.

llvm-svn: 218052
2014-09-18 14:45:43 +00:00
Robert Khasanov f70f798474 [SKX] Deriving rmb multiclasses from general one (avx512_icmp_packed_rmb and avx512_icmp_cc_rmb).
Thanks Adam Nemet for notice about this.

llvm-svn: 218051
2014-09-18 14:06:55 +00:00
Aaron Ballman 11fa97fa32 Fixing a bunch of -Woverloaded-virtual warnings due to hiding getSubtargetImpl from the base class. NFC.
llvm-svn: 218050
2014-09-18 13:27:14 +00:00