Justin Lebar [Wed, 30 Mar 2016 20:40:11 +0000 (20:40 +0000)]
[NVPTX] Make NVVMReflect a function pass.
Summary:
Currently it's a module pass. Make it a function pass so that we can
move it to PassManagerBuilder's EP_EarlyAsPossible extension point,
which only accepts function passes.
Reviewers: rnk
Subscribers: tra, llvm-commits, jholewinski
Differential Revision: http://reviews.llvm.org/D18615
llvm-svn: 264919
Justin Lebar [Wed, 30 Mar 2016 20:39:29 +0000 (20:39 +0000)]
[PassManager] Make PassManagerBuilder::addExtension take an std::function, rather than a function pointer.
Summary:
This gives callers flexibility to pass lambdas with captures, which lets
callers avoid the C-style void*-ptr closure style. (Currently, callers
in clang store state in the PassManagerBuilderBase arg.)
No functional change, and the new API is backwards-compatible.
Reviewers: chandlerc
Subscribers: joker.eph, cfe-commits
Differential Revision: http://reviews.llvm.org/D18613
llvm-svn: 264918
Pete Cooper [Wed, 30 Mar 2016 20:36:31 +0000 (20:36 +0000)]
Convert lld Pass::runOnFile to llvm::Error from std::error_code. NFC.
Pretty mechanical change here. Just replacing all the std::error_code() with
llvm::Error() and make_dynamic_error_code with make_error<GenericError>
llvm-svn: 264917
Justin Bogner [Wed, 30 Mar 2016 20:36:07 +0000 (20:36 +0000)]
test: Remove a test for a transform that hasn't existed in 5 years.
The TailDup transform was removed in r138841 in 2011, along with most
of the tests for it. This test, however, was missed. Probably because
it had already been XFAIL'd for 3 years at that point (since r52243!)
and continued to fail when the opt flag for -tailduplicate stopped
being valid.
llvm-svn: 264916
Rui Ueyama [Wed, 30 Mar 2016 20:25:26 +0000 (20:25 +0000)]
Attempt to fix test failure on Windows.
Windows seems to complain that the file cannot be removed because
it is still in use. We don't have to remove the file but instead
just overwrite it, so do that.
llvm-svn: 264915
Sean Callanan [Wed, 30 Mar 2016 20:17:41 +0000 (20:17 +0000)]
Fixed a problem where a dSYM wasn't properly found because it had the wrong name
<rdar://problem/
25447765>
llvm-svn: 264914
Vassil Vassilev [Wed, 30 Mar 2016 20:16:03 +0000 (20:16 +0000)]
[modules] Write out identifiers if the ID is local, too.
In some cases a slot for an identifier is requested but it gets written to
another module, causing an assertion.
At the point when we start serializing Rtypes, we have no imported IdentifierID
for float_round_style. We start serializing stuff and allocate an ID for it.
Then, during the serialization process, we pull in the identifier info for it
from TSchemaHelper. Finally, WriteIdentifierTable decides that the identifier
has not changed since it was deserialized, so doesn't emit it.
Fixes https://llvm.org/bugs/show_bug.cgi?id=27041
Discussed on IRC with Richard Smith. Agreed on post commit review if needed.
llvm-svn: 264913
Reid Kleckner [Wed, 30 Mar 2016 20:15:50 +0000 (20:15 +0000)]
Fix the detection of the shell feature and disable some tests when its not present
llvm-svn: 264912
Reid Kleckner [Wed, 30 Mar 2016 20:15:41 +0000 (20:15 +0000)]
Remove unused fwd decl for LLVM IR stuff that lives in LTO now
llvm-svn: 264911
Pete Cooper [Wed, 30 Mar 2016 20:15:06 +0000 (20:15 +0000)]
Change getReferenceInfo/getPairReferenceInfo to use new Error handling. NFC.
Adds a GenericError class to lld/Core which can carry a string. This is
analygous to the dynamic_error we currently use in lld/Core.
Use this GenericError instead of make_dynamic_error_code. Also, provide
an implemention of GenericError::convertToErrorCode which for now converts
it in to the dynamic_error_code we used to have. This will go away once
all the APIs are converted.
llvm-svn: 264910
Greg Clayton [Wed, 30 Mar 2016 20:14:35 +0000 (20:14 +0000)]
When support for DWO files was added, there were two ways to pass lldb::user_id_t out to the rest of LLDB:
1 - DWARF in .o files with debug map in executable: we would place the compile unit index in the upper 32 bits of the 64 bit value and the lower 32 bits would be the DIE offset
2 - DWO: we would place the compile unit offset in the upper 32 bits of the 64 bit value and the lower 32 bits would be the DIE offset
There was a mixing and matching of this and it wasn't done consistently.
Major changes include:
The DIERef constructor that takes a lldb::user_id_t now requires a SymbolFileDWARF:
DIERef(lldb::user_id_t uid, SymbolFileDWARF *dwarf)
It is needed so that it can be decoded correctly. If it is DWARF in .o files with debug map in executable, then we get the right compile unit from the SymbolFileDWARFDebugMap, otherwise, we use the compile unit offset and DIE offset for DWO or normal DWARF.
The function:
lldb::user_id_t DIERef::GetUID() const;
Now becomes
lldb::user_id_t DIERef::GetUID(SymbolFileDWARF *dwarf) const;
Again, we need the DWARF file to encode it correctly.
This removes the need for "lldb::user_id_t SymbolFileDWARF::MakeUserID() const" and for bool SymbolFileDWARF::UserIDMatches (lldb::user_id_t uid) const". There were also many places were doing things inneficiently like:
1 - encode a dw_offset_t into a lldb::user_id_t
2 - call the public SymbolFile interface to resolve types using the lldb::user_id_t
3 - This would then decode the lldb::user_id_t into a DIERef, and then try to find that type.
There are many places that are now doing this more efficiently by storing DW_AT_type form values as DWARFFormValue objects and then making a DIERef from them and directly calling the underlying function to resolve the lldb_private::Type, lldb_private::CompilerType, lldb_private::CompilerDecl, lldb_private::CompilerDeclContext.
If there are any regressions in DWARF with DWO, we will need to fix any issues that arise since the original patch wasn't functional for the much more widely used DWARF in .o files with debug map.
<rdar://problem/
25200976>
llvm-svn: 264909
Vassil Vassilev [Wed, 30 Mar 2016 20:10:07 +0000 (20:10 +0000)]
[modules] Add a regression test for PR21547.
llvm-svn: 264908
Hal Finkel [Wed, 30 Mar 2016 19:54:56 +0000 (19:54 +0000)]
Add a copy constructor to StringMap
There is code under review that requires StringMap to have a copy constructor,
and this makes StringMap more consistent with our other containers (like
DenseMap) that have copy constructors.
Differential Revision: http://reviews.llvm.org/D18506
llvm-svn: 264906
Rui Ueyama [Wed, 30 Mar 2016 19:41:51 +0000 (19:41 +0000)]
Split Writer::assignAddresses. NFC.
llvm-svn: 264905
Hal Finkel [Wed, 30 Mar 2016 19:37:08 +0000 (19:37 +0000)]
[LoopVectorize] Don't vectorize loops when everything will be scalarized
This change prevents the loop vectorizer from vectorizing when all of the vector
types it generates will be scalarized. I've run into this problem on the PPC's QPX
vector ISA, which only holds floating-point vector types. The loop vectorizer
will, however, happily vectorize loops with purely integer computation. Here's
an example:
LV: The Smallest and Widest types: 32 / 32 bits.
LV: The Widest register is: 256 bits.
LV: Found an estimated cost of 0 for VF 1 For instruction: %indvars.iv25 = phi i64 [ 0, %entry ], [ %indvars.iv.next26, %for.body ]
LV: Found an estimated cost of 0 for VF 1 For instruction: %arrayidx = getelementptr inbounds [1600 x i32], [1600 x i32]* %a, i64 0, i64 %indvars.iv25
LV: Found an estimated cost of 0 for VF 1 For instruction: %2 = trunc i64 %indvars.iv25 to i32
LV: Found an estimated cost of 1 for VF 1 For instruction: store i32 %2, i32* %arrayidx, align 4
LV: Found an estimated cost of 1 for VF 1 For instruction: %indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
LV: Found an estimated cost of 1 for VF 1 For instruction: %exitcond27 = icmp eq i64 %indvars.iv.next26, 1600
LV: Found an estimated cost of 0 for VF 1 For instruction: br i1 %exitcond27, label %for.cond.cleanup, label %for.body
LV: Scalar loop costs: 3.
LV: Found an estimated cost of 0 for VF 2 For instruction: %indvars.iv25 = phi i64 [ 0, %entry ], [ %indvars.iv.next26, %for.body ]
LV: Found an estimated cost of 0 for VF 2 For instruction: %arrayidx = getelementptr inbounds [1600 x i32], [1600 x i32]* %a, i64 0, i64 %indvars.iv25
LV: Found an estimated cost of 0 for VF 2 For instruction: %2 = trunc i64 %indvars.iv25 to i32
LV: Found an estimated cost of 2 for VF 2 For instruction: store i32 %2, i32* %arrayidx, align 4
LV: Found an estimated cost of 1 for VF 2 For instruction: %indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
LV: Found an estimated cost of 1 for VF 2 For instruction: %exitcond27 = icmp eq i64 %indvars.iv.next26, 1600
LV: Found an estimated cost of 0 for VF 2 For instruction: br i1 %exitcond27, label %for.cond.cleanup, label %for.body
LV: Vector loop of width 2 costs: 2.
LV: Found an estimated cost of 0 for VF 4 For instruction: %indvars.iv25 = phi i64 [ 0, %entry ], [ %indvars.iv.next26, %for.body ]
LV: Found an estimated cost of 0 for VF 4 For instruction: %arrayidx = getelementptr inbounds [1600 x i32], [1600 x i32]* %a, i64 0, i64 %indvars.iv25
LV: Found an estimated cost of 0 for VF 4 For instruction: %2 = trunc i64 %indvars.iv25 to i32
LV: Found an estimated cost of 4 for VF 4 For instruction: store i32 %2, i32* %arrayidx, align 4
LV: Found an estimated cost of 1 for VF 4 For instruction: %indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
LV: Found an estimated cost of 1 for VF 4 For instruction: %exitcond27 = icmp eq i64 %indvars.iv.next26, 1600
LV: Found an estimated cost of 0 for VF 4 For instruction: br i1 %exitcond27, label %for.cond.cleanup, label %for.body
LV: Vector loop of width 4 costs: 1.
...
LV: Selecting VF: 8.
LV: The target has 32 registers
LV(REG): Calculating max register usage:
LV(REG): At #0 Interval # 0
LV(REG): At #1 Interval # 1
LV(REG): At #2 Interval # 2
LV(REG): At #4 Interval # 1
LV(REG): At #5 Interval # 1
LV(REG): VF = 8
The problem is that the cost model here is not wrong, exactly. Since all of
these operations are scalarized, their cost (aside from the uniform ones) are
indeed VF*(scalar cost), just as the model suggests. In fact, the larger the VF
picked, the lower the relative overhead from the loop itself (and the
induction-variable update and check), and so in a sense, picking the largest VF
here is the right thing to do.
The problem is that vectorizing like this, where all of the vectors will be
scalarized in the backend, isn't really vectorizing, but rather interleaving.
By itself, this would be okay, but then the vectorizer itself also interleaves,
and that's where the problem manifests itself. There's aren't actually enough
scalar registers to support the normal interleave factor multiplied by a factor
of VF (8 in this example). In other words, the problem with this is that our
register-pressure heuristic does not account for scalarization.
While we might want to improve our register-pressure heuristic, I don't think
this is the right motivating case for that work. Here we have a more-basic
problem: The job of the vectorizer is to vectorize things (interleaving aside),
and if the IR it generates won't generate any actual vector code, then
something is wrong. Thus, if every type looks like it will be scalarized (i.e.
will be split into VF or more parts), then don't consider that VF.
This is not a problem specific to PPC/QPX, however. The problem comes up under
SSE on x86 too, and as such, this change fixes PR26837 too. I've added Sanjay's
reduced test case from PR26837 to this commit.
Differential Revision: http://reviews.llvm.org/D18537
llvm-svn: 264904
Adhemerval Zanella [Wed, 30 Mar 2016 19:12:18 +0000 (19:12 +0000)]
[lld] [ELF/AArch64] Add aarch64 TLS IE to LE relax for local symbol test
This patch add a TLS relax optimization test when transforming
Initial-Exec to Local-Exec for local symbols (which can not be preempted).
llvm-svn: 264903
Rong Xu [Wed, 30 Mar 2016 18:37:52 +0000 (18:37 +0000)]
[PGO] PGOFuncName in LTO optimizations
PGOFuncNames are used as the key to retrieve the Function definition from the
MD5 stored in the profile. For internal linkage function, we prefix the source
file name to the PGOFuncNames. LTO's internalization privatizes many global linkage
symbols. This happens after value profile annotation, but those internal
linkage functions should not have a source prefix. To differentiate compiler
generated internal symbols from original ones, PGOFuncName meta data are
created and attached to the original internal symbols in the value profile
annotation step. If a symbol does not have the meta data, its original linkage
must be non-internal.
Also add a new map that maps PGOFuncName's MD5 value to the function definition.
Differential Revision: http://reviews.llvm.org/D17895
llvm-svn: 264902
Reid Kleckner [Wed, 30 Mar 2016 18:31:14 +0000 (18:31 +0000)]
[cmake] Get the MSVC version by running cl rather than relying on MSVC_VERSION
MSVC_VERSION comes from the _MSC_VER macro, which won't correspond to
the STL version if the host compiler is clang-cl.
llvm-svn: 264901
Reid Kleckner [Wed, 30 Mar 2016 18:19:39 +0000 (18:19 +0000)]
[cmake] Instead of testing char16_t for MSVC compat, directly ask cl.exe its version
Credit to Aaron Ballman for thinking of this.
llvm-svn: 264886
Tobias Grosser [Wed, 30 Mar 2016 18:18:31 +0000 (18:18 +0000)]
Revert 264782 and 264789
These caused LNT failures due to new assertions when running with
-polly-position=before-vectorizer -polly-process-unprofitable for:
FAIL: clamscan.compile_time
FAIL: cjpeg.compile_time
FAIL: consumer-jpeg.compile_time
FAIL: shapes.compile_time
FAIL: clamscan.execution_time
FAIL: cjpeg.execution_time
FAIL: consumer-jpeg.execution_time
FAIL: shapes.execution_time
The failures have been introduced by r264782, but r264789 had to be reverted
as it depended on the earlier patch.
llvm-svn: 264885
Teresa Johnson [Wed, 30 Mar 2016 18:15:08 +0000 (18:15 +0000)]
Restore "[ThinLTO] Serialize the Module SourceFileName to/from LLVM assembly"
This restores commit 264869, with a fix for windows bots to properly
escape '\' in the path when serializing out. Added test.
llvm-svn: 264884
Jim Ingham [Wed, 30 Mar 2016 18:14:36 +0000 (18:14 +0000)]
Fix header name.
llvm-svn: 264883
Chad Rosier [Wed, 30 Mar 2016 18:08:51 +0000 (18:08 +0000)]
[AArch64] Fix warnings pointed out by Hal.
llvm-svn: 264882
Reid Kleckner [Wed, 30 Mar 2016 17:30:26 +0000 (17:30 +0000)]
[cmake] Add -fms-compatibility-version=19 when clang-cl gives errors about char16_t
What we are really trying to do here is to figure out if we are using
the 2015 STL. Unfortunately, so far as I know the MSVC STL does not
define a version macro that we can check directly. Instead I wrote a
check to see if char16_t works.
llvm-svn: 264881
Reid Kleckner [Wed, 30 Mar 2016 17:28:21 +0000 (17:28 +0000)]
[cmake] Allow EH usage with clang-cl
llvm-svn: 264880
Rong Xu [Wed, 30 Mar 2016 16:56:31 +0000 (16:56 +0000)]
[PGO] Use ArrayRef in annotateValueSite()
Using ArrayRef in annotateValueSite's parameter instead of using an array
and it's size.
Differential Revision: http://reviews.llvm.org/D18568
llvm-svn: 264879
Rui Ueyama [Wed, 30 Mar 2016 16:51:57 +0000 (16:51 +0000)]
Include line number in error message for linker scripts.
This patch is based on http://reviews.llvm.org/D18545 written
by George Rimar.
llvm-svn: 264878
Tom Stellard [Wed, 30 Mar 2016 16:35:13 +0000 (16:35 +0000)]
AMDGPU/SI: Improve MachineSchedModel definition
This patch contains a few improvements to the model, including:
- Using a single resource with a defined buffers size for each memory unit.
- Setting the IssueWidth correctly.
- Fixing latency values for memory instructions.
shader-db stats:
16429 shaders in 3231 tests
Totals:
SGPRS: 318232 -> 312328 (-1.86 %)
VGPRS: 208996 -> 209346 (0.17 %)
Code Size: 7147044 -> 7166440 (0.27 %) bytes
LDS: 83 -> 83 (0.00 %) blocks
Scratch: 1862656 -> 1459200 (-21.66 %) bytes per wave
Max Waves: 49182 -> 49243 (0.12 %)
Wait states: 0 -> 0 (0.00 %)A
Differential Revision: http://reviews.llvm.org/D18453
llvm-svn: 264877
Tom Stellard [Wed, 30 Mar 2016 16:35:09 +0000 (16:35 +0000)]
AMDGPU/SI: Enable lanemask tracking in misched
Summary:
This results in higher register usage, but should make it easier for
the compiler to hide latency.
This pass is a prerequisite for some more scheduler improvements, and I
think the increase register usage with this patch is acceptable, because
when combined with the scheduler improvements, the total register usage
will decrease.
shader-db stats:
2382 shaders in 478 tests
Totals:
SGPRS: 48672 -> 49088 (0.85 %)
VGPRS: 34148 -> 34847 (2.05 %)
Code Size: 1285816 -> 1289128 (0.26 %) bytes
LDS: 28 -> 28 (0.00 %) blocks
Scratch: 492544 -> 573440 (16.42 %) bytes per wave
Max Waves: 6856 -> 6846 (-0.15 %)
Wait states: 0 -> 0 (0.00 %)
Depends on D18451
Reviewers: nhaehnle, arsenm
Subscribers: arsenm, llvm-commits
Differential Revision: http://reviews.llvm.org/D18452
llvm-svn: 264876
Jonas Paulsson [Wed, 30 Mar 2016 16:11:58 +0000 (16:11 +0000)]
[SystemZ] Add nop and nopr InstAliases.
For compatability with GAS, nop and nopr are recognized as alises for
bc and bcr, respectively. A mask of 0 turns these instructions
effectively into no-operations.
Reviewed by Ulrich Weigand.
llvm-svn: 264875
Vedant Kumar [Wed, 30 Mar 2016 16:03:02 +0000 (16:03 +0000)]
[c-index-test] Delete dead function, NFC
llvm-svn: 264874
Jonas Paulsson [Wed, 30 Mar 2016 15:51:24 +0000 (15:51 +0000)]
[SystemZ] Specify required features for builtins.
BuiltinsSystemZ.def is extended to include the required processor
features per intrinsic.
New test test/CodeGen/builtins-systemz-error2.c that checks for
expected errors when instrinsics are used with a subtarget that does
not support the required feature (e.g. vector support).
Reviewed by Ulrich Weigand.
llvm-svn: 264873
Nirav Dave [Wed, 30 Mar 2016 15:41:12 +0000 (15:41 +0000)]
Remove HasFnAttribute guards to getFnAttribute calls
These checks are redundant and can be removed
Reviewers: hans
Subscribers: llvm-commits, mzolotukhin
Differential Revision: http://reviews.llvm.org/D18564
llvm-svn: 264872
Teresa Johnson [Wed, 30 Mar 2016 15:16:04 +0000 (15:16 +0000)]
Revert "[ThinLTO] Serialize the Module SourceFileName to/from LLVM assembly"
This reverts commit r264869. I am seeing Windows bot failures due to the
"\" in the path being mishandled at some point (seems to be interpreted
wrongly at some point and llvm-as | llvm-dis is yielding some junk
characters). Need to investigate.
llvm-svn: 264871
Simon Pilgrim [Wed, 30 Mar 2016 14:14:00 +0000 (14:14 +0000)]
[X86][XOP] BITREVERSE lowering using VPPERM
XOP's VPPERM has some great 'permute operations' that it can do as well as part of shuffling the bytes of a 128-bit vector - in this case we use it to perform BITREVERSE in a single instruction.
llvm-svn: 264870
Teresa Johnson [Wed, 30 Mar 2016 14:00:02 +0000 (14:00 +0000)]
[ThinLTO] Serialize the Module SourceFileName to/from LLVM assembly
Summary:
This change serializes out and in the SourceFileName to LLVM assembly
so that it is preserved through "llvm-dis | llvm-as". This is
necessary to ensure that the global identifiers created for local values
in the module summary index are the same even if the bitcode is
streamed out and read back from LLVM assembly.
Serializing the summary itself to LLVM assembly is in progress.
Reviewers: joker.eph
Subscribers: llvm-commits, joker.eph
Differential Revision: http://reviews.llvm.org/D18588
llvm-svn: 264869
Teresa Johnson [Wed, 30 Mar 2016 13:59:49 +0000 (13:59 +0000)]
Prepare tests for change to emit Module SourceFileName to LLVM assembly
Modify these tests to ignore the source file name when looking for the
expected string. It was already catching the source file name once via
the ModuleID, and will catch it another time with an impending change to
LLVM to serialize out the module's SourceFileName.
llvm-svn: 264868
Simon Pilgrim [Wed, 30 Mar 2016 13:55:00 +0000 (13:55 +0000)]
[X86][SSE] Test the legalization of vector comparison results
We are currently doing a REALLY bad job of packing results of vector comparisons into the legalized <X x i1> result equivalents - a mixture of PACKSS/PMOVMSKB would be much better here.
llvm-svn: 264867
Rafael Espindola [Wed, 30 Mar 2016 13:27:50 +0000 (13:27 +0000)]
No relocation needs bot SA and ZA.
Pass only one of them to relocateOne.
llvm-svn: 264866
Rafael Espindola [Wed, 30 Mar 2016 13:18:08 +0000 (13:18 +0000)]
Implement getImplicitAddend for mips.
llvm-svn: 264865
Rafael Espindola [Wed, 30 Mar 2016 12:45:58 +0000 (12:45 +0000)]
Simplify mips addend processing.
It is now added to the addend in the same way as a regular Elf_Rel
addend.
llvm-svn: 264864
Rafael Espindola [Wed, 30 Mar 2016 12:40:38 +0000 (12:40 +0000)]
Fix handling of addends on i386.
Because of merge sections it is not sufficient to just add them while
applying a relocation.
llvm-svn: 264863
Alexander Kornienko [Wed, 30 Mar 2016 12:35:05 +0000 (12:35 +0000)]
[clang-tidy] Fix MSVC build.
llvm-svn: 264862
Benjamin Kramer [Wed, 30 Mar 2016 12:31:51 +0000 (12:31 +0000)]
[NVPTX] Avoid temporary std::string and make single-use function local to the cpp file.
No functionality change intended.
llvm-svn: 264861
Marianne Mailhot-Sarrasin [Wed, 30 Mar 2016 12:20:53 +0000 (12:20 +0000)]
gold-plugin: Fixed typo in an error message.
llvm-svn: 264860
Gabor Horvath [Wed, 30 Mar 2016 12:16:09 +0000 (12:16 +0000)]
[clang-tidy] Adjust dangling references check to ASTMatcher changes.
llvm-svn: 264859
Alexander Kornienko [Wed, 30 Mar 2016 12:05:33 +0000 (12:05 +0000)]
[docs] Added 3.8 clang-tidy release notes, fixed formatting.
llvm-svn: 264858
Simon Pilgrim [Wed, 30 Mar 2016 11:43:26 +0000 (11:43 +0000)]
[X86][SSE] Added tests for clearing upper bits of vector elements
Patterns based on PR6455
llvm-svn: 264857
Alexander Kornienko [Wed, 30 Mar 2016 11:31:33 +0000 (11:31 +0000)]
[clang-tidy] readability check for const params in declarations
Summary: Adds a clang-tidy warning for top-level consts in function declarations.
Reviewers: hokein, sbenza, alexfh
Subscribers: cfe-commits
Patch by Matt Kulukundis!
Differential Revision: http://reviews.llvm.org/D18408
llvm-svn: 264856
Gabor Horvath [Wed, 30 Mar 2016 11:22:14 +0000 (11:22 +0000)]
[ASTMatchers] Existing matcher hasAnyArgument fixed
Summary: A checker (will be uploaded after this patch) needs to check implicit casts. The checker needs matcher hasAnyArgument but it ignores implicit casts and parenthesized expressions which disables checking of implicit casts for arguments in the checker. However the documentation of the matcher contains a FIXME that this should be removed once separate matchers for ignoring implicit casts and parenthesized expressions are ready. Since these matchers were already there the fix could be executed. Only one Clang checker was affected which was also fixed (ignoreParenImpCasts added) and is separately uploaded. Third party checkers (not in the Clang repository) may be affected by this fix so the fix must be emphasized in the release notes.
Reviewers: klimek, sbenza, alexfh
Subscribers: alexfh, klimek, xazax.hun, cfe-commits
Differential Revision: http://reviews.llvm.org/D18243
llvm-svn: 264855
Kuba Brecka [Wed, 30 Mar 2016 10:50:24 +0000 (10:50 +0000)]
Fix the ThreadSanitizer support to avoid creating empty SBThreads and to not crash when thread_id is unavailable. Plus a whitespace fix.
llvm-svn: 264854
Alexey Bataev [Wed, 30 Mar 2016 10:43:55 +0000 (10:43 +0000)]
[OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.
Initial parsing/sema/serialization/deserialization support for '#pragma
omp declare simd' directive.
The 'declare simd' construct can be applied to a function to enable the
creation of one or more versions that can process multiple arguments
using SIMD instructions from a single invocation from a SIMD loop.
If the function has any declarations, then the declare simd construct
for any declaration that has one must be equivalent to the one specified
for the definition. Otherwise, the result is unspecified.
This pragma can be applied many times to the same declaration.
Internally this pragma is represented as an attribute. But we need special processing for this pragma because it must be used before function declaration, this directive is applied to.
Differential Revision: http://reviews.llvm.org/D10599
llvm-svn: 264853
James Molloy [Wed, 30 Mar 2016 10:11:43 +0000 (10:11 +0000)]
[VectorUtils] Don't try and truncate PHIs to a smaller bitwidth
We already try not to truncate PHIs in computeMinimalBitwidths. LoopVectorize can't handle it and we really don't need to, because both induction and reduction PHIs are truncated by other means.
However, we weren't bailing out in all the places we should have, and we ended up by returning a PHI to be truncated, which has caused PR27018.
This fixes PR17018.
llvm-svn: 264852
Gabor Horvath [Wed, 30 Mar 2016 10:08:59 +0000 (10:08 +0000)]
[analyzer] Fix an assertion fail in hash generation.
In case the (uniqueing) location of the diagnostic is in a line that only
contains whitespaces there was an assertion fail during issue hash generation.
Unfortunately I am unable to reproduce this error with the built in checkers,
so no there is no failing test case with this patch. It would be possible to
write a debug checker for that purpuse but it does not worth the effort.
Differential Revision: http://reviews.llvm.org/D18210
llvm-svn: 264851
Pavel Labath [Wed, 30 Mar 2016 09:43:04 +0000 (09:43 +0000)]
Fix SocketAddressTest (again)
On some versions of Windows, the address is returned as "::1", while on others it's
"0:0:...:0:1". Accept both versions, as they represent the same address.
llvm-svn: 264850
Pavel Labath [Wed, 30 Mar 2016 09:42:59 +0000 (09:42 +0000)]
Fix warning in ThreadSanitizerRuntime
llvm-svn: 264849
Pavel Labath [Wed, 30 Mar 2016 08:45:37 +0000 (08:45 +0000)]
Fix warning in ClangExpressionParser
llvm-svn: 264847
Pavel Labath [Wed, 30 Mar 2016 08:43:54 +0000 (08:43 +0000)]
Fix flakyness in TestWatchpointMultipleThreads
Summary:
the inferior in the test deliberately does not lock a mutex when accessing the watched variable.
The reason for that is unclear as, based on the logs, the original intention of the test was to
check whether watchpoints get propagated to newly created threads, which should work fine even
with a mutex. Furthermore, in the unlikely event (which I have still observed happening from time
to time) that two threads do manage the execute the "critical section" simultaneously, the test
will fail, as it is expecting the watchpoint "hit count" to be 1, but in this case it will be 2.
Given this, I have simply chose to lock the mutex always, so that we have more predictible
behavior. Watchpoints being hit simultaneously is still (and correctly!) tested by
TestConcurrentEvents.
Reviewers: clayborg, jingham
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D18558
llvm-svn: 264846
Chandler Carruth [Wed, 30 Mar 2016 08:41:59 +0000 (08:41 +0000)]
[x86] Fix a horrible bug in our lowering of x86 floating point atomic
operations.
Specifically, we had code that tried to badly approximate reconstructing
all of the possible variations on addressing modes in two x86
instructions based on those in one pseudo instruction. This is not the
first bug uncovered with doing this, so stop doing it altogether.
Instead generically and pedantically copy every operand from the address
over to both new instructions, and strip kill flags from any register
operands.
This fixes a subtle bug seen in the wild where we would mysteriously
drop parts of the addressing mode, causing for example the index
argument in the added test case to just be completely ignored.
Hypothetically, this was an extremely bad miscompile because it actually
caused a predictable and leveragable write of a 64bit quantity to an
unintended offset (the first element of the array intead of whatever
other element was intended). As a consequence, in theory this could even
have introduced security vulnerabilities.
However, this was only something that could happen with an atomic
floating point add. No other operation could trigger this bug, so it
seems extremely unlikely to have occured widely in the wild.
But it did in fact occur, and frequently in scientific applications
which were using relaxed atomic updates of a floating point value after
adding a delta. Those would end up being quite badly miscompiled by
LLVM, which is how we found this. Of course, this often looks like
a race condition in the code, but it was actually a miscompile.
I suspect that this whole RELEASE_FADD thing was a complete mistake.
There is no such operation, and I worry that anything other than add
will get remarkably worse codegeneration. But that's not for this
change....
llvm-svn: 264845
Ismail Donmez [Wed, 30 Mar 2016 08:31:46 +0000 (08:31 +0000)]
Fix shared build after r264790
llvm-svn: 264844
George Rimar [Wed, 30 Mar 2016 08:16:11 +0000 (08:16 +0000)]
[ELF] - Do not keep undefined locals in .symtab
gold and bfd do not include the undefined locals in symtab.
We have no reasons to support that either.
That fixes PR27016
Differential revision: http://reviews.llvm.org/D18554
llvm-svn: 264843
Stephan Bergmann [Wed, 30 Mar 2016 06:27:31 +0000 (06:27 +0000)]
For MS ABI, emit dllexport friend functions defined inline in class
...as that is apparently what MSVC does. This is an updated version of r263738,
which had to be reverted in r263740 due to test failures. The original version
had erroneously emitted functions that are defined in class templates, too (see
the updated "Handle friend functions" code in EmitDeferredDecls,
lib/CodeGen/ModuleBuilder.cpp). (The updated tests needed to be split out into
their own dllexport-ms-friend.cpp because of the CHECK-NOTs which would have
interfered with subsequent CHECK-DAGs in dllexport.cpp.)
Differential Revision: http://reviews.llvm.org/D18430
llvm-svn: 264841
Craig Topper [Wed, 30 Mar 2016 05:26:43 +0000 (05:26 +0000)]
[CodeGen] Mark EVT:getExtendedSizeInBits() as LLVM_READONLY.
I think I had tried this a long time back and some bots failed. Hoping that was with an older gcc and maybe now it will work.
llvm-svn: 264840
Jingyue Wu [Wed, 30 Mar 2016 05:05:40 +0000 (05:05 +0000)]
[docs] Add gpucc publication and tutorial.
llvm-svn: 264839
Xiuli Pan [Wed, 30 Mar 2016 04:46:32 +0000 (04:46 +0000)]
[OpenCL] Fix pipe builtin bugs
Summary:
1. Diag should be output if types are not the same.
2. Should compare using canonical type.
3. Refine the diag to be more clear.
Reviewers: yaxunl, Anastasia
Subscribers: MatsPetersson, pekka.jaaskelainen, cfe-commits
Differential Revision: http://reviews.llvm.org/D17955
llvm-svn: 264825
Vedant Kumar [Wed, 30 Mar 2016 04:36:10 +0000 (04:36 +0000)]
[profile] Remove quotes around env variable, NFC
llvm-svn: 264824
Duncan P. N. Exon Smith [Wed, 30 Mar 2016 04:32:29 +0000 (04:32 +0000)]
IR: Constify LLVMContext::discardValueNames, NFC
llvm-svn: 264823
Duncan P. N. Exon Smith [Wed, 30 Mar 2016 04:21:52 +0000 (04:21 +0000)]
BitcodeReader: Fix weird whitespace, NFC
llvm-svn: 264822
Sean Callanan [Wed, 30 Mar 2016 03:44:51 +0000 (03:44 +0000)]
Don't register the addresses of private symbols from expressions.
They're not supposed to go in the symbol table, and in fact the way the JIT
is currently implemented it sometimes crashes when you try to get the
address of such a function. So we skip them.
llvm-svn: 264821
George Burgess IV [Wed, 30 Mar 2016 03:12:08 +0000 (03:12 +0000)]
[MemorySSA] Make the visitor more careful with calls.
Prior to this patch, the MemorySSA caching visitor would cache all
calls that it visited. When paired with phi optimization, this can be
problematic. Consider:
define void @foo() {
; 1 = MemoryDef(liveOnEntry)
call void @clobberFunction()
br i1 undef, label %if.end, label %if.then
if.then:
; MemoryUse(??)
call void @readOnlyFunction()
; 2 = MemoryDef(1)
call void @clobberFunction()
br label %if.end
if.end:
; 3 = MemoryPhi(...)
; MemoryUse(?)
call void @readOnlyFunction()
ret void
}
When optimizing MemoryUse(?), we visit defs 1 and 2, so we note to
cache them later. We ultimately end up not being able to optimize
passed the Phi, so we set MemoryUse(?) to point to the Phi. We then
cache the clobbering call for def 1 to be the Phi.
This commit changes this behavior so that we wipe out any calls
added to VisistedCalls while visiting the defs of a phi we couldn't
optimize.
Aside: With this patch, we now can bootstrap clang/LLVM without a
single MemorySSA verifier failure. Woohoo. :)
llvm-svn: 264820
Chandler Carruth [Wed, 30 Mar 2016 03:10:24 +0000 (03:10 +0000)]
[x86] Extract a helper function to compute the full addressing mode from
an x86 MachineInstr's operands. This will be super useful to fix some
bad atomics code in my next commit.
No functionality changed.
llvm-svn: 264819
Xinliang David Li [Wed, 30 Mar 2016 02:16:07 +0000 (02:16 +0000)]
[PGO] Handle invoke inst in IR based icall instrumentation
Differential Revision: http://reviews.llvm.org/D18580
llvm-svn: 264818
Vedant Kumar [Wed, 30 Mar 2016 01:30:47 +0000 (01:30 +0000)]
[profile] Test error reporting by writing to a temp directory
This test case is meant to check whether verbose error logging works. It
does this by _failing_ to write a profile to a path corresponding to a
directory. Make this clearer by writing to a temporary directory.
Patch suggested by Sean Silva!
llvm-svn: 264817
Rui Ueyama [Wed, 30 Mar 2016 00:43:49 +0000 (00:43 +0000)]
Fix comments.
The original comments were separated by new code that is irrelevant to
the comment. This patch moves the comment to the right place and update it.
llvm-svn: 264816
Andrew Wilkins [Wed, 30 Mar 2016 00:29:33 +0000 (00:29 +0000)]
[llgo] add USES_TERMINAL option to check-libgo
Summary:
The check-libgo target runs "make check" in the
libgo package, which can take a long time on
slower machines. To prevent buildbot failures
due to timeout, we can use Ninja's console pool
for this target.
Reviewers: pcc
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D9495
llvm-svn: 264815
George Burgess IV [Wed, 30 Mar 2016 00:26:26 +0000 (00:26 +0000)]
[MemorySSA] Change how the walker views/walks visited phis.
This patch teaches the caching MemorySSA walker a few things:
1. Not to walk Phis we've walked before. It seems that we tried to do
this before, but it didn't work so well in cases like:
define void @foo() {
%1 = alloca i8
%2 = alloca i8
br label %begin
begin:
; 3 = MemoryPhi({%0,liveOnEntry},{%end,2})
; 1 = MemoryDef(3)
store i8 0, i8* %2
br label %end
end:
; MemoryUse(?)
load i8, i8* %1
; 2 = MemoryDef(1)
store i8 0, i8* %2
br label %begin
}
Because we wouldn't put Phis in Q.Visited until we tried to visit them.
So, when trying to optimize MemoryUse(?):
- We would visit 3 above
- ...Which would make us put {%0,liveOnEntry} in Q.Visited
- ...Which would make us visit {%0,liveOnEntry}
- ...Which would make us put {%end,2} in Q.Visited
- ...Which would make us visit {%end,2}
- ...Which would make us visit 3
- ...Which would realize we've already visited everything in 3
- ...Which would make us conservatively return 3.
In the added test-case, (@looped_visitedonlyonce) this behavior would
cause us to give incorrect results. Specifically, we'd visit 4 twice
in the same query, but on the second visit, we'd skip while.cond because
it had been visited, visit if.then/if.then2, and cache "1" as the
clobbering def on the way back.
2. If we try to walk the defs of a {Phi,MemLoc} and see it has been
visited before, just hand back the Phi we're trying to optimize.
I promise this isn't as terrible as it seems. :)
We now insert {Phi,MemLoc} pairs just before walking the Phi's upward
defs. So, we check the cache for the {Phi,MemLoc} pair before checking
if we've already walked the Phi.
The {Phi,MemLoc} pair is (almost?) always guaranteed to have a cache
entry if we've already fully walked it, because we cache as we go.
So, if the {Phi,MemLoc} pair isn't in cache, either:
(a) we must be in the process of visiting it (in which case, we can't
give a better answer in a cache-as-we-go DFS walker)
(b) we visited it, but didn't cache it on the way back (...which seems
to require `ModifyingAccess` to not dominate `StartingAccess`,
so I'm 99% sure that would be an error. If it's not an error, I
haven't been able to get it to happen locally, so I suspect it's
rare.)
- - - - -
As a consequence of this change, we no longer skip upward defs of phis,
so we can kill the `VisitedOnlyOne` check. This gives us better accuracy
than we had before, at the cost of potentially doing a bit more work
when we have a loop.
llvm-svn: 264814
Bruno Cardoso Lopes [Wed, 30 Mar 2016 00:25:57 +0000 (00:25 +0000)]
[Driver] Quote clang full version in dwarf producer when invoking cc1as
Convenience to allow easy copy-n-paste from clang -v output when
reproducing cc1as comandline.
rdar://problem/
23959295
llvm-svn: 264813
Sean Silva [Wed, 30 Mar 2016 00:25:15 +0000 (00:25 +0000)]
[libprofile] Make this test express intent a bit better.
This also makes it work on PS4 a bit better.
For running the libprofile tests on PS4, we are sneaking environment
variables through on the command line, so the extra argument for
LLVM_PROFILE_FILE was messing up the simple `argc < 2` check.
llvm-svn: 264812
Adam Nemet [Wed, 30 Mar 2016 00:21:29 +0000 (00:21 +0000)]
[Aarch64] Turn on the LoopDataPrefetch pass for Cyclone
llvm-svn: 264811
Greg Clayton [Wed, 30 Mar 2016 00:02:13 +0000 (00:02 +0000)]
Fixed the failing test TestCommandScriptImmediateOutput on MacOSX. Turns out that there are few things to watch out for when writing pexpect tests:
1 - If you plan on looking for the "(lldb) " prompt as a regular expression, look for "\(lldb\) " so you don't just find "lldb".
2 - Make sure to not use colors (specify --no-use-colors as an option to lldb when launching it) as our editline will print:
"(lldb) <color junk>(lldb) "
where "<color junk>" is a work around that is used to allow us to colorize our prompts. The bad thing is this will make pexepct code like this not execute as you would expect:
prompt = "\(lldb\) "
self.child.sendline("breakpoint set ...", prompt)
self.child.sendline("breakpoint clear ...", prompt)
The problem is the first "sendline" will create two lldb prompts and will match both the first and second prompts and you output will get off. So be sure to disable colors if you need to.
Fixed a case where "TestCommandScriptImmediateOutput.py" would fail if you have spaces in your directory names. I modified custom_command.py to use shlex to parse arguments and I quoted the file path we sent down to the custom_command.write_file function.
llvm-svn: 264810
Davide Italiano [Tue, 29 Mar 2016 23:57:22 +0000 (23:57 +0000)]
[LTO] Add a comment to explain how we handle @llvm.used.
Requested by: Rui Ueyama.
llvm-svn: 264809
Bruno Cardoso Lopes [Tue, 29 Mar 2016 23:47:40 +0000 (23:47 +0000)]
[CrashReproducer] Cleanup and move functionality around in ModuleDependencyCollector. NFC
- Make ModuleDependencyCollector use the DependencyCollector interface
- Move some methods from ModuleDependencyListener to ModuleDependencyCollector
in order to share common functionality with other future possible
callbacks.
llvm-svn: 264808
Adam Nemet [Tue, 29 Mar 2016 23:45:56 +0000 (23:45 +0000)]
[PPC] Remove -ppc-loop-prefetch-distance in favor of -prefetch-distance
After the previous change, this can now be overridden centrally in the
pass.
llvm-svn: 264807
Adam Nemet [Tue, 29 Mar 2016 23:45:52 +0000 (23:45 +0000)]
[LoopDataPrefetch] Centralize the tuning cl::opts under the pass
This is effectively NFC, minus the renaming of the options
(-cyclone-prefetch-distance -> -prefetch-distance).
The change was requested by Tim in D17943.
llvm-svn: 264806
Anna Zaks [Tue, 29 Mar 2016 23:19:40 +0000 (23:19 +0000)]
[tsan] Do not instrument reads/writes to instruction profile counters.
We have known races on profile counters, which can be reproduced by enabling
-fsanitize=thread and -fprofile-instr-generate simultaneously on a
multi-threaded program. This patch avoids reporting those races by not
instrumenting the reads and writes coming from the instruction profiler.
llvm-svn: 264805
Kostya Serebryany [Tue, 29 Mar 2016 23:13:25 +0000 (23:13 +0000)]
[libFuzzer] more trophies
llvm-svn: 264804
Kostya Serebryany [Tue, 29 Mar 2016 23:07:36 +0000 (23:07 +0000)]
[libFuzzer] more docs
llvm-svn: 264803
Rafael Espindola [Tue, 29 Mar 2016 23:05:59 +0000 (23:05 +0000)]
Simplify AHL handling.
This simplifies a few things
* Read the value as early as possible, instead of passing a pointer to
the location.
* Print the warning for missing pair close to where we find out it is
missing.
* Don't pass the value to relocateOne.
llvm-svn: 264802
Yunzhong Gao [Tue, 29 Mar 2016 22:59:20 +0000 (22:59 +0000)]
Fixing PR26558: remove the adx target attribute requirement from adc builtins.
The addcarry and subborrow variants of the builtins do not require the adx
target attribute; only the addcarryx variants require them.
Differential Revision: http://reviews.llvm.org/D18533
llvm-svn: 264801
Duncan P. N. Exon Smith [Tue, 29 Mar 2016 22:57:12 +0000 (22:57 +0000)]
ADCE: Remove debug info intrinsics in dead scopes
During ADCE, track which debug info scopes still have live references
from the code, and delete debug info intrinsics for the dead ones.
These intrinsics describe the locations of variables (in registers or
stack slots). If there's no code left corresponding to a variable's
scope, then there's no way to reference the variable in the debugger and
it doesn't matter what its value is.
I add a DEBUG printout when the described location in an SSA register,
in case it helps some trying to track down why locations get lost.
However, we still delete these; the scope itself isn't attached to any
real code, so the ship has already sailed.
llvm-svn: 264800
Fiona Glaser [Tue, 29 Mar 2016 22:44:57 +0000 (22:44 +0000)]
MachineSink: make shouldSink a TII target hook
Some targets may disagree on what they want sunk or not sunk,
so make this a target hook instead of hardcoded.
llvm-svn: 264799
Adam Nemet [Tue, 29 Mar 2016 22:40:02 +0000 (22:40 +0000)]
[LoopDataPrefetch] Make more member functions private, NFC.
llvm-svn: 264798
Adrian Prantl [Tue, 29 Mar 2016 22:34:30 +0000 (22:34 +0000)]
Upgrade some wildly anachronistic debug info in testcases.
llvm-svn: 264797
Sanjay Patel [Tue, 29 Mar 2016 22:27:39 +0000 (22:27 +0000)]
use FileCheck and auto-check-generation script for exact checking
1. Removed the run line for mingw32 and made the Darwin triples unknown.
This is a test of 32-bit vs. 64-bit platform and the underlying hardware.
We have other tests for checking behavioral differences of the OS platform.
2. Changed the CPU specifiers to the attributes they were meant to represent.
Any CPU that doesn't have SSE4.2 is assumed to have slow unaligned 16-byte accesses,
so it won't use those here.
3. Although the stores really could all be CHECK-DAG, I left them as CHECK-NEXT to
show the strange behavior of the instruction scheduler in the SLOW_32 case.
4. The odd-looking instructions are due to the use of a null pointer in the IR, so
we have integer immediate store addresses. Cute.
llvm-svn: 264796
Betul Buyukkurt [Tue, 29 Mar 2016 22:17:52 +0000 (22:17 +0000)]
[PGO] Test case fix for r264783
llvm-svn: 264795
Greg Clayton [Tue, 29 Mar 2016 22:09:24 +0000 (22:09 +0000)]
LLDB top of tree SVN fails to attach to a MacOSX native process by pid only (no executable).
The problem was that the static DynamicLoaderDarwinKernel::Initialize() was recently changed to come before DynamicLoaderMacOSXDYLD::Initialize() which caused the DynamicLoaderDarwinKernel::CreateInstance(...) to be called before DynamicLoaderMacOSXDYLD::CreateInstance(...) and DynamicLoaderDarwinKernel would claim it could be the dynamic loader for a user space MacOSX process. The fix is to make DynamicLoaderDarwinKernel::CreateInstance() a bit more thourough when vetting the process so that it doesn't claim MacOSX user space processes.
<rdar://problem/
25425373>
llvm-svn: 264794
Jim Ingham [Tue, 29 Mar 2016 22:00:08 +0000 (22:00 +0000)]
Figure out what the fixed expression is, and print it. Added another target setting to
quietly apply fixits for those who really trust clang's fixits.
Also, moved the retry into ClangUserExpression::Evaluate, where I can make a whole new ClangUserExpression
to do the work. Reusing any of the parts of a UserExpression in situ isn't supported at present.
<rdar://problem/
25351938>
llvm-svn: 264793
Xinliang David Li [Tue, 29 Mar 2016 21:53:08 +0000 (21:53 +0000)]
Fix comment in test
llvm-svn: 264792
Davide Italiano [Tue, 29 Mar 2016 21:48:25 +0000 (21:48 +0000)]
[ELF] Drive-by cleanup, make LTO.cpp clang-format clean.
llvm-svn: 264791
Davide Italiano [Tue, 29 Mar 2016 21:46:35 +0000 (21:46 +0000)]
[LTO] Teach LTO about @llvm.used global.
If a symbol appears in @llvm.used, the linker is forced to treat
the symbol as there's a reference to it.
llvm-svn: 264790