Richard Smith [Thu, 5 Oct 2017 00:47:24 +0000 (00:47 +0000)]
PR33924: Merge block-scope anonymous declarations if there are multiple definitions of the enclosing function.
llvm-svn: 314956
Richard Smith [Thu, 5 Oct 2017 00:43:38 +0000 (00:43 +0000)]
Remove PendingBody mechanism for function and ObjC method deserialization.
In its place, track on the canonical function declaration whether there is a
declaration with a body (and if so, which one). This brings function definition
handling in line with what we do in all other contexts, and is necessary to
allow us to merge declarations within multiple definitions of the same function
(eg, PR33924).
No functionality change intended.
llvm-svn: 314955
Rafael Espindola [Thu, 5 Oct 2017 00:35:47 +0000 (00:35 +0000)]
Refactor duplicated code.
Since VisibleToRegularObj is weaker than LinkerRedefined, this should
have no functionality change.
llvm-svn: 314954
Eugene Zelenko [Thu, 5 Oct 2017 00:33:50 +0000 (00:33 +0000)]
[X86] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 314953
Matt Arsenault [Thu, 5 Oct 2017 00:13:20 +0000 (00:13 +0000)]
AMDGPU: Add comment about clamps
llvm-svn: 314952
Matt Arsenault [Thu, 5 Oct 2017 00:13:17 +0000 (00:13 +0000)]
AMDGPU: Do not fold clamp instructions when sources are different
Patch by hakzsam (Samuel Pitoiset)
llvm-svn: 314951
Shoaib Meenai [Wed, 4 Oct 2017 23:51:57 +0000 (23:51 +0000)]
[libc++] Move cache variable definition. NFC
Move it to where the other ABI cache variables/options are defined.
llvm-svn: 314950
Shoaib Meenai [Wed, 4 Oct 2017 23:44:38 +0000 (23:44 +0000)]
[libc++] Allow users to explicitly specify ABI
libc++'s current heuristic for detecting Itanium vs. Microsoft ABI falls
short in some cases. For example, it will detect windows-itanium targets
as using the Microsoft ABI, since they set `_MSC_VER` (for compatibility
with Microsoft headers). Leave the current heuristic in place by default
but also allow users to explicitly specify the ABI if need be.
llvm-svn: 314949
Evgeniy Stepanov [Wed, 4 Oct 2017 23:35:14 +0000 (23:35 +0000)]
[sanitizer] Move cxx-abi library earlier in link flags.
Summary:
This change moves cxx-abi library in asan/ubsan/dd link command line
ahead of other libraries, such as pthread/rt/dl/c/gcc. Given that
cxx-abi may be the full libstdc++/libc++, it makes sense for it to be
ahead of libc and libgcc, at least.
The real motivation is Android, where in the arm32 NDK toolchain
libstdc++.a is actually a linker script that tries to sneak LLVM's
libunwind ahead of libgcc's. Wrong library order breaks unwinding.
Reviewers: srhines, danalbert
Subscribers: aemerson, kubamracek, mgorny, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D38520
llvm-svn: 314948
Eric Fiselier [Wed, 4 Oct 2017 23:21:18 +0000 (23:21 +0000)]
Fix accidental assignment inside test asserts
llvm-svn: 314947
Shoaib Meenai [Wed, 4 Oct 2017 23:17:12 +0000 (23:17 +0000)]
[libc++] Add site config option for ABI macros
Some ABI macros affect headers, so it's nice to have a site config
option for them. Add a LIBCXX_ABI_DEFINES cmake macro to allow
specifying a list of ABI macros to define in the site config.
The primary design constraint (as discussed with Eric on IRC a while
back) was to not have to repeat the ABI macro names in cmake, which only
leaves a free-form cmake list as an option. A somewhat unfortunate
consequence is that we can't verify that the ABI macros being defined
actually exist, though we can at least perform some basic sanity
checking, since all the ABI macros begin with _LIBCPP_ABI_.
Differential Revision: https://reviews.llvm.org/D36719
llvm-svn: 314946
Craig Topper [Wed, 4 Oct 2017 23:06:13 +0000 (23:06 +0000)]
[InstCombine] Improve support for ashr in foldICmpAndShift
We can support ashr similar to lshr, if we know that none of the shifted in bits are used. In that case SimplifyDemandedBits would normally convert it to lshr. But that conversion doesn't happen if the shift has additional users.
Differential Revision: https://reviews.llvm.org/D38521
llvm-svn: 314945
Matt Arsenault [Wed, 4 Oct 2017 22:59:12 +0000 (22:59 +0000)]
AMDGPU: Fix not accounting for instruction size in bundles
These were counted as 0. Fixes branch limit exceeded errors
in some large programs.
llvm-svn: 314944
Konstantin Zhuravlyov [Wed, 4 Oct 2017 22:44:13 +0000 (22:44 +0000)]
AMDGPU: Correctly set EI_OSABI based on the os
Differential Revision: https://reviews.llvm.org/D38555
llvm-svn: 314943
Adrian Prantl [Wed, 4 Oct 2017 22:26:19 +0000 (22:26 +0000)]
clang-format file.
llvm-svn: 314942
Adrian Prantl [Wed, 4 Oct 2017 22:26:19 +0000 (22:26 +0000)]
delete commented out code.
llvm-svn: 314941
Marshall Clow [Wed, 4 Oct 2017 22:23:03 +0000 (22:23 +0000)]
Initial cut at infastructure for fuzzing support for OSS-fuzz
llvm-svn: 314940
Erich Keane [Wed, 4 Oct 2017 22:16:24 +0000 (22:16 +0000)]
Fix 'section' warning behavior with tentatively-defined values
As reported on cfe-commits, r314262 resulted in tentatively-defined
variables not being excluded for the warning.
Patch By: Elizabeth Andrews
llvm-svn: 314939
Sanjoy Das [Wed, 4 Oct 2017 22:02:27 +0000 (22:02 +0000)]
Do not call Loop::getName on possibly dead loops
This fixes PR34832.
llvm-svn: 314938
Xin Tong [Wed, 4 Oct 2017 21:39:25 +0000 (21:39 +0000)]
[MachineBlockPlacement] Make sure PreferredLoopExit is cleared everytime new loop is processed
Summary: Rotate on exit that actually exits the current loop.
Reviewers: davidxl, danielcdh, iteratee, chandlerc
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38563
llvm-svn: 314937
Hans Wennborg [Wed, 4 Oct 2017 21:14:07 +0000 (21:14 +0000)]
Fix a -Wparentheses warning. NFC.
llvm-svn: 314936
Justin Lebar [Wed, 4 Oct 2017 20:47:33 +0000 (20:47 +0000)]
Convert an APInt to int64_t properly in TTI::getGEPCost().
Summary:
If the pointer width is 32 bits and the calculated GEP offset is
negative, we call APInt::getLimitedValue(), which does a
*zero*-extension of the offset. That's wrong -- we should do an sext.
Fixes a bug introduced in rL314362 and found by Evgeny Astigeevich.
Reviewers: efriedma
Subscribers: sanjoy, javed.absar, llvm-commits, eastig
Differential Revision: https://reviews.llvm.org/D38557
llvm-svn: 314935
Marcello Maggioni [Wed, 4 Oct 2017 20:42:46 +0000 (20:42 +0000)]
[LoopDeletion] Move deleteDeadLoop to to LoopUtils. NFC
llvm-svn: 314934
Rafael Espindola [Wed, 4 Oct 2017 20:35:05 +0000 (20:35 +0000)]
Revert "Revert r314810: Use sched_getaffinity instead of std::thread::hardware_concurrency."
This reverts commit r314924.
The required llvm patch was recommitted.
llvm-svn: 314933
Yaxun Liu [Wed, 4 Oct 2017 20:32:17 +0000 (20:32 +0000)]
[OpenCL] Clean up and add missing fields for block struct
Currently block is translated to a structure equivalent to
struct Block {
void *isa;
int flags;
int reserved;
void *invoke;
void *descriptor;
};
Except invoke, which is the pointer to the block invoke function,
all other fields are useless for OpenCL, which clutter the IR and
also waste memory since the block struct is passed to the block
invoke function as argument.
On the other hand, the size and alignment of the block struct is
not stored in the struct, which causes difficulty to implement
__enqueue_kernel as library function, since the library function
needs to know the size and alignment of the argument which needs
to be passed to the kernel.
This patch removes the useless fields from the block struct and adds
size and align fields. The equivalent block struct will become
struct Block {
int size;
int align;
generic void *invoke;
/* custom fields */
};
It also changes the pointer to the invoke function to be
a generic pointer since the address space of a function
may not be private on certain targets.
Differential Revision: https://reviews.llvm.org/D37822
llvm-svn: 314932
Rafael Espindola [Wed, 4 Oct 2017 20:27:01 +0000 (20:27 +0000)]
Bring r314809 back.
But now include a check for CPU_COUNT so we still build on 10 year old
versions of glibc.
Original message:
Use sched_getaffinity instead of std::thread::hardware_concurrency.
The issue with std::thread::hardware_concurrency is that it forwards
to libc and some implementations (like glibc) don't take thread
affinity into consideration.
With this change a llvm program that can execute in only 2 cores will
use 2 threads, even if the machine has 32 cores.
This makes benchmarking a lot easier, but should also help if someone
doesn't want to use all cores for compilation for example.
llvm-svn: 314931
Sanjay Patel [Wed, 4 Oct 2017 20:26:25 +0000 (20:26 +0000)]
[SimplifyCFG] put the optional assumption cache pointer in the options struct; NFCI
This is a follow-up to https://reviews.llvm.org/D38138.
I fixed the capitalization of some functions because we're changing those
lines anyway and that helped verify that we weren't accidentally dropping
any options by using default param values.
llvm-svn: 314930
Leonard Mosescu [Wed, 4 Oct 2017 20:23:56 +0000 (20:23 +0000)]
LLDB cmake fix: define LLDB_CONFIGURATION_xxx based on the build type
Neither LLDB_CONFIGURATION_DEBUG nor LLDB_CONFIGURATION_RELEASE were ever set in the CMake LLDB project.
Also cleaned up a questionable #ifdef in SharingPtr.h, removing all the references to LLDB_CONFIGURATION_BUILD_AND_INTEGRATION in the process.
Differential Revision: https://reviews.llvm.org/D38552
llvm-svn: 314929
Xinliang David Li [Wed, 4 Oct 2017 20:17:55 +0000 (20:17 +0000)]
Recommit r314561 after fixing msan build failure
(trial 2) Incoming val defined by terminator instruction which
also requires bitcasts can not be handled.
llvm-svn: 314928
Guozhi Wei [Wed, 4 Oct 2017 20:14:08 +0000 (20:14 +0000)]
[TargetTransformInfo] Check if function pointer is valid before calling isLoweredToCall
Function isLoweredToCall can only accept non-null function pointer, but a function pointer can be null for indirect function call. So check it before calling isLoweredToCall from getInstructionLatency.
Differential Revision: https://reviews.llvm.org/D38204
llvm-svn: 314927
Sumanth Gundapaneni [Wed, 4 Oct 2017 19:09:29 +0000 (19:09 +0000)]
[Hexagon] Move getHexagonTargetFeatures to Hexagon.cpp (NFC)
Differential Revision: https://reviews.llvm.org/D38548
llvm-svn: 314926
Jeroen Ketema [Wed, 4 Oct 2017 19:07:48 +0000 (19:07 +0000)]
Add vstore_half helpers for ptx
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314925
Rui Ueyama [Wed, 4 Oct 2017 18:39:51 +0000 (18:39 +0000)]
Revert r314810: Use sched_getaffinity instead of std::thread::hardware_concurrency.
This reverts commit r314810 because r314809 was reverted.
llvm-svn: 314924
Jun Bum Lim [Wed, 4 Oct 2017 18:33:52 +0000 (18:33 +0000)]
Recommit : Use the basic cost if a GEP is not used as addressing mode
Recommitting r314517 with the fix for handling ConstantExpr.
Original commit message:
Currently, getGEPCost() returns TCC_FREE whenever a GEP is a legal addressing
mode in the target. However, since it doesn't check its actual users, it will
return FREE even in cases where the GEP cannot be folded away as a part of
actual addressing mode. For example, if an user of the GEP is a call
instruction taking the GEP as a parameter, then the GEP may not be folded in
isel.
llvm-svn: 314923
Daniel Neilson [Wed, 4 Oct 2017 18:19:03 +0000 (18:19 +0000)]
Revert D38481 due to missing cmake check for CPU_COUNT
Summary:
This reverts D38481. The change breaks systems with older versions of glibc. It
injects a use of CPU_COUNT() from sched.h without checking to ensure that the
function exists first.
Reviewers:
Subscribers:
llvm-svn: 314922
Simon Pilgrim [Wed, 4 Oct 2017 18:00:42 +0000 (18:00 +0000)]
[X86][AVX] Improve (i8 bitcast (v8i1 x)) handling for v8i64/v8f64 512-bit vector compare results.
AVX1/AVX2 targets were missing a chance to use vmovmskps for v8f32/v8i32 results for bool vector bitcasts
llvm-svn: 314921
Krzysztof Parzyszek [Wed, 4 Oct 2017 18:00:15 +0000 (18:00 +0000)]
[Hexagon] Add a member Subtarget to HexagonInstrInfo, NFC
llvm-svn: 314920
Hans Wennborg [Wed, 4 Oct 2017 17:54:06 +0000 (17:54 +0000)]
Revert r314886 "[X86] Improvement in CodeGen instruction selection for LEAs (re-applying post required revision changes.)"
It broke the Chromium / SQLite build; see PR34830.
> Summary:
> 1/ Operand folding during complex pattern matching for LEAs has been
> extended, such that it promotes Scale to accommodate similar operand
> appearing in the DAG.
> e.g.
> T1 = A + B
> T2 = T1 + 10
> T3 = T2 + A
> For above DAG rooted at T3, X86AddressMode will no look like
> Base = B , Index = A , Scale = 2 , Disp = 10
>
> 2/ During OptimizeLEAPass down the pipeline factorization is now performed over LEAs
> so that if there is an opportunity then complex LEAs (having 3 operands)
> could be factored out.
> e.g.
> leal 1(%rax,%rcx,1), %rdx
> leal 1(%rax,%rcx,2), %rcx
> will be factored as following
> leal 1(%rax,%rcx,1), %rdx
> leal (%rdx,%rcx) , %edx
>
> 3/ Aggressive operand folding for AM based selection for LEAs is sensitive to loops,
> thus avoiding creation of any complex LEAs within a loop.
>
> Reviewers: lsaba, RKSimon, craig.topper, qcolombet, jmolloy
>
> Reviewed By: lsaba
>
> Subscribers: jmolloy, spatel, igorb, llvm-commits
>
> Differential Revision: https://reviews.llvm.org/D35014
llvm-svn: 314919
Jake Ehrlich [Wed, 4 Oct 2017 17:44:42 +0000 (17:44 +0000)]
[llvm-objcopy] Fix major layout bugs in llvm-objcopy
Somehow a few massive errors slipped though the cracks of testing.
1. The code in Segment::finalize was left over from the old layout
algorithm. In certain situations this would cause very strange issues
with segment layout. For instance in the shift-segments.test case it
would cause the second segment to have the same offset as the first.
2. In debugging this I discovered another issue. Namely section alignment
was not being computed based on Section->Align but instead
Section->Offset which is bizarre and makes no sense. I have no clue how
it worked in the first place. This issue is also fixed
3. Fixing #2 exposed a bug where things were not being written past the end
of the file that technically should have been. This was because in
certain cases (like overlapping-segments) the end of the file wouldn't
always be bumped if the offset could be chosen relative to an existing
segment that already had it's offset chosen. For fully nested segments
this is fine but for overlapping segments this leaves the end of the
file short. So I changed how the offset is bumped when looping though
segments.
Differential Revision: https://reviews.llvm.org/D38436
llvm-svn: 314918
Jakub Kuderski [Wed, 4 Oct 2017 17:32:55 +0000 (17:32 +0000)]
[Dominators] Take fast path when applying <=1 updates
Summary:
This patch teaches `DT.applyUpdates` to take the fast when applying zero or just one update and makes it not run the internal batch updater machinery.
With this patch, it should no longer make sense to have a special check in user's code that checks the update sequence size before applying them, e.g.
```
if (!MyUpdates.empty())
DT.applyUpdates(MyUpdates);
```
or
```
if (MyUpdates.size() == 1)
if (...)
DT.insertEdge(...)
else
DT.deleteEdge(...)
```
Reviewers: dberlin, brzycki, davide, grosser, sanjoy
Reviewed By: dberlin, davide
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38541
llvm-svn: 314917
Simon Pilgrim [Wed, 4 Oct 2017 17:31:28 +0000 (17:31 +0000)]
[X86][SSE] Add support for lowering v8i16 binary shuffles to PACKSS/PACKUS
Missed in D38472
llvm-svn: 314916
Francis Ricci [Wed, 4 Oct 2017 17:30:28 +0000 (17:30 +0000)]
[test] Fix append_path in the empty case
Summary:
normpath() was being called on an empty string and appended to
the environment variable in the case where the environment variable
was unset. This led to ":." being appended to the path, since
normpath() of an empty string is '.', presumably to represent cwd.
Reviewers: zturner, sqlbyme, modocache
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38542
llvm-svn: 314915
Craig Topper [Wed, 4 Oct 2017 17:20:12 +0000 (17:20 +0000)]
[X86] Redefine MOVSS/MOVSD instructions to take VR128 regclass as input instead of FR32/FR64
This patch redefines the MOVSS/MOVSD instructions to take VR128 as its second input. This allows the MOVSS/SD->BLEND commute to work without requiring a COPY to be inserted.
This should fix PR33079
Overall this looks to be an improvement in the generated code. I haven't checked the EXPENSIVE_CHECKS build but I'll do that and update with results.
Differential Revision: https://reviews.llvm.org/D38449
llvm-svn: 314914
Jonas Toth [Wed, 4 Oct 2017 16:49:20 +0000 (16:49 +0000)]
[clang-tidy] Emit note for variable declaration that are later deleted
This patch introduces a note for variable declaration that are later deleted.
Adds FIXME notes for possible automatic type-rewriting positions as well.
Reviewed by aaron.ballman
Differential: https://reviews.llvm.org/D38411
llvm-svn: 314913
Balaram Makam [Wed, 4 Oct 2017 16:45:24 +0000 (16:45 +0000)]
"[ARM] Mark flaky test MachineBranchProb.ll unsupported again for ARM/AArch64"
r314857 changed the CFG that resulted in the flaky test MachineBranchProb.ll to
fail the bots again. Marking it as unsupported for ARM/AArch64 again until we
find the cause.
llvm-svn: 314912
Yonghong Song [Wed, 4 Oct 2017 16:11:52 +0000 (16:11 +0000)]
bpf: fix an insn encoding issue for neg insn
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 314911
Artem Dergachev [Wed, 4 Oct 2017 15:59:40 +0000 (15:59 +0000)]
[analyzer] Fix autodetection of binding types.
In ProgramState::getSVal(Location, Type) API which dereferences a pointer value,
when the optional Type parameter is not supplied and the Location is not typed,
type should have been guessed on a best-effort basis by inspecting the Location
more deeply. However, this never worked; the auto-detected type was instead
a pointer type to the correct type.
Fixed the issue and added various test cases to demonstrate which parts of the
analyzer were affected (uninitialized pointer argument checker, C++ trivial copy
modeling, Google test API modeling checker).
Additionally, autodetected void types are automatically replaced with char,
in order to simplify checker APIs. Which means that if the location is a void
pointer, getSVal() would read the first byte through this pointer
and return its symbolic value.
Fixes pr34305.
Differential Revision: https://reviews.llvm.org/D38358
llvm-svn: 314910
Adam Nemet [Wed, 4 Oct 2017 15:18:11 +0000 (15:18 +0000)]
[OptRemark] Move YAML writing to IR
Before the patch this was in Analysis. Moving it to IR and making it implicit
part of LLVMContext::diagnose allows the full opt-remark facility to be used
outside passes e.g. the pass manager. Jessica is planning to use this to
report function size after each pass. The same could be used for time
reports.
Tested with BUILD_SHARED_LIBS=On.
llvm-svn: 314909
Adam Nemet [Wed, 4 Oct 2017 15:18:07 +0000 (15:18 +0000)]
Also update MachineORE after r314874.
llvm-svn: 314908
Sanjay Patel [Wed, 4 Oct 2017 15:17:25 +0000 (15:17 +0000)]
[InstCombine] add 'exact' variants of all tests; NFC
We can likely remove most of these as redundant in the near future,
but I'm trying to make sure I don't introduce any regressions with D38514.
llvm-svn: 314907
Clement Courbet [Wed, 4 Oct 2017 15:13:52 +0000 (15:13 +0000)]
[NFC] clang-format lib/Transforms/Scalar/MergeICmps.cpp
llvm-svn: 314906
Carlo Bertolli [Wed, 4 Oct 2017 14:12:09 +0000 (14:12 +0000)]
[OpenMP] Initial implementation of teams distribute code generation
https://reviews.llvm.org/D38371
This patch implements codegen for the combined 'teams distribute" OpenMP pragma and adds regression tests for all its clauses.
llvm-svn: 314905
Jonas Hahnfeld [Wed, 4 Oct 2017 13:54:09 +0000 (13:54 +0000)]
[test] Pass in fixed triple for openmp-offload.c
This should fix the test on other architectures.
Related to: https://reviews.llvm.org/D38372
llvm-svn: 314904
Simon Pilgrim [Wed, 4 Oct 2017 13:41:26 +0000 (13:41 +0000)]
[X86][SSE] Early out from ComputeNumSignBitsForTargetNode. NFCI.
Early out from vector shift by immediates that will exceed eltsize - don't bother making an unnecessary ComputeNumSignBits recursive call.
llvm-svn: 314903
Jonas Hahnfeld [Wed, 4 Oct 2017 13:32:59 +0000 (13:32 +0000)]
[OpenMP] Fix passing of -m arguments correctly
The recent fix in D38258 was wrong: getAuxTriple() only returns
non-null values for the CUDA toolchain. That is why the now added
test for PPC and X86 failed.
Differential Revision: https://reviews.llvm.org/D38372
llvm-svn: 314902
Simon Pilgrim [Wed, 4 Oct 2017 13:12:08 +0000 (13:12 +0000)]
[X86][SSE] Add support for lowering unary shuffles to PACKSS/PACKUS
Extension to D38472
llvm-svn: 314901
Michael Kruse [Wed, 4 Oct 2017 12:18:57 +0000 (12:18 +0000)]
[ScopBuilder] Introduce -polly-stmt-granularity option. NFC.
The option is introduced with only one possible value
-polly-stmt-granularity=bb which represents the current behaviour, which
is outlined into the new function buildSequentialBlockStmts().
More options will be added in future commits.
llvm-svn: 314900
George Rimar [Wed, 4 Oct 2017 11:00:30 +0000 (11:00 +0000)]
[gold-plugin] - Fix compilation after LLVM update (r314883). NFC.
llvm-svn: 314899
Dylan McKay [Wed, 4 Oct 2017 10:37:22 +0000 (10:37 +0000)]
[AVR] Implement LPMWRdZ pseudo-instruction's expansion.
FIXME: implementation is mostly copy-pasted from LDWRdPtr, so we should
refactor a bit and unify the two
Patch by Gerdo Erdi.
llvm-svn: 314898
Dylan McKay [Wed, 4 Oct 2017 10:36:07 +0000 (10:36 +0000)]
[AVR] Factor out mayLoad in tablegen patterns
Patch by Gergo Erdi.
llvm-svn: 314897
Dylan McKay [Wed, 4 Oct 2017 10:33:36 +0000 (10:33 +0000)]
[AVR] Elaborate LDWRdPtr into `ld r, X++; ld r+1, X`
Patch by Gergo Erdi.
llvm-svn: 314896
Alexander Kornienko [Wed, 4 Oct 2017 10:24:36 +0000 (10:24 +0000)]
Fix assertion failure in thread safety analysis (PR34800).
Summary:
Fix an assertion failure (http://llvm.org/PR34800) and clean up unused code relevant to the fixed logic.
A bit of context: when `SExprBuilder::translateMemberExpr` is called on a member expression that involves a conversion operator, for example, `til::Project` constructor can't just call `getName()` on it, since the name is not a simple identifier. In order to handle this case I've introduced an optional string to print the member name to. I discovered that the other two `til::Project` constructors are not used, so it was better to delete them instead of ensuring they work correctly with the new logic.
Reviewers: aaron.ballman
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D38458
llvm-svn: 314895
Tobias Grosser [Wed, 4 Oct 2017 10:24:23 +0000 (10:24 +0000)]
[GPGPU] Make sure escaping invariant load hoisted scalars are preserved
We make sure that the final reload of an invariant scalar memory access uses the
same stack slot into which the invariant memory access was stored originally.
Earlier, this was broken as we introduce a new stack slot aside of the preload
stack slot, which remained uninitialized and caused our escaping loads to
contain garbage. This happened due to us clearing the pre-populated values
in EscapeMap after kernel code generation. We address this issue by preserving
the original host values and restoring them after kernel code generation.
EscapeMap is not expected to be used during kernel code generation, hence we
clear it during kernel generation to make sure that any unintended uses are
noticed.
llvm-svn: 314894
Dylan McKay [Wed, 4 Oct 2017 09:51:28 +0000 (09:51 +0000)]
[AVR] Insert JMP for long branches
Previously, on long branches (relative jumps of >4 kB), an assertion
failure was hit, as AVRInstrInfo::insertIndirectBranch was not
implemented. Despite its name, it is called by the branch relaxator
for *all* unconditional jumps.
Patch by Thomas Backman.
llvm-svn: 314891
Dylan McKay [Wed, 4 Oct 2017 09:51:21 +0000 (09:51 +0000)]
[AVR] Fix displacement overflow for LDDW/STDW
In some cases, the code generator attempts to generate instructions such as:
lddw r24, Y+63
which expands to:
ldd r24, Y+63
ldd r25, Y+64 # Oops! This is actually ld r25, Y in the binary
This commit limits the first offset to 62, and thus the second to 63.
It also updates some asserts in AVRExpandPseudoInsts.cpp, including for
INW and OUTW, which appear to be unused.
Patch by Thomas Backman.
llvm-svn: 314890
George Rimar [Wed, 4 Oct 2017 09:46:53 +0000 (09:46 +0000)]
[ELF] - Get rid of precompiled input objects from testcases.
We have verneed1.so, verneed2.so files and verneed.so.sh script
to produce them. They were committed long time ago when LLD
was not yet able to produce some sections for versioning
(".gnu.version_r" I think).
There is no point to have them as binaries anymore. Patch
creates asm inputs instead based on verneed.so.sh content.
Differential revision: https://reviews.llvm.org/D38505
llvm-svn: 314889
Oliver Stannard [Wed, 4 Oct 2017 09:24:54 +0000 (09:24 +0000)]
[ARM] Add diag string for movw/movt immediates in assembly
This adds diagnostics for invalid immediate operands to the MOVW and MOVT
instructions (ARM and Thumb).
Differential revision: https://reviews.llvm.org/D31879
llvm-svn: 314888
Oliver Stannard [Wed, 4 Oct 2017 09:18:07 +0000 (09:18 +0000)]
[ARM, Asm] Change grammar of immediate operand diagnostics
Currently, our diagnostics for assembly operands are not consistent.
Some start with (for example) "immediate operand must be ...",
and some with "operand must be an immediate ...". I think the latter
form is preferable for a few reasons:
* It's unambiguous that it is referring to the expected type of operand, not
the type the user provided. For example, the user could provide an register
operand, and get a message taking about an operand is if it is already an
immediate, just not in the accepted range.
* It allows us to have a consistent style once we add diagnostics for operands
that could take two forms, for example a label or pc-relative memory operand.
Differential revision: https://reviews.llvm.org/D36689
llvm-svn: 314887
Jatin Bhateja [Wed, 4 Oct 2017 09:02:10 +0000 (09:02 +0000)]
[X86] Improvement in CodeGen instruction selection for LEAs (re-applying post required revision changes.)
Summary:
1/ Operand folding during complex pattern matching for LEAs has been
extended, such that it promotes Scale to accommodate similar operand
appearing in the DAG.
e.g.
T1 = A + B
T2 = T1 + 10
T3 = T2 + A
For above DAG rooted at T3, X86AddressMode will no look like
Base = B , Index = A , Scale = 2 , Disp = 10
2/ During OptimizeLEAPass down the pipeline factorization is now performed over LEAs
so that if there is an opportunity then complex LEAs (having 3 operands)
could be factored out.
e.g.
leal 1(%rax,%rcx,1), %rdx
leal 1(%rax,%rcx,2), %rcx
will be factored as following
leal 1(%rax,%rcx,1), %rdx
leal (%rdx,%rcx) , %edx
3/ Aggressive operand folding for AM based selection for LEAs is sensitive to loops,
thus avoiding creation of any complex LEAs within a loop.
Reviewers: lsaba, RKSimon, craig.topper, qcolombet, jmolloy
Reviewed By: lsaba
Subscribers: jmolloy, spatel, igorb, llvm-commits
Differential Revision: https://reviews.llvm.org/D35014
llvm-svn: 314886
Sean Eveson [Wed, 4 Oct 2017 08:54:37 +0000 (08:54 +0000)]
[llvm-cov] Fix showing title when filtering and not outputting to a directory
Differential Revision: https://reviews.llvm.org/D38507
llvm-svn: 314885
George Rimar [Wed, 4 Oct 2017 08:50:34 +0000 (08:50 +0000)]
[ELF] - Update after LLVM r314883 change. NFC.
llvm-svn: 314884
George Rimar [Wed, 4 Oct 2017 08:50:08 +0000 (08:50 +0000)]
[MC] - Don't assert when non-english characters are used.
I found that llvm-mc does not like non-english characters even in comments,
which it tries to tokenize.
Problem happens because of functions like isdigit(), isalnum() which takes
int argument and expects it is not negative.
But at the same time MCParser uses char* to store input buffer poiner, char has signed value,
so it is possible to pass negative value to one of functions from above and
that triggers an assert.
Testcase for demonstration is provided.
To fix the issue helper functions were introduced in StringExtras.h
Differential revision: https://reviews.llvm.org/D38461
llvm-svn: 314883
Mikael Holmen [Wed, 4 Oct 2017 07:42:45 +0000 (07:42 +0000)]
Recommit [UnreachableBlockElim] Use COPY if PHI input is undef
This time invoking llc with "-march=x86-64" in the testcase, so we don't assume
the default target is x86.
Summary:
If we have
%vreg0<def> = PHI %vreg2<undef>, <BB#0>, %vreg3, <BB#2>; GR32:%vreg0,%vreg2,%vreg3
%vreg3<def,tied1> = ADD32ri8 %vreg0<kill,tied0>, 1, %EFLAGS<imp-def>; GR32:%vreg3,%vreg0
then we can't just change %vreg0 into %vreg3, since %vreg2 is actually
undef. We would have to also copy the undef flag to be able to change the
register.
Instead we deal with this case like other cases where we can't just
replace the register: we insert a COPY. The code creating the COPY already
copied all flags from the PHI input, so the undef flag will be transferred
as it should.
Reviewers: kparzysz
Reviewed By: kparzysz
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38235
llvm-svn: 314882
Max Kazantsev [Wed, 4 Oct 2017 06:53:22 +0000 (06:53 +0000)]
[IRCE] Temporarily disable unsigned latch conditions by default
We have found some corner cases connected to range intersection where IRCE makes
a bad thing when the latch condition is unsigned. The fix for that will go as a follow up.
This patch temporarily disables IRCE for unsigned latch conditions until the issue is fixed.
The unsigned latch conditions were introduced to IRCE by rL310027.
Differential Revision: https://reviews.llvm.org/D38529
llvm-svn: 314881
Mikael Holmen [Wed, 4 Oct 2017 06:39:22 +0000 (06:39 +0000)]
Revert r314879 "[UnreachableBlockElim] Use COPY if PHI input is undef"
Build-bots broke on the new testcase. I'll investigate and fix.
llvm-svn: 314880
Mikael Holmen [Wed, 4 Oct 2017 06:06:31 +0000 (06:06 +0000)]
[UnreachableBlockElim] Use COPY if PHI input is undef
Summary:
If we have
%vreg0<def> = PHI %vreg2<undef>, <BB#0>, %vreg3, <BB#2>; GR32:%vreg0,%vreg2,%vreg3
%vreg3<def,tied1> = ADD32ri8 %vreg0<kill,tied0>, 1, %EFLAGS<imp-def>; GR32:%vreg3,%vreg0
then we can't just change %vreg0 into %vreg3, since %vreg2 is actually
undef. We would have to also copy the undef flag to be able to change the
register.
Instead we deal with this case like other cases where we can't just
replace the register: we insert a COPY. The code creating the COPY already
copied all flags from the PHI input, so the undef flag will be transferred
as it should.
Reviewers: kparzysz
Reviewed By: kparzysz
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38235
llvm-svn: 314879
Dean Michael Berris [Wed, 4 Oct 2017 06:02:12 +0000 (06:02 +0000)]
[XRay][compiler-rt] Fix logical failure in BufferQueue::getBuffer()
Follow-up to D38119.
llvm-svn: 314878
Dean Michael Berris [Wed, 4 Oct 2017 05:20:13 +0000 (05:20 +0000)]
[XRay][compiler-rt] Use a hand-written circular buffer in BufferQueue
Summary:
This change removes the dependency on using a std::deque<...> for the
storage of the buffers in the buffer queue. We instead implement a
fixed-size circular buffer that's resilient to exhaustion, and preserves
the semantics of the BufferQueue.
We're moving away from using std::deque<...> for two reasons:
- We want to remove dependencies on the STL for data structures.
- We want the data structure we use to not require re-allocation in
the normal course of operation.
The internal implementation of the buffer queue uses heap-allocated
arrays that are initialized once when the BufferQueue is created, and
re-uses slots in the buffer array as buffers are returned in order.
We also change the lock used in the implementation to a spinlock
instead of a blocking mutex. We reason that since the release operations
now take very little time in the critical section, that a spinlock would
be appropriate.
This change is related to D38073.
This change is a re-submit with the following changes:
- Keeping track of the live buffers with a counter independent of the
pointers keeping track of the extents of the circular buffer.
- Additional documentation of what the data members are meant to
represent.
Reviewers: dblaikie, kpw, pelikan
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38119
llvm-svn: 314877
Martin Storsjo [Wed, 4 Oct 2017 05:12:10 +0000 (05:12 +0000)]
[X86] Fix using the SJLJ jump table on x86_64
The previous version didn't work if the jump table base address didn't
fit in 32 bit, since it was encoded as an immediate offset. And in case
the jump table is encoded as 32 bit label differences, we need to
load and add them to the table base first.
This solves the first half of the issues mentioned in PR34720.
Also fix some of the errors pointed out by -verify-machineinstrs, by
using GR32_NOSPRegClass.
Differential Revision: https://reviews.llvm.org/D38333
llvm-svn: 314876
Martin Pelikan [Wed, 4 Oct 2017 05:12:00 +0000 (05:12 +0000)]
[XRay] [compiler-rt] make sure single threaded programs get traced too
Summary:
When the XRay user calls the API to finish writing the log, the thread
which is calling the API still hasn't finished and therefore won't get
its trace written. Add a test for only the main thread to check this.
Reviewers: dberris
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38493
llvm-svn: 314875
Adam Nemet [Wed, 4 Oct 2017 04:26:23 +0000 (04:26 +0000)]
Move verbosity check for remarks to the diag handler
Test needs some slight adjustment because we no longer check the existence of
BFI but rather that the actual hotness is set on the remark. If entry_count
is not set getBlockProfileCount returns None.
llvm-svn: 314874
Adam Nemet [Wed, 4 Oct 2017 04:25:31 +0000 (04:25 +0000)]
Move verbosity check for opt remarks to the diag handler.
llvm-svn: 314873
Richard Smith [Wed, 4 Oct 2017 01:58:22 +0000 (01:58 +0000)]
We allow implicit function declarations as an extension in all C dialects. Remove OpenCL special case.
llvm-svn: 314872
Richard Smith [Wed, 4 Oct 2017 01:49:22 +0000 (01:49 +0000)]
PR34822: Fix a collection of related bugs with our handling of C89 implicit function declarations.
We were injecting the function into the wrong semantic context, resulting in it
failing to be registered as a global for redeclaration lookup. As a
consequence, we accepted invalid code since r310616.
Fixing that resulted in the "out-of-scope declaration" diagnostic firing a lot
more often. It turned out that warning codepath was non-conforming, because it
did not cause us to inject the implicitly-declared function into the enclosing
block scope. We now only warn if the type of the out-of-scope declaration
doesn't match the type of an implicitly-declared function; in all other cases,
we produce the normal warning for an implicitly-declared function.
llvm-svn: 314871
Tim Shen [Wed, 4 Oct 2017 01:05:34 +0000 (01:05 +0000)]
[FuzzerUtil] Partially revert D38481 on FuzzerUtil
This is because lib/Fuzzer doesn't really depend on llvm infrastucture.
It's not easy to access the llvm hardware_concurrency here.
Differential Reivision: https://reviews.llvm.org/D38481
llvm-svn: 314870
Rui Ueyama [Wed, 4 Oct 2017 00:50:11 +0000 (00:50 +0000)]
Call exitLld() from elf::link.
We used to call exitLld() from a leaf function, Writer::run(), because
we had objects on the stack whose dtors are expensive. Now we no longer
have such objects on the stack, so there's no reason to exist from the
leaf function.
llvm-svn: 314869
Shoaib Meenai [Wed, 4 Oct 2017 00:38:14 +0000 (00:38 +0000)]
[ELF] Fix buildbots
Mark a test as requiring zlib.
llvm-svn: 314868
Rui Ueyama [Wed, 4 Oct 2017 00:21:17 +0000 (00:21 +0000)]
Remove BssSection::reserveSpace().
We no longer call reserveSpace more than once, so it can be merged with
its constructor.
llvm-svn: 314867
Shoaib Meenai [Wed, 4 Oct 2017 00:19:41 +0000 (00:19 +0000)]
[ELF] Decompress debug info sections early
When reporting a symbol conflict, LLD parses the debug info to report
source location information. Sections have not been decompressed at this
point, so if an object file contains zlib compressed debug info, LLD
ends up passing this compressed debug info to the DWARF parser, which
causes debug info parsing failures and can trigger assertions in the
parser (as the test case demonstrates).
Decompress debug sections when constructing the LLDDwarfObj to avoid
this issue. This doesn't handle GNU-style compressed debug info sections
(.zdebug_*), which at present are simply ignored by LLDDwarfObj; those
can be done in a follow-up.
Differential Revision: https://reviews.llvm.org/D38491
llvm-svn: 314866
Erik Pilkington [Wed, 4 Oct 2017 00:18:55 +0000 (00:18 +0000)]
[ExprConstant] Allow constexpr ctor to modify non static data members
Fixes PR19741.
Differential revision: https://reviews.llvm.org/D38483
llvm-svn: 314865
Eric Fiselier [Wed, 4 Oct 2017 00:04:26 +0000 (00:04 +0000)]
Add C++17 explicit deduction guides to std::pair.
This patch adds the newly standardized deduction guides
for std::pair, allowing it to work class template deduction.
llvm-svn: 314864
Adrian Prantl [Tue, 3 Oct 2017 23:46:57 +0000 (23:46 +0000)]
Add a manpage for llvm-dwarfdump.
llvm-svn: 314863
Rafael Espindola [Tue, 3 Oct 2017 23:44:24 +0000 (23:44 +0000)]
Add a note on where to get a lld benchmark.
llvm-svn: 314862
George Karpenkov [Tue, 3 Oct 2017 23:15:35 +0000 (23:15 +0000)]
[Analyzer] Re-apply r314820 with a fix for StringRef lifetime.
Fixes the test failure: temporary is now bound to std::string, tests
fully pass on Linux.
This reverts commit
b36ee0924038e1d95ea74230c62d46e05f80587e.
llvm-svn: 314859
Rui Ueyama [Tue, 3 Oct 2017 23:12:01 +0000 (23:12 +0000)]
Simplify multikey_qsort function.
This function implements the three-way radix quicksort algorithm.
This patch simplifies the implementation by using MutableArrayRef.
llvm-svn: 314858
Balaram Makam [Tue, 3 Oct 2017 22:39:24 +0000 (22:39 +0000)]
[AArch64] Use LateSimplifyCFG after expanding atomic operations.
Summary:
After r308422 we defer optimizations that can destroy loop canonical forms to
LateSimplifyCFG. Running LateSimplifyCFG after expanding atomic operations
can exploit more control-flow opportunities.
Reviewers: mcrosier, t.p.northover, efriedma
Reviewed By: efriedma
Subscribers: aemerson, rengolin, javed.absar, llvm-commits, kristof.beyls
Differential Revision: https://reviews.llvm.org/D38262
llvm-svn: 314857
Leonard Mosescu [Tue, 3 Oct 2017 22:30:02 +0000 (22:30 +0000)]
updating svn:ignore
llvm-svn: 314856
Adrian Prantl [Tue, 3 Oct 2017 22:08:22 +0000 (22:08 +0000)]
llvm-dwarfdump: implement the --regex option in combination with --name.
llvm-svn: 314855
Chris Bieneman [Tue, 3 Oct 2017 21:59:53 +0000 (21:59 +0000)]
[CMake] Minor updates to Apple CMake caches
* Turn off embedded compiler-rt builds in stage1
* Support generating Xcode toolchains from Stage2 build configurations
llvm-svn: 314854
Konstantin Zhuravlyov [Tue, 3 Oct 2017 21:45:01 +0000 (21:45 +0000)]
AMDGPU: Expand setcc for v2f32 and v4f32
llvm-svn: 314853