Commit Graph

69765 Commits

Author SHA1 Message Date
Craig Topper 9d8e9ff620 [X86] Enable isel to use the PAUSE instruction even when SSE2 is disabled. Clang part
Summary:
On older processors this instruction encoding is treated as a NOP.

MSVC doesn't disable intrinsics based on features the way clang/gcc does. Because the PAUSE instruction encoding doesn't crash older processors, some software out there uses these intrinsics without checking for SSE2.

This change also seems to also be consistent with gcc behavior.

Fixes PR34079

Reviewers: RKSimon, zvi

Reviewed By: RKSimon

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36362

llvm-svn: 310191
2017-08-05 23:35:54 +00:00
Yaxun Liu a3c3d7b442 [OpenCL] Remove extra select functions from opencl-c.h
OpenCL spec v2.0 s6.13.6:

gentype select (gentype a,
gentype b,
igentype c)

gentype select (gentype a,
gentype b,
ugentype c)

igentype and ugentype must have the same number
of elements and bits as gentype.

Differential Revision: https://reviews.llvm.org/D36259

llvm-svn: 310160
2017-08-05 02:23:47 +00:00
Richard Trieu 5fb82efebf [ODRHash] Treat some non-templated classes as templated.
When using nested classes, if the inner class is not templated, but the outer
class is templated, the inner class will not be templated, but may have some
traits as if it were.  This is particularly evident if the inner class
refers to the outer class in some fashion.  Treat any class that is in the
context of a templated class as also a templated class.

llvm-svn: 310158
2017-08-05 00:54:19 +00:00
Vedant Kumar a7764adcbb Revert "[Coverage] Precise region termination with deferred regions"
This reverts commit r310010. I don't think there's anything wrong with
this commit, but it's causing clang to generate output that llvm-cov
doesn't do a good job with and the fix isn't immediately clear.

See Eli's comment in D36250 for more context.

I'm reverting the clang change so the coverage bot can revert back to
producing sensible output, and to give myself some time to investigate
what went wrong in llvm.

llvm-svn: 310154
2017-08-05 00:34:10 +00:00
Adrian Prantl b442302131 Debug Info: Set the DICompileUnit's isOptimized flag when compiling with LTO.
rdar://problem/27640939

llvm-svn: 310147
2017-08-04 23:08:57 +00:00
Reid Kleckner 2d3c421f1c Clean up some lambda conversion operator code, NFC
We don't need special handling in CodeGenFunction::GenerateCode for
lambda block pointer conversion operators anymore. The conversion
operator emission code immediately calls back to the generic
EmitFunctionBody.

Rename EmitLambdaStaticInvokeFunction to EmitLambdaStaticInvokeBody for
better consistency with the other Emit*Body methods.

I'm preparing to do something about PR28299, which touches this code.

llvm-svn: 310145
2017-08-04 22:38:06 +00:00
Reid Kleckner e6cde14416 [libclang] Determinize order of platform availability attrs
Previously this code was doing std::sort on IdentifierInfo pointers. Now
it sorts alphabetically by platform name.

This should de-flake clang/test/Index/availability.c, which was failing
non-deterministically for me.

