Mandeep Singh Grang [Wed, 9 Aug 2017 17:58:39 +0000 (17:58 +0000)]
[COFF, ARM64] Add MS builtins __dmb, __dsb, __isb
Reviewers: mstorsjo, rnk, ruiu, compnerd, efriedma
Reviewed By: efriedma
Subscribers: efriedma, aemerson, javed.absar, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D36110
llvm-svn: 310502
Tim Hammerquist [Wed, 9 Aug 2017 17:27:02 +0000 (17:27 +0000)]
Fix VASprintfTest.cpp for Darwin, add checks
Summary:
The EncodingError test ensures that trying to encode a multibyte wchar
with a given codepage fails. If setlocale() fails, the encoding is
performed using the current locale, which may or may not fail.
This patch asserts that both setlocale() operations are successful, as
well as falling back to a widely available unibyte encoding for
non-Windows systems.
<rdar://problem/
33782806>
Reviewers: zturner, labath, lhames
Reviewed By: zturner
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D36496
llvm-svn: 310499
Guy Blank [Wed, 9 Aug 2017 17:21:01 +0000 (17:21 +0000)]
[X86][AVX512] Choose correct registers in vpbroadcastb/w
Fixes the vpbroadcastb/w instructions which use GPRs as source operands, to use the correct registers.
The full GPR should be used, and not the subregister, as it happens before the patch.
Fixes pr33795
Differential Revision:
https://reviews.llvm.org/D36479
llvm-svn: 310498
Dmitry Preobrazhensky [Wed, 9 Aug 2017 17:10:47 +0000 (17:10 +0000)]
[AMDGPU][MC][GFX9] Added 16-bit renamed and "_legacy" VALU opcodes
See Bug 33629: https://bugs.llvm.org//show_bug.cgi?id=33629
Reviewers: vpykhtin, SamWot, arsenm
Differential Revision: https://reviews.llvm.org/D36322
llvm-svn: 310497
Haojian Wu [Wed, 9 Aug 2017 17:03:42 +0000 (17:03 +0000)]
[clang-tidy] Fix another crash in make-unique check.
Summary:
The crash happens when calling `reset` method without any preceding
operation like "->" or ".", this could happen in a subclass of the
"std::unique_ptr".
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: JDevlieghere, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D36452
llvm-svn: 310496
Nuno Lopes [Wed, 9 Aug 2017 17:02:18 +0000 (17:02 +0000)]
CFLAA: return MustAlias when pointers p, q are equal, i.e.,
must-alias(p, sz_p, p, sz_q) irrespective of access sizes sz_p, sz_q
As discussed a couple of weeks ago on the ML.
This makes the behavior consistent with that of BasicAA.
AA clients already check the obj size themselves and may not require the
obj size to match exactly the access size (e.g., in case of store forwarding)
llvm-svn: 310495
Michael Kruse [Wed, 9 Aug 2017 16:45:37 +0000 (16:45 +0000)]
Remove dependency of Scop::getStmtFor(Inst) on getStmtFor(BB). NFC.
We are working towards removing uses of Scop::getStmtFor(BB). In this
patch, we remove dependency of Scop::getStmtFor(Inst) on getStmtFor(BB).
To do so, we introduce a map of instructions to their corresponding scop
statements and use it to get the instructions' statement.
Contributed-by: Nandini Singhal <cs15mtech01004@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D35663
llvm-svn: 310494
Davide Italiano [Wed, 9 Aug 2017 16:06:54 +0000 (16:06 +0000)]
[ValueTracking] Turn a test into an assertion.
As discussed with Chad, this should never happen, but this
assertion is basically free, so, keep it around just in case.
llvm-svn: 310493
Davide Italiano [Wed, 9 Aug 2017 16:06:04 +0000 (16:06 +0000)]
[ValueTracking] Update tests to unbreak the bots.
llvm-svn: 310492
Alexander Kornienko [Wed, 9 Aug 2017 16:00:31 +0000 (16:00 +0000)]
[clang-tidy] Ignore newlines in checks list
This is a follow up to https://reviews.llvm.org/D30567 where I overlooked that
LLVM YAML parser doesn't support multiline literal folding.
llvm-svn: 310491
Sanjay Patel [Wed, 9 Aug 2017 15:57:02 +0000 (15:57 +0000)]
[x86] add more tests for select-of-constants; NFC
This is to help recommit a fixed version of r310208. As shown in PR34097,
we could miscompile if subtraction of the constants overflowed.
llvm-svn: 310490
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 15:56:54 +0000 (15:56 +0000)]
[OpenMP] Add flag for overwriting default PTX version for OpenMP targets
Summary:
This flag "--fopenmp-ptx=" enables the overwriting of the default PTX version used for GPU offloaded OpenMP target regions: "+ptx42".
Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar
Reviewed By: ABataev
Subscribers: rengolin, cfe-commits
Differential Revision: https://reviews.llvm.org/D29660
llvm-svn: 310489
Vadim Macagon [Wed, 9 Aug 2017 15:49:15 +0000 (15:49 +0000)]
Fix PlatformPythonTestCase.test_platform_list for the build bots
llvm-svn: 310488
Marshall Clow [Wed, 9 Aug 2017 15:42:50 +0000 (15:42 +0000)]
Change the way the literal operators are defined - now w/o a seperating space. This should be a NFC, but it will change how the compiler parses it.
llvm-svn: 310487
Florian Hahn [Wed, 9 Aug 2017 15:39:10 +0000 (15:39 +0000)]
[ARM] Emit error when ARM exec mode is not available.
Summary:
A similar error message has been removed from the ARMTargetMachineBase
constructor in r306939. With this patch, we generate an error message
for the example below, compiled with -mcpu=cortex-m0, which does not
have ARM execution mode.
__attribute__((target("arm"))) int foo(int a, int b)
{
return a + b % a;
}
__attribute__((target("thumb"))) int bar(int a, int b)
{
return a + b % a;
}
By adding this error message to ARMBaseTargetMachine::getSubtargetImpl,
we can deal with functions that set -thumb-mode in target-features.
At the moment it seems like Clang does not have access to target-feature
specific information, so adding the error message to the frontend will
be harder.
Reviewers: echristo, richard.barton.arm, t.p.northover, rengolin, efriedma
Reviewed By: echristo, efriedma
Subscribers: efriedma, aemerson, javed.absar, kristof.beyls
Differential Revision: https://reviews.llvm.org/D35627
llvm-svn: 310486
Coby Tayree [Wed, 9 Aug 2017 15:34:55 +0000 (15:34 +0000)]
[X86][Asm]Allow far jmp/call to be picked when using explicit FWORD size specifier
Currently, far jmp/call which utilizes a 48bit memory operand would have been invoked via the 'lcall/ljmp' mnemonic (intel style).
This patch align those variants to formal intel spec
Differential Revision: https://reviews.llvm.org/D35846
llvm-svn: 310485
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 15:27:39 +0000 (15:27 +0000)]
[OpenMP] Add flag for disabling the default generation of relocatable OpenMP target code for NVIDIA GPUs.
Summary: Previously we have added the "-c" flag which gets passed to PTXAS by default to generate relocatable OpenMP target code by default. This set of flags exposes control over this behaviour.
Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar
Reviewed By: ABataev
Subscribers: Hahnfeld, rengolin, cfe-commits
Differential Revision: https://reviews.llvm.org/D29659
llvm-svn: 310484
Erich Keane [Wed, 9 Aug 2017 15:27:36 +0000 (15:27 +0000)]
Fix broken getAttributeSpellingListIndex for pragma attributes
We noticed when implementing a new pragma that the TableGen-generated function
getAttributeSpellingListIndex() did not work for pragma attributes. It relies
on the values in the enum AttributeList::Syntax and a new value
AS_ContextSensitiveKeyword was added changing the value for AS_Pragma.
Apparently no tests failed since no pragmas currently make use of the
generated function.
To fix this we can move AS_Pragma back to the value that TableGen code expects.
Also to prevent changes in the enum from breaking that routine again I added
calls to getAttributeSpellingListIndex() in the unroll pragma code. That will
cause some lit test failures if the order is changed. I added a comment to
remind of this issue in the future.
This assumes we don’t need/want full TableGen support for
AS_ContextSensitiveKeyword. It currently only appears in getAttrKind and no
other TableGen-generated routines.
Patch by: mikerice
Differential Revision: https://reviews.llvm.org/D36473
llvm-svn: 310483
Martin Probst [Wed, 9 Aug 2017 15:19:16 +0000 (15:19 +0000)]
clang-format: [JS] detect ASI after closing parens.
Summary: A closing parenthesis followed by a declaration or statement should always terminate the current statement.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D36491
llvm-svn: 310482
Davide Italiano [Wed, 9 Aug 2017 15:13:50 +0000 (15:13 +0000)]
[ValueTracking] Honour recursion limit.
The recently improved support for `icmp` in ValueTracking
(r307304) exposes the fact that `isImplied` condition doesn't
really bail out if we hit the recursion limit (and calls
`computeKnownBits` which increases the depth and asserts).
Differential Revision: https://reviews.llvm.org/D36512
llvm-svn: 310481
Sjoerd Meijer [Wed, 9 Aug 2017 14:59:54 +0000 (14:59 +0000)]
[AArch64] Assembler support for the ARMv8.2a dot product instructions
Dot product is an optional ARMv8.2a extension, see also the public architecture
specification here:
https://developer.arm.com/products/architecture/a-profile/exploration-tools.
This patch adds AArch64 assembler support for these dot product instructions.
Differential Revision: https://reviews.llvm.org/D36515
llvm-svn: 310480
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 14:59:35 +0000 (14:59 +0000)]
[OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default
Original Diff: D29642
This patch was previously reverted due to an error with patch D29654
that this depends on.
llvm-svn: 310479
Tim Northover [Wed, 9 Aug 2017 14:56:48 +0000 (14:56 +0000)]
Reapply Sema: allow imaginary constants via GNU extension if UDL overloads not present.
C++14 added user-defined literal support for complex numbers so that you
can write something like "complex<double> val = 2i". However, there is
an existing GNU extension supporting this syntax and interpreting the
result as a _Complex type.
This changes parsing so that such literals are interpreted in terms of
C++14's operators if an overload is present but otherwise falls back to
the original GNU extension.
(We now have more robust diagnostics for implicit conversions so the
libc++ test that caused the original revert still passes).
llvm-svn: 310478
Joey Gouly [Wed, 9 Aug 2017 14:52:47 +0000 (14:52 +0000)]
[OpenCL] Minor refactoring to reduce copy/pasted code
Set the type of TheCall inside SemaBuiltinReserveRWPipe to reduce
duplicated code.
llvm-svn: 310477
Florian Hahn [Wed, 9 Aug 2017 13:53:28 +0000 (13:53 +0000)]
[ARM] Remove FeatureNoARM implies ModeThumb.
Summary:
By removing FeatureNoARM implies ModeThumb, we can detect cases where a
function's target-features contain -thumb-mode (enables ARM codegen for the
function), but the architecture does not support ARM mode. Previously, the
implication caused the FeatureNoARM bit to be cleared for functions with
-thumb-mode, making the assertion in ARMSubtarget::ARMSubtarget [1]
pointless for such functions.
This assertion is the only guard against generating ARM code for
architectures without ARM codegen support. Is there a place where we
could easily generate error messages for the user? At the moment, we
would generate ARM code for Thumb-only architectures. X86 has the same
behavior as ARM, as in it only has an assertion and no error message,
but I think for ARM an error message would be helpful. What do you
think?
For the example below, `llc -mtriple=armv7m-eabi test.ll -o -` will
generate ARM assembler (or fail with an assertion error with this patch).
Note that if we run the resulting assembler through llvm-mc, we get
an appropriate error message, but not when codegen is handled
through clang.
```
define void @bar() #0 {
entry:
ret void
}
attributes #0 = { "target-features"="-thumb-mode" }
```
[1] https://github.com/llvm-mirror/llvm/blob/
c1f7b54cef62e9c8aa745d40bea146a167bf844e/lib/Target/ARM/ARMSubtarget.cpp#L147
Reviewers: t.p.northover, rengolin, peter.smith, aadg, silviu.baranga, richard.barton.arm, echristo
Reviewed By: rengolin, echristo
Subscribers: efriedma, aemerson, javed.absar, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35569
llvm-svn: 310476
Benoit Belley [Wed, 9 Aug 2017 13:47:01 +0000 (13:47 +0000)]
[Support] PR33388 - Fix formatv_object move constructor
formatv_object currently uses the implicitly defined move constructor,
but it is buggy. In typical use-cases, the problem doesn't show-up
because all calls to the move constructor are elided. Thus, the buggy
constructors are never invoked.
The issue especially shows-up when code is compiled using the
-fno-elide-constructors compiler flag. For instance, this is useful when
attempting to collect accurate code coverage statistics.
The exact issue is the following:
The Parameters data member is correctly moved, thus making the
parameters occupy a new memory location in the target
object. Unfortunately, the default copying of the Adapters blindly
copies the vector of pointers, leaving each of these pointers
referencing the parameters in the original object instead of the copied
one. These pointers quickly become dangling when the original object is
deleted. This quickly leads to crashes.
The solution is to update the Adapters pointers when performing a move.
The copy constructor isn't useful for format objects and can thus be
deleted.
This resolves PR33388.
Differential Revision: https://reviews.llvm.org/D34463
llvm-svn: 310475
Nirav Dave [Wed, 9 Aug 2017 13:37:07 +0000 (13:37 +0000)]
[DAG] Explicitly cleanup merged load values during store merge. NFCI.
llvm-svn: 310474
Siddharth Bhat [Wed, 9 Aug 2017 13:34:54 +0000 (13:34 +0000)]
[ManagedMemoryRewrite] Remove test case that was submitted by mistake. [NFC]
llvm-svn: 310473
Coby Tayree [Wed, 9 Aug 2017 13:31:41 +0000 (13:31 +0000)]
[X86][Ms-InlineAsm] Extend MS Dot operator to accept "this" + struct/class pointers aliases
MS InlineAsm Dot operator accepts "Bases" such as "this" (cpp) and class/struct pointer typedef.
This patch enhance its implementation with this behavior.
Differential Revision: https://reviews.llvm.org/D36450
llvm-svn: 310472
Siddharth Bhat [Wed, 9 Aug 2017 12:59:23 +0000 (12:59 +0000)]
[ManagedMemoryRewrite] Introduce a new pass to rewrite modules to use managed memory.
This pass is useful to automatically convert a codebase that uses malloc/free
to use their managed memory counterparts.
Currently, rewrite malloc and free to the `polly_{malloc,free}Managed` variants.
A future patch will teach ManagedMemoryRewrite to rewrite global arrays
as pointers to globally allocated managed memory.
Differential Revision: https://reviews.llvm.org/D36513
llvm-svn: 310471
Ilya Biryukov [Wed, 9 Aug 2017 12:55:13 +0000 (12:55 +0000)]
[clangd] Fixed a bug in make_tagged.
It accidentally std::move'd from Value parameter if it deduced to an
l-value ref.
llvm-svn: 310470
Haojian Wu [Wed, 9 Aug 2017 12:49:20 +0000 (12:49 +0000)]
Fix -Wpessimizing-move warning.
llvm-svn: 310469
Gabor Horvath [Wed, 9 Aug 2017 12:34:58 +0000 (12:34 +0000)]
[Sema] -Wenum-compare no longer warn on anonymous enums in switch statements
Patch by: Reka Nikolett Kovacs
llvm-svn: 310468
Coby Tayree [Wed, 9 Aug 2017 12:32:05 +0000 (12:32 +0000)]
[AsmParser][AVX512]Enhance OpMask/Zero/Merge syntax check rubostness
Adopt a more strict approach regarding what marks should/can appear after a destination register, when operating upon an AVX512 platform.
Differential Revision: https://reviews.llvm.org/D35785
llvm-svn: 310467
Michael Kruse [Wed, 9 Aug 2017 12:27:51 +0000 (12:27 +0000)]
[CodeGen] Use isLatestArrayKind().
Codegen with -polly-parallel queried the unmapped MemoryAccess, but only
the MemoryKind after mapping is relevant for codegen.
This should fix various fails of the
perf-x86_64-penryn-O3-polly-parallel-fast buildbot.
llvm-svn: 310466
Michael Kruse [Wed, 9 Aug 2017 12:27:35 +0000 (12:27 +0000)]
[ForwardOpTree] Set DEBUG_TYPE to "polly-optree".
The previous value of "polly-delicm" was forgotten to to be changed when
ForwardOpTree was split from DeLICM.
Thanks to Tobias for noticing!
llvm-svn: 310465
Diana Picus [Wed, 9 Aug 2017 12:22:25 +0000 (12:22 +0000)]
Revert "PR19668, PR23034: Fix handling of move constructors and deleted copy constructors when deciding whether classes should be passed indirectly."
This reverts commit r310401 because it seems to have broken some ARM
bot(s).
llvm-svn: 310464
Jonas Paulsson [Wed, 9 Aug 2017 11:28:01 +0000 (11:28 +0000)]
[LSR / TTI / SystemZ] Eliminate TargetTransformInfo::isFoldableMemAccess()
isLegalAddressingMode() has recently gained the extra optional Instruction*
parameter, and therefore it can now do the job that previously only
isFoldableMemAccess() could do.
The SystemZ implementation of isLegalAddressingMode() has gained the
functionality of checking for offsets, which used to be done with
isFoldableMemAccess().
The isFoldableMemAccess() hook has been removed everywhere.
Review: Quentin Colombet, Ulrich Weigand
https://reviews.llvm.org/D35933
llvm-svn: 310463
Jonas Paulsson [Wed, 9 Aug 2017 11:27:46 +0000 (11:27 +0000)]
[LoopStrengthReduce] Don't neglect the Fixup.Offset in isAMCompletelyFolded().
In the recursive call to isAMCompletelyFolded(), the passed offset should be
the sum of F.BaseOffset and Fixup.Offset.
Review: Quentin Colombet.
llvm-svn: 310462
Michael Kruse [Wed, 9 Aug 2017 11:21:40 +0000 (11:21 +0000)]
[ISLTools/ZoneAlgo] Make distributeDomain and filterKnownValInst isl_error_quota proof.
distributeDomain() and filterKnownValInst() are used in a scop
of ForwardOpTree that limits the number of isl operations.
Therefore some isl functions may return null after any operation.
Remove assertion that assume non-null results and handle
isl_*_foreach returning isl::stat::error.
I hope this fixes the crash of the asop buildbot at ihevc_recon.c.
llvm-svn: 310461
Simon Dardis [Wed, 9 Aug 2017 10:47:52 +0000 (10:47 +0000)]
[mips] PR34083 - Wimplicit-fallthrough warning in MipsAsmParser.cpp
Assert that a binary expression is actually a binary expression,
rather than potientially incorrectly attempting to handle it as a
unary expression.
This resolves PR34083.
Thanks to Simonn Pilgrim for reporting the issue!
llvm-svn: 310460
Gabor Horvath [Wed, 9 Aug 2017 10:38:53 +0000 (10:38 +0000)]
Suppress a warning. NFC.
llvm-svn: 310459
Krasimir Georgiev [Wed, 9 Aug 2017 09:42:32 +0000 (09:42 +0000)]
[clang-format] Put '/**' and '*/' on own lines in jsdocs ending in comment pragmas
Summary:
This handles a case where the trailing '*/' of a multiline jsdoc eding in a
comment pragma wouldn't be put on a new line.
Reviewers: mprobst
Reviewed By: mprobst
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D36359
llvm-svn: 310458
Oliver Stannard [Wed, 9 Aug 2017 09:40:51 +0000 (09:40 +0000)]
[AsmParser] Hash is not a comment on some targets
The '#' token is not a comment for all targets (on ARM and AArch64 it marks an
immediate operand), so we shouldn't treat it as such.
Comments are already converted to AsmToken::EndOfStatement by
AsmLexer::LexLineComment, so this check was unnecessary.
Differential Revision: https://reviews.llvm.org/D36405
llvm-svn: 310457
Chandler Carruth [Wed, 9 Aug 2017 09:37:39 +0000 (09:37 +0000)]
[LCG] Completely remove the map-based association of post-order numbers
to Nodes when removing ref edges from a RefSCC.
This map based association turns out to be pretty expensive for large
RefSCCs and pointless as we already have embedded data members inside
nodes that we use to track the DFS state. We can reuse one of those and
the map becomes unnecessary.
This also fuses the update of those numbers into the scan across the
pending stack of nodes so that we don't walk the nodes twice during the
DFS.
With this I expect the new PM to be faster than the old PM for the test
case I have been optimizing. That said, it also seems simpler and more
direct in many ways. The side storage was always pretty awkward.
The last remaining hot-spot in the profile of the LCG once this is done
will be the edge iterator walk in the DFS. I'll take a look at improving
that next.
llvm-svn: 310456
Michael Kruse [Wed, 9 Aug 2017 09:29:15 +0000 (09:29 +0000)]
[ZoneAlgo] Add motivation for exception. NFC.
Suggested-by: Hongbin Zheng <etherzhhb@gmail.com>
llvm-svn: 310455
Michael Kruse [Wed, 9 Aug 2017 09:29:09 +0000 (09:29 +0000)]
[ZoneAlgo] Consolditate condition. NFC.
No need to create an OptimizationRemarkMissed object if we are not going
to use it anyway.
llvm-svn: 310454
Davide Italiano [Wed, 9 Aug 2017 09:23:29 +0000 (09:23 +0000)]
[GlobalOpt] Switch an explicit loop to llvm::all_of(). NFCI.
llvm-svn: 310453
Vadim Macagon [Wed, 9 Aug 2017 09:20:40 +0000 (09:20 +0000)]
Expose active and available platform lists via SBDebugger API
Summary:
The available platform list was previously only accessible via the
`platform list` command, this patch makes it possible to access that
list via the SBDebugger API. The active platform list has likewise
been exposed via the SBDebugger API.
Differential Revision: https://reviews.llvm.org/D35760
llvm-svn: 310452
Chandler Carruth [Wed, 9 Aug 2017 09:14:34 +0000 (09:14 +0000)]
[LCG] Special case when removing a ref edge from a RefSCC leaves
that RefSCC still connected.
This is common and can be handled much more efficiently. As soon as we
know we've covered every node in the RefSCC with the DFS, we can simply
reset our state and return. This avoids numerous data structure updates
and other complexity.
On top of other changes, this appears to get new PM back to parity with
the old PM for a large protocol buffer message source code. The dense
map updates are very hot in this function.
llvm-svn: 310451
Chandler Carruth [Wed, 9 Aug 2017 09:05:27 +0000 (09:05 +0000)]
[LCG] Switch one of the update methods for the LazyCallGraph to support
limited batch updates.
Specifically, allow removing multiple reference edges starting from
a common source node. There are a few constraints that play into
supporting this form of batching:
1) The way updates occur during the CGSCC walk, about the most we can
functionally batch together are those with a common source node. This
also makes the batching simpler to implement, so it seems
a worthwhile restriction.
2) The far and away hottest function for large C++ files I measured
(generated code for protocol buffers) showed a huge amount of time
was spent removing ref edges specifically, so it seems worth focusing
there.
3) The algorithm for removing ref edges is very amenable to this
restricted batching. There are just both API and implementation
special casing for the non-batch case that gets in the way. Once
removed, supporting batches is nearly trivial.
This does modify the API in an interesting way -- now, we only preserve
the target RefSCC when the RefSCC structure is unchanged. In the face of
any splits, we create brand new RefSCC objects. However, all of the
users were OK with it that I could find. Only the unittest needed
interesting updates here.
How much does batching these updates help? I instrumented the compiler
when run over a very large generated source file for a protocol buffer
and found that the majority of updates are intrinsically updating one
function at a time. However, nearly 40% of the total ref edges removed
are removed as part of a batch of removals greater than one, so these
are the cases batching can help with.
When compiling the IR for this file with 'opt' and 'O3', this patch
reduces the total time by 8-9%.
Differential Revision: https://reviews.llvm.org/D36352
llvm-svn: 310450
Gabor Horvath [Wed, 9 Aug 2017 08:57:09 +0000 (08:57 +0000)]
[Sema] Extend -Wenum-compare to handle mixed enum comparisons in switch statements
Patch by: Reka Nikolett Kovacs
Differential Revision: https://reviews.llvm.org/D36407
llvm-svn: 310449
Siddharth Bhat [Wed, 9 Aug 2017 08:29:16 +0000 (08:29 +0000)]
[PPCGCodeGeneration] Compute element size in bytes for arrays correctly.
Previously, we used to compute this with `elementSizeInBits / 8`. This
would yield an element size of 0 when the array had element size < 8 in
bits.
To fix this, ask data layout what the size in bytes should be.
Differential Revision: https://reviews.llvm.org/D36459
llvm-svn: 310448
Craig Topper [Wed, 9 Aug 2017 06:17:49 +0000 (06:17 +0000)]
[X86] Add the rest of the ADC and SBB instructions to isDefConvertible.
I don't know if this really affects anything. Just thought it was weird that we had all of the ADD/SUB/AND/OR/XOR instructions.
llvm-svn: 310447
Craig Topper [Wed, 9 Aug 2017 06:17:48 +0000 (06:17 +0000)]
[InstCombine] Use regular dyn_cast instead of a matcher for a simple case. NFC
llvm-svn: 310446
George Burgess IV [Wed, 9 Aug 2017 06:07:08 +0000 (06:07 +0000)]
Attempt #2 to appease buildbots
"error: unable to create target: 'No available targets are compatible
with this triple.'"
llvm-svn: 310445
George Burgess IV [Wed, 9 Aug 2017 05:20:05 +0000 (05:20 +0000)]
Attempt to appease msc buildbot
It was timing out on this test, but for reasons unrelated to the
specific bug it was testing for. Randomly breaking in gdb with `clang
-target i686-windows -fmsc-version=1700` reveals *many* frames from
MicrosoftCXXNameMangler. So, it would seem that some caching is needed
there, as well...
Fingers crossed that specifying a triple is sufficient to work around
this.
llvm-svn: 310444
Serguei Katkov [Wed, 9 Aug 2017 05:17:02 +0000 (05:17 +0000)]
[ImplicitNullCheck] Fix the bug when dependent instruction accesses memory
It is possible that dependent instruction may access memory.
In this case we must reject optimization because the memory change will
be visible in null handler basic block. So we will execute an instruction which
we must not execute if check fails.
Reviewers: sanjoy, reames
Reviewed By: sanjoy
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36392
llvm-svn: 310443
Zachary Turner [Wed, 9 Aug 2017 04:48:16 +0000 (04:48 +0000)]
Fix broken pdb test.
For some reason I didn't see this failure the first time. The
output format changed slightly, so we just have to update the
test for the new format.
llvm-svn: 310442
Vitaly Buka [Wed, 9 Aug 2017 04:45:00 +0000 (04:45 +0000)]
[clang-fuzzer] Resolve proto dependencies
llvm-svn: 310441
Zachary Turner [Wed, 9 Aug 2017 04:34:11 +0000 (04:34 +0000)]
Fix -Wreorder-fields warning.
llvm-svn: 310440
Zachary Turner [Wed, 9 Aug 2017 04:23:59 +0000 (04:23 +0000)]
[PDB] Fix an issue writing the publics stream.
In the refactor to merge the publics and globals stream, a bug
was introduced that wrote the wrong value for one of the fields
of the PublicsStreamHeader. This caused debugging in WinDbg
to break.
We had no way of dumping any of these fields, so in addition to
fixing the bug I've added dumping support for them along with a
test that verifies the correct value is written.
llvm-svn: 310439
Zachary Turner [Wed, 9 Aug 2017 04:23:25 +0000 (04:23 +0000)]
[PDB] Merge Global and Publics Builders.
The publics stream and globals stream are very similar. They both
contain a list of hash buckets that refer into a single shared stream,
the symbol record stream. Because of the need for each builder to manage
both an independent hash stream as well as a single shared record
stream, making the two builders be independent entities is not the right
design. This patch merges them into a single class, of which only a
single instance is needed to create all 3 streams. PublicsStreamBuilder
and GlobalsStreamBuilder are now merged into the single GSIStreamBuilder
class, which writes all 3 streams at once.
Note that this patch does not contain any functionality change. So we're
still not yet writing any records to the globals stream. All we're doing
is making it so that when we do start writing records to the globals,
this refactor won't have to be part of that patch.
Differential Revision: https://reviews.llvm.org/D36489
llvm-svn: 310438
George Burgess IV [Wed, 9 Aug 2017 04:12:17 +0000 (04:12 +0000)]
[AST] Cache intermediate visibility/linkage results
This is a follow-up to r310436 with actual functional changes. Please
see that commit message for a description of why a cache is appearing
here.
Suggestions for less-bad ways of testing this are appreciated. :)
This fixes PR29160.
llvm-svn: 310437
George Burgess IV [Wed, 9 Aug 2017 04:02:49 +0000 (04:02 +0000)]
[AST] Move visibility computations into a class; NFC
This is patch 1 in a 2 patch series that aims to fix PR29160. Its goal
is to cache decl visibility/linkage for the duration of each
visibility+linkage query.
The simplest way I can see to do this is to put the visibility
calculation code that needs to (transitively) access this cache into a
class, which is what this patch does. Actual caching will come in patch
2. (Another way would be to keep the cache in ASTContext + manually
invalidate it or something, but that felt way too subtle to me.)
Caching visibility results across multiple queries seems a bit tricky,
since the user can add visibility attributes ~whenever they want, and
these attributes can apparently have far-reaching effects (e.g. class
visibility extends to its members, ...). Because a cache that's dropped
at the end of each top-level query seems to work nearly as well and
doesn't require any eviction logic, I opted for that design.
llvm-svn: 310436
Richard Trieu [Wed, 9 Aug 2017 02:03:59 +0000 (02:03 +0000)]
Allow operator delete to be an invalid Decl.
Do not discard invalid Decl when searching for the operator delete function.
The lookup for this function always expects to find a result, so sometimes the
invalid Decl is the only choice possible. This fixes PR34109.
llvm-svn: 310435
Craig Topper [Wed, 9 Aug 2017 01:30:22 +0000 (01:30 +0000)]
[InstCombine] Add a test case for a missed opportunity to turn a select into logic ops.
llvm-svn: 310434
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 01:02:19 +0000 (01:02 +0000)]
[OpenMP] Fix bug regarding cubin integration into host binary
when a BindArchAction is used.
This is not a functional change.
Original Diff: D29654
llvm-svn: 310433
Vitaly Buka [Wed, 9 Aug 2017 00:38:57 +0000 (00:38 +0000)]
[asan] Refactor thread creation bookkeeping
Summary:
This is a pure refactoring change. It paves the way for OS-specific
implementations, such as Fuchsia's, that can do most of the
per-thread bookkeeping work in the creator thread before the new
thread actually starts. This model is simpler and cleaner, avoiding
some race issues that the interceptor code for thread creation has
to do for the existing OS-specific implementations.
Submitted on behalf of Roland McGrath.
Reviewers: vitalybuka, alekseyshl, kcc
Reviewed By: alekseyshl
Subscribers: phosek, filcab, llvm-commits, kubamracek
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D36385
llvm-svn: 310432
Vitaly Buka [Wed, 9 Aug 2017 00:21:45 +0000 (00:21 +0000)]
[asan] Complete the Fuchsia port
Submitted on behalf of Roland McGrath.
Reviewers: kcc, eugenis, alekseyshl, vitalybuka
Reviewed By: vitalybuka
Subscribers: filcab, vitalybuka, srhines, kubamracek, mgorny, phosek, llvm-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D35865
llvm-svn: 310431
Eugene Zelenko [Wed, 9 Aug 2017 00:06:29 +0000 (00:06 +0000)]
[AMDGPU] Revert r310429 changes in AMDKernelCodeT.h which broke some build bots.
llvm-svn: 310430
Eugene Zelenko [Tue, 8 Aug 2017 23:53:55 +0000 (23:53 +0000)]
[AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 310429
Kamil Rytarowski [Tue, 8 Aug 2017 23:31:21 +0000 (23:31 +0000)]
Try to appease compiler and break multiline comment.
llvm-svn: 310428
Tim Northover [Tue, 8 Aug 2017 23:18:05 +0000 (23:18 +0000)]
Sema: disable implicit conversion from _Complex to real types in C++.
Converting a _Complex type to a real one simply discards the imaginary part.
This can easily lead to loss of information so for safety (and GCC
compatibility) this patch disallows that when the conversion would be implicit.
The one exception is bool, which actually compares both real and imaginary
parts and so is safe.
llvm-svn: 310427
Tim Northover [Tue, 8 Aug 2017 23:17:51 +0000 (23:17 +0000)]
Revert "Lexer: always allow imaginary constants in GNU mode."
This reverts r310423. It was committed by mistake, I intended to commit the
improved diagnostics for implicit conversions instead.
llvm-svn: 310426
Quentin Colombet [Tue, 8 Aug 2017 22:22:30 +0000 (22:22 +0000)]
Revert "[GlobalISel] Remove the GISelAccessor API."
This reverts commit r310115.
It causes a linker failure for the one of the unittests of AArch64 on one
of the linux bot:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/3429
: && /home/fedora/gcc/install/gcc-7.1.0/bin/g++ -fPIC
-fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wno-missing-field-initializers -pedantic -Wno-long-long
-Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment
-ffunction-sections -fdata-sections -O2
-L/home/fedora/gcc/install/gcc-7.1.0/lib64 -Wl,-allow-shlib-undefined
-Wl,-O3 -Wl,--gc-sections
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o -o
unittests/Target/AArch64/AArch64Tests
lib/libLLVMAArch64CodeGen.so.6.0.0svn lib/libLLVMAArch64Desc.so.6.0.0svn
lib/libLLVMAArch64Info.so.6.0.0svn lib/libLLVMCodeGen.so.6.0.0svn
lib/libLLVMCore.so.6.0.0svn lib/libLLVMMC.so.6.0.0svn
lib/libLLVMMIRParser.so.6.0.0svn lib/libLLVMSelectionDAG.so.6.0.0svn
lib/libLLVMTarget.so.6.0.0svn lib/libLLVMSupport.so.6.0.0svn -lpthread
lib/libgtest_main.so.6.0.0svn lib/libgtest.so.6.0.0svn -lpthread
-Wl,-rpath,/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib
&& :
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o:(.toc+0x0):
undefined reference to `vtable for llvm::LegalizerInfo'
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o:(.toc+0x8):
undefined reference to `vtable for llvm::RegisterBankInfo'
The particularity of this bot is that it is built with
BUILD_SHARED_LIBS=ON
However, I was not able to reproduce the problem so far.
Reverting to unblock the bot.
llvm-svn: 310425
Nemanja Ivanovic [Tue, 8 Aug 2017 22:17:31 +0000 (22:17 +0000)]
My commit r310346 introduced some valid warnings. This cleans them up.
llvm-svn: 310424
Tim Northover [Tue, 8 Aug 2017 22:03:54 +0000 (22:03 +0000)]
Lexer: always allow imaginary constants in GNU mode.
llvm-svn: 310423
Jessica Paquette [Tue, 8 Aug 2017 21:51:26 +0000 (21:51 +0000)]
[MachineOutliner] Ensure AArch64 outliner doesn't mess with W30 or LR
Before, the outliner would mark all instructions that read from/modify LR as
illegal. This doesn't handle W30, which overlaps with LR. This shouldn't be
outlined.
This commit fixes that by making modifiesRegister() and readsRegister() look at
W30 + take in a TRI argument. This makes sure that modifiesRegister() and
readsRegister() won't outline either of W30 and LR.
https://reviews.llvm.org/D36435
llvm-svn: 310422
Wei Mi [Tue, 8 Aug 2017 21:40:14 +0000 (21:40 +0000)]
[GVN] Remove stale entries in phitranslate cache when new phi is generated for PRE
When a new phi is generated for scalarpre of an expression, the phiTranslate cache
will become stale: Before PRE, the candidate expression must not be available in a
predecessor block, and phitranslate will cache the information. After PRE, the
expression will become available in all predecessor blocks, so the related entries
in phiTranslate cache becomes stale. The patch will simply remove the stale entries
so phiTranslate can be recomputed next time.
The stale entries in phitranslate cache will not affect correctness but will cause
missing PRE opportunity for later instructions.
Differential Revision: https://reviews.llvm.org/D36124
llvm-svn: 310421
Nuno Lopes [Tue, 8 Aug 2017 21:25:26 +0000 (21:25 +0000)]
BasicAA: assert on another case where aliasGEP shouldn't get a PartialAlias response
llvm-svn: 310420
Reid Kleckner [Tue, 8 Aug 2017 21:18:36 +0000 (21:18 +0000)]
[winasan] Fix hotpatching ntdll!strcpy for Win10 creators edition
The 9 byte nop is a suffix of the 10 byte nop, and we need at most 6
bytes.
ntdll's version of strcpy is written in assembly and is very clever.
strcat tail calls strcpy but with a slightly different arrangement of
argument registers at an alternate entry point. It looks like this:
ntdll!strcpy:
00007ffd`
64e8a7a0 4c8bd9 mov r11,rcx
ntdll!__entry_from_strcat_in_strcpy:
00007ffd`
64e8a7a3 482bca sub rcx,rdx
00007ffd`
64e8a7a6 f6c207 test dl,7
If we overwrite more than two bytes in our interceptor, that label will
no longer be a valid instruction boundary.
By recognizing the 9 byte nop, we use the two byte backwards branch to
start our trampoline, avoiding this issue.
Fixes https://github.com/google/sanitizers/issues/829
Patch by David Major
llvm-svn: 310419
Simon Atanasyan [Tue, 8 Aug 2017 21:17:33 +0000 (21:17 +0000)]
[mips] Enable `long_call/short_call` attributes on MIPS64
This change enables `long_call/short_call/far/near` attributes on
MIPS64 targets.
Differential revision: https://reviews.llvm.org/D36208
llvm-svn: 310418
Tim Hammerquist [Tue, 8 Aug 2017 20:59:20 +0000 (20:59 +0000)]
Add existing unit tests to Xcode project
Summary:
This adds gtest test files to the Xcode project which were
previously only in the cmake config. This is the first of several
planned merges.
Reviewers: beanz, spyffe, jingham
Reviewed By: jingham
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D36485
llvm-svn: 310417
Dehao Chen [Tue, 8 Aug 2017 20:57:33 +0000 (20:57 +0000)]
Make ICP uses PSI to check for hotness.
Summary: Currently, ICP checks the count against a fixed value to see if it is hot enough to be promoted. This does not work for SamplePGO because sampled count may be much smaller. This patch uses PSI to check if the count is hot enough to be promoted.
Reviewers: davidxl, tejohnson, eraman
Reviewed By: davidxl
Subscribers: sanjoy, llvm-commits, mehdi_amini
Differential Revision: https://reviews.llvm.org/D36341
llvm-svn: 310416
Erik Pilkington [Tue, 8 Aug 2017 20:57:10 +0000 (20:57 +0000)]
[demangler] Rename some variables, NFC
llvm-svn: 310415
Kamil Rytarowski [Tue, 8 Aug 2017 20:52:54 +0000 (20:52 +0000)]
Add NetBSD support in asan_malloc_linux.cc
Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, kcc, fjricci, vitalybuka, filcab
Reviewed By: fjricci
Subscribers: llvm-commits, kubamracek, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D36376
llvm-svn: 310414
Kamil Rytarowski [Tue, 8 Aug 2017 20:50:07 +0000 (20:50 +0000)]
Add NetBSD support in asan_symbolize.py
Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, filcab, vitalybuka, kcc, fjricci
Reviewed By: fjricci
Subscribers: kubamracek, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D36484
llvm-svn: 310413
Kamil Rytarowski [Tue, 8 Aug 2017 20:49:20 +0000 (20:49 +0000)]
Enable ubsan on NetBSD
Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, vitalybuka, kcc, filcab, fjricci
Reviewed By: fjricci
Subscribers: srhines, kubamracek, mgorny, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D36483
llvm-svn: 310412
Kamil Rytarowski [Tue, 8 Aug 2017 20:36:10 +0000 (20:36 +0000)]
Reuse sanitizer_linux for NetBSD
Summary:
Follow FreeBSD and reuse sanitizer_linux for NetBSD.
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, kcc, filcab, vitalybuka, fjricci, dvyukov
Reviewed By: fjricci
Subscribers: dvyukov, emaste, kubamracek, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D36325
llvm-svn: 310411
Reid Kleckner [Tue, 8 Aug 2017 20:30:14 +0000 (20:30 +0000)]
[codeview] Emit nested enums and typedefs from classes
Previously we limited ourselves to only emitting nested classes, but we
need other kinds of types as well.
This fixes the Visual Studio STL visualizers, so that users can
visualize std::string and other objects.
llvm-svn: 310410
Kostya Serebryany [Tue, 8 Aug 2017 20:20:40 +0000 (20:20 +0000)]
[sanitizer-coverage] -fsanitize-coverage=bb,inline-8bit-counters
llvm-svn: 310409
Matt Morehouse [Tue, 8 Aug 2017 20:15:04 +0000 (20:15 +0000)]
Integrate Kostya's clang-proto-fuzzer with LLVM.
Summary:
The clang-proto-fuzzer models a subset of C++ as a protobuf and
uses libprotobuf-mutator to generate interesting mutations of C++
programs. Clang-proto-fuzzer has already found several bugs in
Clang (e.g., https://bugs.llvm.org/show_bug.cgi?id=33747,
https://bugs.llvm.org/show_bug.cgi?id=33749).
As with clang-fuzzer, clang-proto-fuzzer requires the following
cmake flags:
- CMAKE_C_COMPILER=clang
- CMAKE_CXX_COMPILER=clang++
- LLVM_USE_SANITIZE_COVERAGE=YES // needed for libFuzzer
- LLVM_USE_SANITIZER=Address // needed for libFuzzer
In addition, clang-proto-fuzzer requires:
- CLANG_ENABLE_PROTO_FUZZER=ON
clang-proto-fuzzer also requires the following dependencies:
- binutils // needed for libprotobuf-mutator
- liblzma-dev // needed for libprotobuf-mutator
- libz-dev // needed for libprotobuf-mutator
- docbook2x // needed for libprotobuf-mutator
- Recent version of protobuf [3.3.0 is known to work]
A working version of libprotobuf-mutator will automatically be
downloaded and built as an external project.
Implementation of clang-proto-fuzzer provided by Kostya
Serebryany.
https://bugs.llvm.org/show_bug.cgi?id=33829
Reviewers: kcc, vitalybuka, bogner
Reviewed By: kcc, vitalybuka
Subscribers: thakis, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D36324
llvm-svn: 310408
Craig Topper [Tue, 8 Aug 2017 20:14:11 +0000 (20:14 +0000)]
[InstCombine] Support pulling left shifts through a subtract with constant LHS
We already support pulling through an add with constant RHS. We can do the same for subtract.
Differential Revision: https://reviews.llvm.org/D36443
llvm-svn: 310407
Eli Friedman [Tue, 8 Aug 2017 20:10:14 +0000 (20:10 +0000)]
[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).
The original version of this patch was reverted in r309995 due to a
crash. This version includes a fix for that crash (testcase in
test/CoverageMapping/md.cpp).
Differential Revision: https://reviews.llvm.org/D36250
llvm-svn: 310406
Nirav Dave [Tue, 8 Aug 2017 20:01:18 +0000 (20:01 +0000)]
[DAG] Introduce peekThroughBitcast function. NFCI.
llvm-svn: 310405
Nirav Dave [Tue, 8 Aug 2017 19:52:19 +0000 (19:52 +0000)]
[DAG] Update comments. NFC.
llvm-svn: 310404
Josh Gao [Tue, 8 Aug 2017 19:44:35 +0000 (19:44 +0000)]
Thread Safety Analysis: warn on nonsensical attributes.
Add warnings in cases where an implicit `this` argument is expected to
attributes because either `this` doesn't exist because the attribute is
on a free function, or because `this` is on a type that doesn't have a
corresponding capability/lockable/scoped_lockable attribute.
Reviewers: delesley, aaron.ballman
Differential Revision: https://reviews.llvm.org/D36237
llvm-svn: 310403
Josh Gao [Tue, 8 Aug 2017 19:44:34 +0000 (19:44 +0000)]
Reland "Thread Safety Analysis: fix assert_capability."
Delete the test that was broken by rL309725, and add it back in a
follow up commit. Also, improve the tests a bit.
Reviewers: delesley, aaron.ballman
Differential Revision: https://reviews.llvm.org/D36237
llvm-svn: 310402
Richard Smith [Tue, 8 Aug 2017 19:12:28 +0000 (19:12 +0000)]
PR19668, PR23034: Fix handling of move constructors and deleted copy
constructors when deciding whether classes should be passed indirectly.
This fixes ABI differences between Clang and GCC:
* Previously, Clang ignored the move constructor when making this
determination. It now takes the move constructor into account, per
https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may
seem recent, but the ABI change was agreed on the Itanium C++ ABI
list a long time ago).
* Previously, Clang's behavior when the copy constructor was deleted
was unstable -- depending on whether the lazy declaration of the
copy constructor had been triggered, you might get different behavior.
We now eagerly declare the copy constructor whenever its deletedness
is unclear, and ignore deleted copy/move constructors when looking for
a trivial such constructor.
This also fixes an ABI difference between Clang and MSVC:
* If the copy constructor would be implicitly deleted (but has not been
lazily declared yet), for instance because the class has an rvalue
reference member, we would pass it directly. We now pass such a class
indirectly, matching MSVC.
llvm-svn: 310401