Commit Graph

7670 Commits

Author SHA1 Message Date
Alexey Bataev f002acae9d [OPENMP] Improve debug location codegen for OpenMP runtime library.
llvm-svn: 209876
2014-05-30 05:48:40 +00:00
Diego Novillo d23ec94393 Add flags -Rpass-missed and -Rpass-analysis.
Summary:
These two flags are in the same family as -Rpass, but are used in
different situations.

-Rpass-missed is used by optimizers to inform the user when they tried
to apply an optimization but couldn't (or wouldn't).

-Rpass-analysis is used by optimizers to report analysis results back
to the user (e.g., why the transformation could not be applied).

Depends on D3682.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 209839
2014-05-29 19:55:06 +00:00
Nico Rieck b4662c3e5a MS ABI: Emit static data members with proper linkage
llvm-svn: 209826
2014-05-29 16:50:46 +00:00
Diego Novillo 9c89ff1945 Fix spurious remarks when -Weverything is used.
With -Weverything, the backend remarks are enabled. This was
causing spurious diagnostics for remarks that we don't yet
handle (cf http://reviews.llvm.org/D3683).

This will stop being a problem once http://reviews.llvm.org/D3683
is committed.

llvm-svn: 209823
2014-05-29 16:19:27 +00:00
Alexey Samsonov c054d9813c [ASan] Hoist blacklisting globals from init-order checking to Clang.
Clang knows about the sanitizer blacklist and it makes no sense to
add global to the list of llvm.asan.dynamically_initialized_globals if it
will be blacklisted in the instrumentation pass anyway. Instead, we should
do as much blacklisting as possible (if not all) in the frontend.

llvm-svn: 209789
2014-05-29 01:43:53 +00:00
Warren Hunt 583db1979c Reverting 209503 - Breaks asan blacklists
I opened a discussion on cfe-commits.  Ideally we've got a few things 
that need to happen.  CompilerRT should probably have blacklists tests.  
Asan should probably not depend on that specific field.

llvm-svn: 209766
2014-05-28 19:17:45 +00:00
Adrian Prantl 328f88add9 Debug Info: Fix the source range for IfStmt's ConditionScope.
Since the continuation block of the if statement is emitted within the
condition scope this had the undesirable effect of creating a line table
entry at the end of the then or else statement, a line that may have never
been executed.
PR19864 / rdar://problem/17052973

llvm-svn: 209764
2014-05-28 19:10:59 +00:00
Nick Lewycky 9b46eb8112 Add 'nonnull' parameter or return attribute when producing an llvm pointer type in a function type where the C++ type is a reference. Update the tests.
llvm-svn: 209723
2014-05-28 09:56:42 +00:00
Hans Wennborg 275efb9e50 Don't dllimport/export destructor variants implemented by thunks.
MSVC doesn't export these functions, so trying to import them doesnt' work.
Also, don't let any dll attributes on the CXXDestructorDecl influence the
thunk's linkage -- they should always be linkonce_odr.

This takes care of the FIXME's for this in Nico's tests.

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

llvm-svn: 209706
2014-05-28 01:52:23 +00:00
Renato Golin e7b3d5dcb4 Revert small change to EmitDeclRefLValue
That small change, although it looked harmless, it made emitting the LValue
on the PHI node without the proper cast. Reverting it fixes PR19841.

llvm-svn: 209663
2014-05-27 16:46:27 +00:00
Hans Wennborg 905f806098 Fix some misplaced spaces around 'override'
llvm-svn: 209588
2014-05-24 20:18:32 +00:00
Tim Northover 573cbee543 AArch64/ARM64: rename ARM64 components to AArch64
This keeps Clang consistent with backend naming conventions.

llvm-svn: 209579
2014-05-24 12:52:07 +00:00
Tim Northover 25e8a6754e AArch64/ARM64: update Clang after AArch64 removal.
A few (mostly CodeGen) parts of Clang were tightly coupled to the
AArch64 backend. Now that it's gone, they will not even compile.

I've also deduplicated RUN lines in many of the AArch64 tests. This
might improve "make check-all" time noticably: some of those NEON
tests were monsters.

llvm-svn: 209578
2014-05-24 12:51:25 +00:00
Reid Kleckner 563f0e852c Use comdats to avoid double initialization of weak data
Initializers of global data that can appear multiple TUs (static data
members of class templates or __declspec(selectany) data) are now in a
comdat group keyed on the global variable being initialized.  On
non-Windows platforms, this is a code size and startup time
optimization.  On Windows, this is necessary for ABI compatibility with
MSVC.

Fixes PR16959.

Reviewers: rsmith

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

llvm-svn: 209555
2014-05-23 21:13:45 +00:00
Hans Wennborg a926d84c4b Emit used/dllexport inline method definitions in nested classes (PR19743, PR11170)
The previous code that was supposed to handle this didn't work
since parsing of inline method definitions is delayed to the end
of the outer class definition. Thus, when HandleTagDeclDefinition()
got called for the inner class, the inline functions in that class
had not been parsed yet.

Richard suggested that the way to do this is by handling inline
method definitions through a new ASTConsumer callback.

I really wanted to call ASTContext::DeclMustBeEmitted() instead of
checking for attributes, but doing that causes us to compute linkage,
and then we fail with "error: unsupported: typedef changes linkage
of anonymous type, but linkage was already computed" on tests like
this: (from SemaCXX/undefined-internal.cpp) :-/

  namespace test7 {
    typedef struct {
      void bar();
      void foo() { bar(); }
    } A;
  }

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

llvm-svn: 209549
2014-05-23 20:37:38 +00:00
Warren Hunt 51ec916e20 [MS-ABI] Silence warning from r209523
no functional change.

llvm-svn: 209525
2014-05-23 16:26:32 +00:00
Warren Hunt 5c2b4ea662 [MS-ABI] Implements MS-compatible RTTI
Enables the emission of MS-compatible RTTI data structures for use with 
typeid, dynamic_cast and exceptions.  Does not implement dynamic_cast 
or exceptions.  As an artiface, typeid works in some cases but proper 
support an testing will coming in a subsequent patch.

majnemer has fuzzed the results.  Test cases included.

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

llvm-svn: 209523
2014-05-23 16:07:43 +00:00
Robert Lytton 57dd5cf441 Fix '-main-file-name <name>' so that it is used for the ModuleID.
Summary:
Previously, you could not specify the original file name when passing a preprocessed file into the compiler
Now you can use 'clang -Xclang -main-file-name -Xclang <original file name> ...'
Or 'clang -cc1 -main-file-name <original file name> ...'

llvm-svn: 209503
2014-05-23 07:34:08 +00:00
Rafael Espindola b73c973d3b Don't set unnamed_addr in CreateRuntimeVariable.
This was fairly broken. For example,

@__dso_handle would or would not get an unnamed_addr depending on how many
global destructors were used in a translation unit.

The consensus was that not every runtime variable is unnamed_addr and that
__dso_handle handle should not be, so just don't add unnamed_addr in
CreateRuntimeVariable.

llvm-svn: 209484
2014-05-22 23:33:27 +00:00
Alexander Musman 515ad8c490 This patch adds a helper class (CGLoopInfo) for marking memory instructions with llvm.mem.parallel_loop_access metadata.
It also adds a simple initial version of codegen for pragma omp simd (it will change in the future to support all the clauses).

Differential revision: http://reviews.llvm.org/D3644

llvm-svn: 209411
2014-05-22 08:54:05 +00:00
Craig Topper 8a13c4180e [C++11] Use 'nullptr'. CodeGen edition.
llvm-svn: 209272
2014-05-21 05:09:00 +00:00
Eric Christopher 4015e124e3 Update for paired llvm commit with AsmVerbose.
llvm-svn: 209261
2014-05-21 00:00:03 +00:00
Eric Christopher acca0085c1 Update for llvm change to avoid having global flag setting in TargetMachine.
llvm-svn: 209239
2014-05-20 21:25:41 +00:00
Peter Collingbourne 41af7c2fdc Implement the flatten attribute.
This is a GNU attribute that causes calls within the attributed function
to be inlined where possible. It is implemented by giving such calls the
alwaysinline attribute.

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

llvm-svn: 209217
2014-05-20 17:12:51 +00:00
Eric Christopher c9e2a68905 Clean up language and grammar.
Based on a patch by jfcaron3@gmail.com!
PR19806

llvm-svn: 209215
2014-05-20 17:10:39 +00:00
Robert Lytton db8c1cb02c XCore target: sort typestring enum fields alphabetically
llvm-svn: 209196
2014-05-20 07:19:33 +00:00
Adrian Prantl 2dbdd20d37 Demote the "Debug Info Version" module flag to llvm::Module::Warning
behavior on mismatch. The AutoUpgrader will drop incompatible debug info
any way and also emit a warning diagnostic for it.

rdar://problem/16926122

llvm-svn: 209182
2014-05-19 23:40:06 +00:00
Renato Golin c296d951a7 Using SmallString and correct addr var
llvm-svn: 209180
2014-05-19 23:25:25 +00:00
Renato Golin 156a853ccb Fix usage of string when StringRef was needed
Also adding a variable to the test, so release bots match %1.
This should also calm the gdb buildbot.

.

llvm-svn: 209171
2014-05-19 22:36:19 +00:00
Peter Collingbourne b4728c12e8 Implement the no_split_stack attribute.
This is a GNU attribute that allows split stacks to be turned off on a
per-function basis.

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

llvm-svn: 209167
2014-05-19 22:14:34 +00:00
Renato Golin 230c5eb4bd Non-allocatable Global Named Register
This patch implements global named registers in Clang, lowering to the just
created intrinsics in LLVM (@llvm.read/write_register). A new type of LValue
had to be created (Register), which just adds support to carry the metadata
node containing the name of the register. Two new methods to emit loads and
stores interoperate with another to emit the named metadata node.

No guarantees are being made and only non-allocatable global variable named
registers are being supported. Local named register support is unchanged.

llvm-svn: 209149
2014-05-19 18:15:42 +00:00
Oliver Stannard a3afc69b94 ARM: PCS non-compliance when struct is padded to avoid register/stack split, and requires internal padding
When we were padding a struct to avoid splitting it between registers and
the stack, we were throwing away the type which the argument should be coerced
to.

llvm-svn: 209122
2014-05-19 13:10:05 +00:00
Rafael Espindola 234405bd0f Update for llvm api change.
llvm-svn: 209077
2014-05-17 21:30:14 +00:00
Rafael Espindola 6172277e9f Update for llvm api change.
llvm-svn: 209074
2014-05-17 19:58:16 +00:00
Saleem Abdulrasool b9081f4490 CodeGen: remove MinGW and Cygwin legacy entries
These are now treated as environments.  Remove references to these enumeration
values in order to clean up the unused enumeration entries in LLVM.  The target
normalisation prior to tool invocation should ensure that the old values
continue to function properly.

llvm-svn: 209068
2014-05-17 15:46:59 +00:00
Richard Smith 053f6c6c9e If a declaration is loaded, and then a module import adds a redeclaration, then
ensure that querying the first declaration for its most recent declaration
checks for redeclarations from the imported module.

This works as follows:
 * The 'most recent' pointer on a canonical declaration grows a pointer to the
   external AST source and a generation number (space- and time-optimized for
   the case where there is no external source).
 * Each time the 'most recent' pointer is queried, if it has an external source,
   we check whether it's up to date, and update it if not.
 * The ancillary data stored on the canonical declaration is allocated lazily
   to avoid filling it in for declarations that end up being non-canonical.
   We'll still perform a redundant (ASTContext) allocation if someone asks for
   the most recent declaration from a decl before setPreviousDecl is called,
   but such cases are probably all bugs, and are now easy to find.

Some finessing is still in order here -- in particular, we use a very general
mechanism for handling the DefinitionData pointer on CXXRecordData, and a more
targeted approach would be more compact.

Also, the MayHaveOutOfDateDef mechanism should now be expunged, since it was
addressing only a corner of the full problem space here. That's not covered
by this patch.

Early performance benchmarks show that this makes no measurable difference to 
Clang performance without modules enabled (and fixes a major correctness issue
with modules enabled). I'll revert if a full performance comparison shows any
problems.

llvm-svn: 209046
2014-05-16 23:01:30 +00:00
Rafael Espindola 0fcad8837b Use getAliasee instead of getAliasedGlobal.
No functionality change.

llvm-svn: 209038
2014-05-16 22:20:18 +00:00
Eric Christopher e76eee4638 Missed a ! in the if statement when these were being set and the options
are inverted in clang and llvm.

I'll attempt to get a testcase for this that doesn't involve compiling to .s,
but it's unlikely.

llvm-svn: 209017
2014-05-16 20:46:14 +00:00
Rafael Espindola b2633b9793 Update for llvm api change.
Now that llvm cannot represent alias cycles, we have to diagnose erros just
before trying to close the cycle. This degrades the errors a bit. The real
solution is what it was before: if we want to provide good errors for these
cases, we have to be able to find a clang level decl given a mangled name
and produce the error from Sema.

llvm-svn: 209008
2014-05-16 19:35:48 +00:00
Alp Toker 6ac2cd01d2 Rename SourceManager::createFileIDForMemBuffer()
It makes more sense to just overload createFileID().

Gardening only.

llvm-svn: 209002
2014-05-16 17:23:01 +00:00
Rafael Espindola 9750ce7ebd Update for llvm API change.
llvm-svn: 208984
2014-05-16 13:34:28 +00:00
Duncan P. N. Exon Smith 9121220804 InstrProf: Set profile data to visibility hidden
Shared objects are fairly broken for InstrProf right now -- a follow-up
commit in compiler-rt will fix the rest of this.

The main problem here is that at link time, profile data symbols in the
shared object might get used instead of symbols from the main
executable, creating invalid profile data sections.

<rdar://problem/16918688>

llvm-svn: 208939
2014-05-16 01:24:00 +00:00
Reid Kleckner 966abe7614 MS ABI: Use musttail for thunk IR generation
This allows us to perfectly forward non-trivial arguments that use
inalloca.

We still can't forward non-trivial arguments through thunks when we have
a covariant return type with a non-trivial adjustment.  This would
require emitting an extra copy, which is non-conforming anyway.

llvm-svn: 208927
2014-05-15 23:01:46 +00:00
Hans Wennborg b0f2f146bb Allow dllimport/dllexport on inline functions and adjust the linkage.
This is a step towards handling these attributes on classes (PR11170).

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

llvm-svn: 208925
2014-05-15 22:07:49 +00:00
Reid Kleckner d355ca77a9 Revert Itanium parts of "Don't copy objects with trivial, deleted copy ctors"
This undoes half of r208786.

It had problems with lazily declared special members in cases like this:
  struct A {
    A();
    A &operator=(A &&o);
    void *p;
  };
  void foo(A);
  void bar() {
    foo({});
  }

In this case, the copy and move constructors are implicitly deleted.
However, Clang doesn't eagerly declare the copy ctor in the AST, so we
pass the struct in registers.  Furthermore, GCC passes this in registers
even though this class should be uncopyable.

Revert this for now until the dust settles.

llvm-svn: 208836
2014-05-15 01:26:32 +00:00
Eric Christopher 7e72a0932b Fill in the options in the MCOptions struct directly like the other
options.

llvm-svn: 208834
2014-05-15 01:21:56 +00:00
Hans Wennborg 1a3a07471f Rename CodeGenModule::getLLVMLinkageforDeclarator -> getLLVMLinkageForDeclarator
No functionality change.

llvm-svn: 208808
2014-05-14 19:54:53 +00:00
Reid Kleckner cf87e10f9d Don't copy objects with trivial, deleted copy ctors
This affects both the Itanium and Microsoft C++ ABIs.

This is in anticipation of a change to the Itanium C++ ABI, and should
match GCC's current behavior.  The new text will likely be:

"""
Pass an object of class type by value if every copy constructor and
move constructor is deleted or trivial and at least one of them is not
deleted, and the destructor is trivial.
"""
http://sourcerytools.com/pipermail/cxx-abi-dev/2014-May/002728.html

On x86 Windows, we can mostly use the same logic, where we use inalloca
instead of passing by address.  However, on Win64, there are register
parameters, and we have to do what MSVC does.  MSVC ignores the presence
of non-trivial move constructors and only considers the presence of
non-trivial or deleted copy constructors.  If a non-trivial or deleted
copy ctor is present, it passes the argument indirectly.

This change fixes bugs and makes us more ABI compatible with both GCC
and MSVC.

Fixes PR19668.

Reviewers: rsmith

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

llvm-svn: 208786
2014-05-14 16:02:09 +00:00
Hao Liu 9f9492b657 [ARM64]Fix the bug right shift uint64_t by 64 generates incorrect result.
llvm-svn: 208761
2014-05-14 08:59:30 +00:00
David Blaikie aabde05da1 DebugInfo: Avoid creating DILexicalScopeFiles when the filename in the current scope has not changed.
This looks like the right way for this check to work, but there is
another semi-obvious bug, I would think: why is CurLoc not zero'd out
between functions? The possibility for it to bleed between them seems
problematic. (& indeed I caused tests to fail when I fixed this a
different way, by setting CurLoc to SourceLocation() and the end of
EmitFunctionEnd... )

The changes to debug-info-blocks.m are due to a mismatch between the
source manager's file naming and CGDebugInfo's default handling when no
-main-file-name is specified. This actually reveals somewhat of a bug in
the debug info when using source files from standard in, too. See the
comment in CGDebugInfo::CreateCompileUnit for more details.

llvm-svn: 208742
2014-05-14 00:29:00 +00:00