llvm-svn: 310138
2017-08-04 21:52:25 +00:00
Reid Kleckner cefb333582 [Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on Windows
Summary:
Tools like clang that use RemoveFileOnSignal on their output files
weren't actually able to clean up their outputs before this change.  Now
the call to llvm::sys::fs::remove succeeds and the temporary file is
deleted. This is a stop-gap to fix clang before implementing the
solution outlined in PR34070.

Reviewers: davide

Subscribers: llvm-commits, hiraditya

Differential Revision: https://reviews.llvm.org/D36337

llvm-svn: 310137
2017-08-04 21:52:00 +00:00
Kostya Serebryany 7dbb1e179e [libFuzzer] add -fsanitize-coverage-pc-table to -fsanitize=fuzzer
llvm-svn: 310136
2017-08-04 21:35:11 +00:00
Alexey Bataev d90ec748a8 Revert "[OPENMP][DEBUG] Set proper address space info if required by target."
This reverts commit r310104.

llvm-svn: 310135
2017-08-04 21:27:11 +00:00
Alexey Bataev efd884d393 Revert "[OPENMP] Fix for pacify buildbots, NFC."
This reverts commit r310120.

llvm-svn: 310134
2017-08-04 21:26:25 +00:00
Vlad Tsyrklevich 3f3aad235d Reland "CFI: blacklist STL allocate() from unrelated-casts"
Reland r310097 with a fix for a debug assertion in NamedDecl.getName()

Differential Revision: https://reviews.llvm.org/D36294

llvm-svn: 310132
2017-08-04 21:21:00 +00:00
Vlad Tsyrklevich bbe96e50f3 Revert "Reland "CFI: blacklist STL allocate() from unrelated-casts""
This reverts commit r310105.

llvm-svn: 310121
2017-08-04 20:37:49 +00:00
Alexey Bataev e09a774bea [OPENMP] Fix for pacify buildbots, NFC.
llvm-svn: 310120
2017-08-04 20:29:52 +00:00
Vlad Tsyrklevich bf736037be Reland "CFI: blacklist STL allocate() from unrelated-casts"
Reland r310097 with a unit test fix for MS ABI build bots.

Differential Revision: https://reviews.llvm.org/D36294

llvm-svn: 310105
2017-08-04 19:50:39 +00:00
Alexey Bataev be83fad57e [OPENMP][DEBUG] Set proper address space info if required by target.
Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

llvm-svn: 310104
2017-08-04 19:46:10 +00:00
Vlad Tsyrklevich 3fed079f8c Revert "CFI: blacklist STL allocate() from unrelated-casts"
This reverts commit r310097.

llvm-svn: 310099
2017-08-04 19:17:16 +00:00
Alexey Bataev 2c7eee5b84 [OPENMP] Unify generation of outlined function calls.
llvm-svn: 310098
2017-08-04 19:10:54 +00:00
Vlad Tsyrklevich 44200125e9 CFI: blacklist STL allocate() from unrelated-casts
Summary:
Previously, STL allocators were blacklisted in compiler_rt's
cfi_blacklist.txt because they mandated a cast from void* to T* before
object initialization completed. This change moves that logic into the
front end because C++ name mangling supports a substitution compression
mechanism for symbols that makes it difficult to blacklist the mangled
symbol for allocate() using a regular expression.

Motivated by crbug.com/751385.

Reviewers: pcc, kcc

Reviewed By: pcc

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36294

llvm-svn: 310097
2017-08-04 19:10:11 +00:00
Florian Gross 4a72b4db55 [ASTMatcher] Add handling for DeducedType to HasDeclarationMatcher
HasDeclarationMatcher did not handle DeducedType, it always returned false for deduced types.

So with code like this:
struct X{};
auto x = X{};

This did no longer match:
varDecl(hasType(recordDecl(hasName("X"))))

Because HasDeclarationMatcher didn't resolve the DeducedType of x.

Differential Revision: https://reviews.llvm.org/D36308

llvm-svn: 310095
2017-08-04 18:59:19 +00:00
Yaxun Liu 39195062c2 Add OpenCL 2.0 atomic builtin functions as Clang builtin
OpenCL 2.0 atomic builtin functions have a scope argument which is ideally
represented as synchronization scope argument in LLVM atomic instructions.

Clang supports translating Clang atomic builtin functions to LLVM atomic
instructions. However it currently does not support synchronization scope
of LLVM atomic instructions. Without this, users have to use LLVM assembly
code to implement OpenCL atomic builtin functions.

This patch adds OpenCL 2.0 atomic builtin functions as Clang builtin
functions, which supports generating LLVM atomic instructions with
synchronization scope operand.

Currently only constant memory scope argument is supported. Support of
non-constant memory scope argument will be added later.

Differential Revision: https://reviews.llvm.org/D28691

llvm-svn: 310082
2017-08-04 18:16:31 +00:00
Martin Probst f785fd94c6 clang-format: [JS] support fields with case/switch/default labels.
Summary:
`case:` and `default:` would normally parse as labels for a `switch` block.
However in TypeScript, they can be used in field declarations, e.g.:

    interface I {
      case: string;
    }

This change special cases parsing them in declaration lines to avoid wrapping
them.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D36148

llvm-svn: 310070
2017-08-04 17:07:15 +00:00
Stefan Maksimovic 5c7aaa5ff3 Revert r304953 for release 5.0.0
This is causing failures when compiling clang with -O3
as one of the structures used by clang is passed by
value and uses the fastcc calling convention.

Faliures manifest for stage2 mips build.

llvm-svn: 310057
2017-08-04 12:37:34 +00:00
Florian Hahn 83e57c2327 [Driver] Error if ARM mode was selected explicitly for M-profile CPUs.
Summary:
M-class profiles do not support ARM execution mode, so providing
-marm/-mno-thumb does not make sense in combination with -mcpu/-march
options that support the M-profile.

This is a follow-up patch to D35569 and it seemed pretty clear that we
should emit an error in the driver in this case.

We probably also should warn/error if the provided -mcpu/-march options
do not match, e.g. -mcpu=cortex-m0 -march=armv8-a is invalid, as
cortex-m0 does not support armv8-a. But that should be a separate patch
I think.


Reviewers: echristo, richard.barton.arm, rengolin, labrinea, charles.baylis

Reviewed By: rengolin

Subscribers: aemerson, javed.absar, kristof.beyls, cfe-commits

Differential Revision: https://reviews.llvm.org/D35826

llvm-svn: 310047
2017-08-04 10:40:18 +00:00
Manuel Klimek 9c0f79663e Fix typo and update documentation.
The hasDeclaration documentation was outdated after r288366.

llvm-svn: 310041
2017-08-04 08:41:42 +00:00
Simon Atanasyan 01fd402604 [mips] Fix typo (missed space) in the warning message
llvm-svn: 310038
2017-08-04 08:25:15 +00:00
Simon Atanasyan 6faaeb0035 [mips] Code formatting fix. NFC
llvm-svn: 310037
2017-08-04 08:25:09 +00:00
NAKAMURA Takumi 8e72a07efe Revert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary file name."
It generates MODULE-XXXXXXXXXXXX-%%%%%%%%.pcm, then GlobalModuleIndex.cpp is confused with the suffix ".pcm"

llvm-svn: 310030
2017-08-04 06:35:32 +00:00
Vedant Kumar 0b48042a65 Revert "[coverage] Special-case calls to noreturn functions."
This reverts commit r309995. It looks like it's responsible for breaking
the stage2 coverage build:

http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1402

The cfe-commits discussion re: r309995 has more context.

llvm-svn: 310019
2017-08-04 04:08:23 +00:00
Petr Hosek 83214dfb01 [Driver][Fuchsia] Pass --hash-style=gnu to the linker
The .gnu_hash format is superior, and all versions of the Fuchsia
dynamic linker support it.

Differential Revision: https://reviews.llvm.org/D36254

llvm-svn: 310017
2017-08-04 02:39:27 +00:00
Vedant Kumar 85e6dce1eb [Coverage] Precise region termination with deferred regions
The current coverage implementation doesn't handle region termination
very precisely. Take for example an `if' statement with a `return':

  void f() {
    if (true) {
      return; // The `if' body's region is terminated here.
    }
    // This line gets the same coverage as the `if' condition.
  }

If the function `f' is called, the line containing the comment will be
marked as having executed once, which is not correct.

The solution here is to create a deferred region after terminating a
region. The deferred region is completed once the start location of the
next statement is known, and is then pushed onto the region stack.
In the cases where it's not possible to complete a deferred region, it
can safely be dropped.

Testing: lit test updates, a stage2 coverage-enabled build of clang
llvm-svn: 310010
2017-08-04 00:29:20 +00:00
Akira Hatanaka b72e35a4c4 [Driver][Darwin] Pass -munwind-table when !UseSjLjExceptions.
This commit fixes a bug where clang/llvm doesn't emit an unwind table
for a function when it is marked noexcept. Without this patch, the
following code terminates with an uncaught exception on ARM64:

int foo1() noexcept {
  try {
    throw 0;
  } catch (int i) {
    return 0;
  }
  return 1;
}

int main() {
  return foo1();
}

rdar://problem/32411865

Differential Revision: https://reviews.llvm.org/D35693

llvm-svn: 310006
2017-08-03 23:55:42 +00:00
Petr Hosek b31582b196 Enable AddressSanitizer for Fuchsia targets
Patch by Roland McGrath

Differential Revision: https://reviews.llvm.org/D35922

llvm-svn: 309999
2017-08-03 23:02:22 +00:00
Eli Friedman 2d30c64ae3 [coverage] Special-case calls to noreturn functions.
The code after a noreturn call doesn't execute.

The pattern in the testcase is pretty common in LLVM (a switch with
a default case that calls llvm_unreachable).

Differential Revision: https://reviews.llvm.org/D36250

llvm-svn: 309995
2017-08-03 22:27:36 +00:00
Nico Weber 09f4992c36 Use "foo-12345.o" instead of "foo.o-12345" as temporary file name.
This helps some tools that do things based on the output's extension.

For example, we got reports from users on Windows that have a tool that scan a
build output dir (but skip .obj files). The tool would keep the "foo.obj-12345"
file open, and then when clang tried to rename the temp file to the final
output filename, that would fail. By making the tempfile end in ".obj", tools
like this will now skip the temp files as well.

https://reviews.llvm.org/D36238

llvm-svn: 309984
2017-08-03 21:06:36 +00:00
Simon Dardis d72c5e54c0 [mips] Revert r309942 & r309940
This reverts commit r309942 & commit r309940.

A revert was requested following post commit review.

llvm-svn: 309978
2017-08-03 19:39:51 +00:00
Richard Smith c7baf8073f Revert accidentally-committed files.
llvm-svn: 309976
2017-08-03 19:25:02 +00:00
Richard Smith 5786582052 Don't emit undefined-internal warnings for CXXDeductionGuideDecls.
Patch by ~paul (cynecx on phabricator)! Some test massaging by me.

llvm-svn: 309975
2017-08-03 19:24:27 +00:00
Devin Coughlin f0cadcd9f3 [Analyzer] Add support for displaying cross-file diagnostic paths in HTML output
This change adds support for cross-file diagnostic paths in html output. If the
diagnostic path is not cross-file, there is no change in the output.

Patch by Vlad Tsyrklevich!

Differential Revision: https://reviews.llvm.org/D30406

llvm-svn: 309968
2017-08-03 18:12:22 +00:00
Nico Weber 9901472cfa Revert r304836.
See discussion in https://reviews.llvm.org/D33900#824172

llvm-svn: 309960
2017-08-03 16:46:17 +00:00
Don Hinton 6c2ded879d [diagtool] Add ability to pass in the id and return the name for a
particular diagnostic.

Differential Revision: https://reviews.llvm.org/D36252

llvm-svn: 309955
2017-08-03 16:13:13 +00:00
Gabor Horvath fb895e9064 Fix some typos in the documentation.
Patch by: Reka Nikolett Kovacs

llvm-svn: 309948
2017-08-03 15:38:14 +00:00
Simon Dardis 2ee2263640 [mips] Fixup r309940.
Needed a // REQUIRES: mips-registered-target

llvm-svn: 309942
2017-08-03 14:35:06 +00:00
Krasimir Georgiev ddb19248eb [clang-format] Fix indent of 'key <...>' and 'key {...}' in text protos
Summary:
This patch fixes the indentation of the code pattern `key <...>`and `key {...}` in text protos.
Previously, such line would be alinged depending on the column of the previous
colon, which usually indents too much.

I'm gonna go ahead and commit this since it's a straightforward bugfix.

Reviewers: djasper, klimek

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D36143

llvm-svn: 309941
2017-08-03 14:17:29 +00:00
Simon Dardis 50f6d35457 [mips] Implement -muninit-const-in-rodata
This option when combined with -mgpopt and -membedded-data places all
uninitialized constant variables in the read-only section.

Reviewers: atanasyan, nitesh.jain

Differential Revision: https://reviews.llvm.org/D35917

llvm-svn: 309940
2017-08-03 14:01:17 +00:00
Krasimir Georgiev fa4dbb6820 [clang-format] Fix parsing of <>-style proto options
Summary:
This patch fixes the parsing of proto option fields like `option op = <...>`.
Previously the parser did not enter the right code path inside the angle braces,
causing the contents to be split into several unwrapped lines inside.

I'll just go ahead and commit this since it's a straightforward bugfix.

Reviewers: djasper, klimek

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D36217

llvm-svn: 309937
2017-08-03 13:43:45 +00:00
Simon Dardis eeed000f62 [mips] Add support -m(no-)embedded-data option
Add support for the -membedded-data option which places constant data in
the .rodata section, rather than the .sdata section.

Reviewers: atanasyan, nitesh.jain

Differential Revision: https://reviews.llvm.org/D35914

llvm-svn: 309935
2017-08-03 13:04:29 +00:00
Rafael Espindola aa0226ed71 Update for llvm change.
llvm-svn: 309912
2017-08-03 02:16:28 +00:00
Tim Shen 1efd2229f0 [Sema] Add a comment on an identified bug on default arguments.
Summary:
The mis-compile is triggered by internal code, but I haven't reduced it to a small piece of code. Add a FIXME here, since a decent fix doesn't seem to be trivial.

The decent fix can be changing Decl::Init to PointerUnion<Stmt *, EvaluatedStmt *, ParamVarDecl *>, and make setUninstantiatedDefaultArg take a ParamVarDecl *, which contains the Expr * as the default argument. This way, getTemplateInstantiationArgs can take that ParamVarDecl and do the right thing.

Reviewers: rsmith

Subscribers: sanjoy, cfe-commits

Differential Revision: https://reviews.llvm.org/D36253

llvm-svn: 309908
2017-08-03 00:18:11 +00:00
Eli Friedman 7f53fbfcdc [coverage] Make smaller regions for the first case of a switch.
We never overwrite the end location of a region, so we would end up with
an overly large region when we reused the switch's region.

It's possible this code will be substantially rewritten in the near
future to deal with fallthrough more accurately, but this seems like
an improvement on its own for now.

Differential Revision: https://reviews.llvm.org/D34801

llvm-svn: 309901
2017-08-02 23:22:50 +00:00