Dan Gohman [Mon, 2 Dec 2019 19:47:31 +0000 (11:47 -0800)]
[WebAssembly] Find wasm-opt with GetProgramPath
Instead of just searching for wasm-opt in PATH, use GetProgramPath, which
checks the `COMPILER_PATH` environment variable, -B paths, and `PATH`.
Differential Revision: https://reviews.llvm.org/D70780
David Green [Mon, 2 Dec 2019 19:29:50 +0000 (19:29 +0000)]
[AArch64] Attempt to fixup test line. NFC
The test is complaining on some of the builders. This attempts to
adjust the run line to be more line the others in the same folder, using
clang_cc1 as opposed to the driver.
Alexey Bataev [Mon, 2 Dec 2019 19:15:38 +0000 (14:15 -0500)]
[OPENMP]Use cast instead dyn_cast, NFC.
Here the expression is always a DeclRefExpr, no need to use dyn_cast.
Alexey Bataev [Mon, 2 Dec 2019 18:04:30 +0000 (13:04 -0500)]
[OPENMP]Fix PR44133: Emit definitions of used constructors/functions.
Need to fully rebuild the initializer/combiner when instatiating the
declare reduction constrcut to properly emit used functions.
Tyker [Sat, 30 Nov 2019 15:42:33 +0000 (16:42 +0100)]
[clang][modules] Add support for merging lifetime-extended temporaries
Summary: Add support for merging lifetime-extended temporaries
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: xbolva00, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70190
Taewook Oh [Mon, 2 Dec 2019 18:15:22 +0000 (10:15 -0800)]
Reland "
b19ec1eb3d0c [BPI] Improve unreachable/ColdCall heurstics to handle loops."
Summary:
b19ec1eb3d0c has been reverted because of the test failures
with PowerPC targets. This patch addresses the issues from the previous
commit.
Test Plan: ninja check-all. Confirmed that CodeGen/PowerPC/pr36292.ll
and CodeGen/PowerPC/sms-cpy-1.ll pass
Subscribers: llvm-commits
Florian Hahn [Mon, 2 Dec 2019 18:21:07 +0000 (18:21 +0000)]
[VPlan] Move graph traits (NFC).
By defining the graph traits right after the VPBlockBase definitions, we
can make use of them earlier in the file.
Reviewers: hsaito, Ayal, gilr
Reviewed By: gilr
Differential Revision: https://reviews.llvm.org/D70733
Alex Richardson [Mon, 2 Dec 2019 18:18:47 +0000 (18:18 +0000)]
[update_cc_test_checks.py] Use CHECK_RE from common
Summary:
This change modifies the common.CHECK_RE regex to also handle '//'
comment prefixes which allows us to share it between clang and IR tests.
Using the regex from common means that *-SAME lines are also stripped
now. Before this change using the --function-signature flag would result
in -SAME: lines from previous runs not being removed.
Reviewers: MaskRay, jdoerfert
Reviewed By: jdoerfert
Subscribers: jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70890
Julian Lettner [Tue, 26 Feb 2019 06:39:50 +0000 (22:39 -0800)]
[lit] Be more explicit about the state of tests
Tests go through the following stages:
*) discovered
*) filtered
*) executed
Only executed tests have a result (e.g., PASS, FAIL, XFAIL, etc.). See
"result codes" in Test.py.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D70612
Amaury Séchet [Mon, 2 Dec 2019 17:35:59 +0000 (18:35 +0100)]
[DAGCombine] Factor oplist operations. NFC
Fangrui Song [Sat, 23 Nov 2019 08:57:54 +0000 (00:57 -0800)]
[ELF][AArch64] Support R_AARCH64_{CALL26,JUMP26} range extension thunks with addends
Fixes AArch64 part of PR40438
The current range extension thunk framework does not handle a relocation
relative to a STT_SECTION symbol with a non-zero addend, which may be
used by jumps/calls to local functions on some RELA targets (AArch64,
powerpc ELFv1, powerpc64 ELFv2, etc). See PR40438 and the following
code for examples:
// clang -target $target a.cc
// .text.cold may be placed in a separate output section.
// The distance between bar in .text.cold and foo in .text may be larger than 128MiB.
static void foo() {}
__attribute__((section(".text.cold"))) static int bar() { foo(); return
0; }
__attribute__((used)) static int dummy = bar();
This patch makes such thunks with addends work for AArch64. The target
independent part can be reused by PPC in the future.
On REL targets (ARM, MIPS), jumps/calls are not represented as
STT_SECTION + non-zero addend (see
MCELFObjectTargetWriter::needsRelocateWithSymbol), so they don't need
this feature, but we need to make sure this patch does not affect them.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D70637
Sanjay Patel [Mon, 2 Dec 2019 17:10:05 +0000 (12:10 -0500)]
[InstCombine] fix undef propagation for vector urem transform (PR44186)
As described here:
https://bugs.llvm.org/show_bug.cgi?id=44186
The match() code safely allows undef values, but we can't safely
propagate a vector constant that contains an undef to the new
compare instruction.
Amaury Séchet [Mon, 2 Dec 2019 15:30:51 +0000 (16:30 +0100)]
[SelectionDAG] Reduce assumptions made about levels. NFC
stevewan [Mon, 2 Dec 2019 16:28:31 +0000 (11:28 -0500)]
Add AIX assembler support
Summary:
A skeleton of AIX toolchain and system linker support has been introduced in D68340, and this is a follow on patch to it.
This patch adds support to system assembler invocation to the AIX toolchain.
Reviewers: daltenty, hubert.reinterpretcast, jasonliu, Xiangling_L, dlj
Reviewed By: daltenty, hubert.reinterpretcast
Subscribers: wuzish, nemanjai, kbarton, jfb, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69620
Simon Tatham [Mon, 2 Dec 2019 16:17:59 +0000 (16:17 +0000)]
[ARM,MVE] Add intrinsics to deal with predicates.
Summary:
This commit adds the `vpselq` intrinsics which take an MVE predicate
word and select lanes from two vectors; the `vctp` intrinsics which
create a tail predicate word suitable for processing the first m
elements of a vector (e.g. in the last iteration of a loop); and
`vpnot`, which simply complements a predicate word and is just
syntactic sugar for the `~` operator.
The `vctp` ACLE intrinsics are lowered to the IR intrinsics we've
already added (and which D70592 just reorganized). I've filled in the
missing isel rule for VCTP64, and added another set of rules to
generate the predicated forms.
I needed one small tweak in MveEmitter to allow the `unpromoted` type
modifier to apply to predicates as well as integers, so that `vpnot`
doesn't pointlessly convert its input integer to an `<n x i1>` before
complementing it.
Reviewers: ostannard, MarkMurrayARM, dmgreen
Reviewed By: dmgreen
Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D70485
Simon Tatham [Mon, 2 Dec 2019 16:18:24 +0000 (16:18 +0000)]
[ARM,MVE] Rename and clean up VCTP IR intrinsics.
Summary:
D65884 added a set of Arm IR intrinsics for the MVE VCTP instruction,
to use in tail predication. But the 64-bit one doesn't work properly:
its predicate type is `<2 x i1>` / `v2i1`, which isn't a legal MVE
type (due to not having a full set of instructions that manipulate it
usefully). The test of `vctp64` in `basic-tail-pred.ll` goes through
`opt` fine, as the test expects, but if you then feed it to `llc` it
causes a type legality failure at isel time.
The usual workaround we've been using in the rest of the MVE
intrinsics family is to bodge `v2i1` into `v4i1`. So I've adjusted the
`vctp64` IR intrinsic to do that, and completely removed the code (and
test) that uses that intrinsic for 64-bit tail predication. That will
allow me to add isel rules (upcoming in D70485) that actually generate
the VCTP64 instruction.
Also renamed all four of these IR intrinsics so that they have `mve`
in the name, since its absence was confusing.
Reviewers: ostannard, MarkMurrayARM, dmgreen
Reviewed By: MarkMurrayARM
Subscribers: samparker, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70592
Simon Tatham [Mon, 2 Dec 2019 16:18:34 +0000 (16:18 +0000)]
[ARM,MVE] Add an InstCombine rule permitting VPNOT.
Summary:
If a user writing C code using the ACLE MVE intrinsics generates a
predicate and then complements it, then the resulting IR will use the
`pred_v2i` IR intrinsic to turn some `<n x i1>` vector into a 16-bit
integer; complement that integer; and convert back. This will generate
machine code that moves the predicate out of the `P0` register,
complements it in an integer GPR, and moves it back in again.
This InstCombine rule replaces `i2v(~v2i(x))` with a direct complement
of the original predicate vector, which we can already instruction-
select as the VPNOT instruction which complements P0 in place.
Reviewers: ostannard, MarkMurrayARM, dmgreen
Reviewed By: dmgreen
Subscribers: kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70484
Florian Hahn [Mon, 2 Dec 2019 15:46:47 +0000 (15:46 +0000)]
Add contributing info to CONTRIBUTING.md and README.md
As discussed on llvm-dev [1], this patch adds a brief CONTRIBUTING.md to
the top-level of the repo, with a pointer to Contributing.html. This
should make it easier to discover the contributing information and also
be highlighted in the Github UI.
It also updates README.md to link to Contributing.html.
[1] http://lists.llvm.org/pipermail/llvm-dev/2019-November/137141.html
Reviewers: tonic, rnk, jhenderson, meikeb
Reviewed By: rnk, jhenderson, meikeb
Differential Revision: https://reviews.llvm.org/D70743
Florian Hahn [Mon, 2 Dec 2019 15:29:53 +0000 (15:29 +0000)]
[PatternMatch] Add support for matching intrinsics with 5 operands.
Summary: Also adds a test to the pattern matching unit tests.
Reviewers: spatel, craig.topper, RKSimon, majnemer, lebedev.ri
Reviewed By: spatel
Subscribers: merge_guards_bot, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70892
Hideto Ueno [Mon, 2 Dec 2019 13:40:09 +0000 (13:40 +0000)]
[Attributor] Copy or port test cases related to Attributor to` Attributor` test folder
Summary:
This patch moves the test cases related to Attributor to `Transforms/Attributor` folder.
We have used `Transforms/FunctionAttrs` as the primary folder for Attributor test but we need to change testing way now.
For the test cases which I think functionattrs doesn't infer anything something like (willreturn, nosync, value-simplify, h2s ..etc), I moved them with the command `git mv`.
For the test cases in which functoinattrs and attributor are tested, I copied the test to the folder and remove the check only used by functoinattrs.
Reviewers: jdoerfert, sstefan1
Reviewed By: jdoerfert
Subscribers: jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70843
Roman Lebedev [Mon, 2 Dec 2019 15:28:17 +0000 (18:28 +0300)]
Autogenerate test/Analysis/ValueTracking/non-negative-phi-bits.ll test
Forgot to stage this change into
0f22e783a038b6983f0fe161eef6cf2add3a4156 commit.
Sam McCall [Fri, 29 Nov 2019 18:37:48 +0000 (19:37 +0100)]
[clangd] Try harder to find a plausible `clang` as argv0, particularly on Mac.
Summary:
Fixes https://github.com/clangd/clangd/issues/211
Fixes https://github.com/clangd/clangd/issues/178
No tests - this is hard to test, and basically impossible to verify what we want
(this produces compile commands that work on a real mac with recent toolchain)
(Need someone on mac to verify it actually fixes these!)
Reviewers: kbobyrev, ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70863
Clement Courbet [Mon, 2 Dec 2019 13:58:41 +0000 (14:58 +0100)]
[llvm-exegesis] Fix
44b9942898c7.
Summary:
Add missing stack release instructions in
loadImplicitRegAndFinalize.
Reviewers: pengfei, gchatelet
Subscribers: tschuett, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70903
Roman Lebedev [Mon, 2 Dec 2019 14:34:55 +0000 (17:34 +0300)]
[InstCombine] Revert rL341831: relax one-use check in foldICmpAddConstant() (PR44100)
rL341831 moved one-use check higher up, restricting a few folds
that produced a single instruction from two instructions to the case
where the inner instruction would go away.
Original commit message:
> InstCombine: move hasOneUse check to the top of foldICmpAddConstant
>
> There were two combines not covered by the check before now,
> neither of which actually differed from normal in the benefit analysis.
>
> The most recent seems to be because it was just added at the top of the
> function (naturally). The older is from way back in 2008 (r46687)
> when we just didn't put those checks in so routinely, and has been
> diligently maintained since.
From the commit message alone, there doesn't seem to be a
deeper motivation, deeper problem that was trying to solve,
other than 'fixing the wrong one-use check'.
As i have briefly discusses in IRC with Tim, the original motivation
can no longer be recovered, too much time has passed.
However i believe that the original fold was doing the right thing,
we should be performing such a transformation even if the inner `add`
will not go away - that will still unchain the comparison from `add`,
it will no longer need to wait for `add` to compute.
Doing so doesn't seem to break any particular idioms,
as least as far as i can see.
References https://bugs.llvm.org/show_bug.cgi?id=44100
Nemanja Ivanovic [Mon, 2 Dec 2019 14:32:59 +0000 (08:32 -0600)]
[PowerPC] Fix crash in peephole optimization
When converting reg+reg shifts to reg+imm rotates, we neglect to consider the
CodeGenOnly versions of the 32-bit shift mnemonics. This means we produce a
rotate with missing operands which causes a crash.
Committing this fix without review since it is non-controversial that the list
of mnemonics to consider should include the 64-bit aliases for the exact
mnemonics.
Fixes PR44183.
Victor Campos [Mon, 2 Dec 2019 12:13:04 +0000 (12:13 +0000)]
[ARM][AArch64] Complex addition Neon intrinsics for Armv8.3-A
Summary:
Add support for vcadd_* family of intrinsics. This set of intrinsics is
available in Armv8.3-A.
The fp16 versions require the FP16 extension, which has been available
(opt-in) since Armv8.2-A.
Reviewers: t.p.northover
Reviewed By: t.p.northover
Subscribers: t.p.northover, kristof.beyls, hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D70862
Sanjay Patel [Mon, 2 Dec 2019 14:21:59 +0000 (09:21 -0500)]
[InstCombine] fold copysign with constant sign argument to (fneg+)fabs
If the sign of the sign argument is known (this could be extended to use ValueTracking),
then we can use fneg+fabs to clear/set the sign bit of the magnitude argument.
http://llvm.org/docs/LangRef.html#llvm-copysign-intrinsic
This transform is already done in DAGCombiner, but we can do it sooner in IR as
suggested in PR44153:
https://bugs.llvm.org/show_bug.cgi?id=44153
We have effectively no analysis for copysign in IR, so we are taking the unusual step
of increasing the number of IR instructions for the negative constant case.
Differential Revision: https://reviews.llvm.org/D70792
Sven van Haastregt [Mon, 2 Dec 2019 14:20:15 +0000 (14:20 +0000)]
[OpenCL] Fix address space for implicit conversion (PR43145)
Clang was creating a DerivedToBase ImplicitCastExpr that was also
casting between address spaces as part of the second step in the
standard conversion sequence. Defer the address space conversion to
the third step in the sequence instead, such that we get a separate
ImplicitCastExpr for the address space conversion.
Differential Revision: https://reviews.llvm.org/D70605
Raphael Isemann [Mon, 2 Dec 2019 13:34:51 +0000 (14:34 +0100)]
[lldb][NFC] Don't calculate member indices in DWARFASTParserClang::ParseChildMembers
We keep counting members and then don't do anything with the computed result.
Raphael Isemann [Sat, 30 Nov 2019 14:30:08 +0000 (15:30 +0100)]
[lldb][NFC] Use raw_ostream instead of Stream in Baton::GetDescription
Removing raw_ostream here is getting us closer to removing LLDB's Stream
class.
Wang, Pengfei [Mon, 2 Dec 2019 11:39:16 +0000 (19:39 +0800)]
[X86] Add initialization of FPCW in llvm-exegesis
Summary: This is a following up to D70874. It adds the initialization of FPCW in llvm-exegesis.
Reviewers: craig.topper, RKSimon, courbet, gchatelet
Subscribers: tschuett, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70891
Georgii Rymar [Thu, 28 Nov 2019 11:12:09 +0000 (14:12 +0300)]
[llvm-readobj/llvm-readelf] - Simplify the code that dumps versions.
After changes introduced in D70495 and D70826 its now possible
to significantly simplify the code we have.
This also fixes an issue: previous code assumed that version strings
should always be read from the dynamic string table. While it is
normally true, the string table should be taken from the corresponding
sh_link field.
Differential revision: https://reviews.llvm.org/D70855
Tim Renouf [Wed, 27 Nov 2019 15:16:59 +0000 (15:16 +0000)]
AMDGPU: Fixed indeterminate map iteration in SIPeepholeSDWA
Differential Revision: https://reviews.llvm.org/D70783
Change-Id: Ic26f915a4acb4c00ecefa9d09d7c24cec370ed06
Raphael Isemann [Mon, 2 Dec 2019 11:44:55 +0000 (12:44 +0100)]
[lldb][NFC] Make Stream's IndentLevel an unsigned integers.
We expect it to be always positive values and LLVM/Clang's IndentLevel
values are already unsigned integers, so we should do the same.
Mark Murray [Thu, 28 Nov 2019 16:38:01 +0000 (16:38 +0000)]
[ARM][MVE][Intrinsics] Add VMINQ/VMAXQ/VMINNMQ/VMAXNMQ intrinsics.
Summary: Add VMINQ/VMAXQ/VMINNMQ/VMAXNMQ intrinsics and their predicated versions. Add unit tests.
Subscribers: kristof.beyls, hiraditya, dmgreen, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D70829
Alex Richardson [Mon, 2 Dec 2019 10:53:57 +0000 (10:53 +0000)]
[update_cc_test_checks.py] Handle extern "C" and namespaces
Summary:
My change to use the clang AST JSON dump did not handle functions declared
inside scopes other than the root TranslationUnitDecl. After this change
update_cc_test_checks.py also works for C++ test cases that use extern "C"
and namespaces.
Reviewers: MaskRay
Reviewed By: MaskRay
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70389
Alex Richardson [Mon, 2 Dec 2019 10:50:23 +0000 (10:50 +0000)]
[UpdateTestChecks] Share the code to parse RUN: lines between all scripts
Summary:
This commit also introduces a common.debug() function to avoid many
`if args.verbose:` statements. Depends on D70428.
Reviewers: xbolva00, MaskRay, jdoerfert
Reviewed By: MaskRay
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70432
Raphael Isemann [Mon, 2 Dec 2019 10:08:10 +0000 (11:08 +0100)]
[lldb][NFC] Add 'breakpoint command list' test
The command has zero test coverage and I'll have to touch the
code formatting the output commands, so let's start by adding a
test for it.
David Green [Mon, 2 Dec 2019 10:29:01 +0000 (10:29 +0000)]
[ARM] Remove VHADD patterns
These instructions do not work quite like I expected them to. They
perform the addition and then shift in a higher precision integer, so do
not match up with the patterns that we added.
For example with s8s, adding 100 and 100 should wrap leaving the shift
to work on a negative number. VHADD will instead do the arithmetic in
higher precision, giving 100 overall. The vhadd gives a "better" result,
but not one that matches up with the input.
I am just removing the patterns here. We might be able to re-add them in
the future by checking for wrap flags or changing bitwidths. But for the
moment just remove them to remove the problem cases.
Wang, Pengfei [Sun, 1 Dec 2019 05:35:53 +0000 (13:35 +0800)]
[X86] Add initialization of MXCSR in llvm-exegesis
Summary: This patch is used to initialize the new added register MXCSR.
Reviewers: craig.topper, RKSimon
Subscribers: tschuett, courbet, llvm-commits, LiuChen3
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70874
Bjorn Pettersson [Thu, 28 Nov 2019 22:18:28 +0000 (23:18 +0100)]
[InstCombine] Fix big-endian miscompile of (bitcast (zext/trunc (bitcast)))
Summary:
optimizeVectorResize is rewriting patterns like:
%1 = bitcast vector %src to integer
%2 = trunc/zext %1
%dst = bitcast %2 to vector
Since bitcasting between integer an vector types gives
different integer values depending on endianness, we need
to take endianness into account. As it happens the old
implementation only produced the correct result for little
endian targets.
Fixes: https://bugs.llvm.org/show_bug.cgi?id=44178
Reviewers: spatel, lattner, lebedev.ri
Reviewed By: spatel, lebedev.ri
Subscribers: lebedev.ri, hiraditya, uabelho, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70844
Georgii Rymar [Fri, 29 Nov 2019 08:57:13 +0000 (11:57 +0300)]
[llvm-readelf/llvm-readobj] - Check the version of SHT_GNU_verneed section entries.
It is a follow-up for D70826 and it is similar to D70810.
SHT_GNU_verneed contains the following fields:
`vn_version`: Version of structure. This value is currently set to 1, and will be reset
if the versioning implementation is incompatibly altered.
(https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html)
We should check it for correctness.
Differential revision: https://reviews.llvm.org/D70842
Lang Hames [Mon, 2 Dec 2019 09:45:49 +0000 (01:45 -0800)]
[ORC] Add a runAsMain utility function to ExecutionUtils.
The runAsMain function takes a pointer to a function with a standard C main
signature, int(*)(int, char*[]), and invokes it using the given arguments and
program name. The arguments are copied into writable temporary storage as
required by the C and C++ specifications, so runAsMain safe to use when calling
main functions that modify their arguments in-place.
This patch also uses the new runAsMain function to replace hand-rolled versions
in lli, llvm-jitlink, and the SpeculativeJIT example.
Lang Hames [Mon, 2 Dec 2019 09:40:54 +0000 (01:40 -0800)]
[ExecutionEngine] Add a jitTargetAddressToFunction utility function.
jitTargetAddressToFunction takes a JITTargetAddress and returns a pointer of
the given function pointer type suitable for calling to invoke the function
at the target address.
jitTargetAddressToFunction currently behaves the same as
jitTargetAddressToPointer, but in the near future will be updated to perform
pointer signing on architectures that require it (e.g. arm64e). For this
reason it should always be preferred when generating callable pointers for
JIT'd functions.
Lang Hames [Sun, 1 Dec 2019 23:51:37 +0000 (15:51 -0800)]
[Orc] Add setters for target options and features to JITTargetMachineBuilder.
Also remove redundant feature initialization steps from the detectHost method.
Haojian Wu [Fri, 29 Nov 2019 13:58:44 +0000 (14:58 +0100)]
[clangd] Fix a regression issue in local rename.
Summary:
The regression is that we can't rename symbols in annonymous
namespaces.
Reviewers: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70853
Georgii Rymar [Thu, 28 Nov 2019 09:19:50 +0000 (12:19 +0300)]
[llvm-readobj/llvm-readelf] - Reimplement dumping of the SHT_GNU_verneed section.
This is similar to D70495, but for SHT_GNU_verneed section.
It solves the same problems: different implementations, lack of error reporting
and no test coverage.
DIfferential revision: https://reviews.llvm.org/D70826
Anton Afanasyev [Mon, 2 Dec 2019 07:07:55 +0000 (10:07 +0300)]
[NFC] Precommit test showing SROA loses `!tbaa.struct` metadata
This issue impacts llvm.org/pr42022
Adam Balogh [Fri, 29 Nov 2019 12:30:26 +0000 (13:30 +0100)]
[Clang-Tidy] Quick fix for bug in bugprone-macro-parentheses 43804
Applying parentheses for statement leads to compilation error. Bug
[[ 43804 | https://bugs.llvm.org/show_bug.cgi?id=43804 ]] is a
compilation error suggested by a wrong fix of this checker. This
patch is a quick fix for this issue.
Differential Revision: https://reviews.llvm.org/D70850
Matt Arsenault [Thu, 21 Nov 2019 05:54:44 +0000 (11:24 +0530)]
Fix broken comment phrasing and indentation
Austin Kerbow [Wed, 27 Nov 2019 23:07:56 +0000 (15:07 -0800)]
AMDGPU/GlobalISel: Add AGPR bank and RegBankSelect mfma intrinsics
Differential Revision: https://reviews.llvm.org/D70871
Daniil Suchkov [Tue, 19 Nov 2019 07:16:39 +0000 (14:16 +0700)]
[SCEV] Make SCEV verification available from command line with new PM
New pass manager doesn't use verifyAnalysis, so currently there is no
way to call SCEV verification from command line when new PM is used.
This patch adds a pass that allows you to do that.
Reviewers: reames, fhahn, sanjoy.google, nikic
Reviewed By: fhahn
Subscribers: hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70423
Florian Hahn [Sun, 1 Dec 2019 22:19:05 +0000 (22:19 +0000)]
Revert "[Examples] Add IRTransformations directory to examples."
This breaks LLVMExports.cmake in some build configurations.
PR44197
This reverts commits
ceb72d07b004af9c428c4a3c73a98ea97d49a713
7d0b1d77b3d4d47df477519fd1bf099b3df6f899.
Tyker [Sun, 1 Dec 2019 21:38:31 +0000 (22:38 +0100)]
Revert "[clang][modules] Add support for merging lifetime-extended temporaries"
This reverts commit
a3cbe1a202df6ec8e23bd55e14db254e4bc33021.
Tyker [Sat, 30 Nov 2019 15:42:33 +0000 (16:42 +0100)]
[clang][modules] Add support for merging lifetime-extended temporaries
Summary: Add support for merging lifetime-extended temporaries
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: xbolva00, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70190
Craig Topper [Sun, 1 Dec 2019 05:53:28 +0000 (21:53 -0800)]
[X86][InstCombine] Move non-X86 specific instcombine test from test/CodeGen/X86/ to test/Transforms/InstCombine/
Craig Topper [Sun, 1 Dec 2019 05:47:41 +0000 (21:47 -0800)]
[X86][InstCombine] Move instcombine test from test/CodeGen/X86 to test/Transforms/InstCombine/ and replace grep with FileCheck
Michał Górny [Sat, 30 Nov 2019 14:13:56 +0000 (15:13 +0100)]
[libunwind] Emit dependent libraries only when detected by CMake
996e62eef75 added Linux-specific dependent libraries to libunwind
sources. As a result, building libunwind with modern LLD on *BSD
started failing due to trying to link libdl. Instead, add those
libraries only if they were detected by CMake.
While technically we could create a long list of systems that need -ldl
and -lpthread, maintaining a duplicate list makes little sense when
CMake needs to detect it for non-LLD systems anyway. Remove existing
system exceptions since they should be covered by the CMake check
anyway.
Remove -D_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA since it is no longer
explicitly needed, if we make the library-specific defines dependent
on presence of this pragma support.
Differential Revision: https://reviews.llvm.org/D70868
Nuno Lopes [Sun, 1 Dec 2019 15:16:31 +0000 (15:16 +0000)]
remove UB from test by making GV alignment explicit
Tyker [Sun, 1 Dec 2019 10:58:14 +0000 (11:58 +0100)]
Revert "[clang][modules] Add support for merging lifetime-extended temporaries"
This reverts commit
85c74384778909789389b9012a75cfcca7964a28.
Tyker [Sat, 30 Nov 2019 15:42:33 +0000 (16:42 +0100)]
[clang][modules] Add support for merging lifetime-extended temporaries
Summary: Add support for merging lifetime-extended temporaries
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: xbolva00, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70190
Brian Gesiak [Sat, 30 Nov 2019 20:36:35 +0000 (15:36 -0500)]
[Format] Add format check for coroutine keywords with negative numbers
Summary:
As a followup to D69144, this diff fixes the coroutine keyword spacing
for co_yield / co_returning negative numbers.
Reviewers: modocache, sammccall, Quuxplusone
Reviewed By: modocache
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69180
Patch by Jonathan Thomas (jonathoma)!
Craig Topper [Sat, 30 Nov 2019 19:12:07 +0000 (11:12 -0800)]
[X86] Add floating point execution domain to comi/ucomi/cvtss2si/cvtsd2si/cvttss2si/cvttsd2si/cvtsi2ss/cvtsi2sd instructions.
David Green [Sat, 30 Nov 2019 16:39:29 +0000 (16:39 +0000)]
[InstCombine] Expand usub_sat patterns to handle constants
The constants come through as add %x, -C, not a sub as would be
expected. They need some extra matchers to canonicalise them towards
usub_sat.
Differential Revision: https://reviews.llvm.org/D69514
David Green [Sat, 30 Nov 2019 14:20:55 +0000 (14:20 +0000)]
[InstCombine] Adjust usub_sat fold one use checks
This adjusts the one use checks in the the usub_sat fold code to not
increase instruction count, but otherwise do the fold. Reviewed as a
part of D69514.
David Green [Sat, 30 Nov 2019 14:14:55 +0000 (14:14 +0000)]
[InstCombine] More usub_sat tests. NFC.
Tyker [Sat, 30 Nov 2019 16:52:26 +0000 (17:52 +0100)]
Revert "[clang][modules] Add support for merging lifetime-extended temporaries"
This reverts commit
3c7f6b439699a9cbbc0ac8d288cc70aff357446b.
Tyker [Sat, 30 Nov 2019 15:42:33 +0000 (16:42 +0100)]
[clang][modules] Add support for merging lifetime-extended temporaries
Summary: Add support for merging lifetime-extended temporaries
Reviewers: rsmith
Reviewed By: rsmith
Subscribers: xbolva00, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70190
Hans Wennborg [Sat, 30 Nov 2019 13:20:11 +0000 (14:20 +0100)]
Revert
651f07908a1 "[AArch64] Don't combine callee-save and local stack adjustment when optimizing for size"
This caused asserts (and perhaps also miscompiles) while building for Windows
on AArch64. See the discussion on D68530 for details and reproducer.
Reverting until this can be investigated and fixed.
> For arm64, D18619 introduced the ability to combine bumping the stack pointer
> upfront in case it needs to be bumped for both the callee-save area as well as
> the local stack area.
>
> That diff already remarks that "This change can cause an increase in
> instructions", but argues that even when that happens, it should be still be a
> performance benefit because the number of micro-ops is reduced.
>
> We have observed that this code-size increase can be significant in practice.
> This diff disables combining stack bumping for methods that are marked as
> optimize-for-size.
>
> Example of a prologue with the behavior before this diff (combining stack bumping when possible):
> sub sp, sp, #0x40
> stp d9, d8, [sp, #0x10]
> stp x20, x19, [sp, #0x20]
> stp x29, x30, [sp, #0x30]
> add x29, sp, #0x30
> [... compute x8 somehow ...]
> stp x0, x8, [sp]
>
> And after this diff, if the method is marked as optimize-for-size:
> stp d9, d8, [sp, #-0x30]!
> stp x20, x19, [sp, #0x10]
> stp x29, x30, [sp, #0x20]
> add x29, sp, #0x20
> [... compute x8 somehow ...]
> stp x0, x8, [sp, #-0x10]!
>
> Note that without combining the stack bump there are two auto-decrements,
> nicely folded into the stp instructions, whereas otherwise there is a single
> sub sp, ... instruction, but not folded.
>
> Patch by Nikolai Tillmann!
>
> Differential Revision: https://reviews.llvm.org/D68530
Dmitri Gribenko [Sat, 30 Nov 2019 12:31:16 +0000 (13:31 +0100)]
Updated the OCaml/bitwriter.ml test for OCaml 4.06+
Since OCaml 4.02 (released in 2014), strings and bytes are different
types, but up until OCaml 4.06, the compiler defaulted to a
compatibility mode "unsafe-string". OCaml 4.06 flips the default to
"safe-string", breaking the test.
This change should be compatible with OCaml 4.02+, but is only truly
necessary for OCaml 4.06+.
For more information, see:
https://caml.inria.fr/pub/docs/manual-ocaml/libref/String.html
https://ocaml.org/releases/4.02.html
Hans Wennborg [Sat, 30 Nov 2019 12:23:49 +0000 (13:23 +0100)]
Fix a typo.
Sam McCall [Fri, 29 Nov 2019 18:59:02 +0000 (19:59 +0100)]
Revert "[clangd] Rethink how SelectionTree deals with macros and #includes."
This reverts commit
19daa21f841ad45290c923689ee3d25198651a4c.
It causes a bunch of failures on a bot that I've been unable to
reproduce so far:
http://45.33.8.238/mac/3308/step_7.txt
Sean Fertile [Fri, 29 Nov 2019 17:44:56 +0000 (12:44 -0500)]
[PowerPC][AIX] Add support for lowering int/float/double formal arguments.
This patch adds LowerFormalArguments_AIX, support is added for lowering
int, float, and double formal arguments into general purpose and
floating point registers only.
The aix calling convention testcase have been redone to test for caller
and callee functionality in the same lit test.
Patch by Zarko Todorovski!
Differential Revision: https://reviews.llvm.org/D69578
Carey Williams [Fri, 29 Nov 2019 17:01:05 +0000 (17:01 +0000)]
Revert "[ARM] Allocatable Global Register Variables for ARM"
This reverts commit
2d739f98d8a53e38bf9faa88cdb6b0c2a363fb77.
Carey Williams [Fri, 29 Nov 2019 17:00:55 +0000 (17:00 +0000)]
Revert "[NFC] Fix test reserve_global_reg.ll after 2d739f9"
This reverts commit
aea7578fade2563cb5ea60548914667b515c457a.
Alexandre Ganea [Fri, 29 Nov 2019 16:28:49 +0000 (11:28 -0500)]
On Windows, fix fuse-ld.c test when lld is provided explictly in -DCMAKE_LINKER
Alexandre Ganea [Fri, 29 Nov 2019 15:52:13 +0000 (10:52 -0500)]
[CIndex] Fix annotate-deep-statements test when using a Debug build
Differential Revision: https://reviews.llvm.org/D70149
Sam McCall [Wed, 20 Nov 2019 22:25:17 +0000 (23:25 +0100)]
[clangd] Rethink how SelectionTree deals with macros and #includes.
Summary:
The exclusive-claim model is successful at resolving conflicts over tokens
between parent/child or siblings. However claims at the spelled-token
level do the wrong thing for macro expansions, where siblings can be
equally associated with the macro invocation.
Moreover, any model that only uses the endpoints in a range can fail when
a macro invocation occurs inside the node.
To address this, we use the existing TokenBuffer in more depth.
Claims are expressed in terms of expanded tokens, so there is no need to worry
about macros, includes etc.
Once we know which expanded tokens were claimed, they are mapped onto
spelled tokens for hit-testing.
This mapping is fairly flexible, currently the handling of macros is
pretty simple (map macro args onto spellings, other macro expansions onto the
macro name token).
This mapping is in principle token-by-token for correctness (though
there's some batching for performance).
The aggregation of the selection enum is now more principled as we need to be
able to aggregate several hit-test results together.
For simplicity i removed the ability to determine selectedness of TUDecl.
(That was originally implemented in
90a5bf92ff97b1, but doesn't seem to be very
important or worth the complexity any longer).
The expandedTokens(SourceLocation) helper could be added locally, but seems to
make sense on TokenBuffer.
Fixes https://github.com/clangd/clangd/issues/202
Fixes https://github.com/clangd/clangd/issues/126
Reviewers: hokein
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits, ilya-biryukov
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70512
Martin Storsjö [Tue, 15 Oct 2019 21:08:28 +0000 (00:08 +0300)]
[LLDB] [ARM] Use r11 as frame pointer on Windows on ARM
Extend EmulateMOVRdRm to identify "mov r11, sp" in thumb mode as
setting the frame pointer, if r11 is the frame pointer register.
Differential Revision: https://reviews.llvm.org/D70797
Raphael Isemann [Fri, 29 Nov 2019 13:08:01 +0000 (14:08 +0100)]
[lldb][NFC] Remove unused ClangASTContext::GetBasicType(ConstString)
Raphael Isemann [Fri, 29 Nov 2019 12:43:23 +0000 (13:43 +0100)]
[lldb][NFC] Remove ClangASTContext::GetBuiltinTypeForEncodingAndBitSize overload
Raphael Isemann [Fri, 29 Nov 2019 12:02:41 +0000 (13:02 +0100)]
[lldb][NFC] Explicitly ask for a ClangASTContext in ClangASTSource
ClangASTSource currently takes a clang::ASTContext and keeps that
around, but a lot of LLDB's functionality for doing operations
on a clang::ASTContext is in its ClangASTContext twin class. We
currently constantly recompute the respective ClangASTContext
from the clang::ASTContext while we instead could just pass and
store a ClangASTContext in the ClangASTSource. This also allows
us to get rid of a bunch of unreachable error checking for cases
where recomputation fails for some reason.
Bjorn Pettersson [Fri, 29 Nov 2019 12:24:13 +0000 (13:24 +0100)]
[InstCombine] Run the cast.ll test a twice, now also testing little endian. NFC
Some tests in test/Transforms/InstCombine/cast.ll depend on
endianness. Added a second run line to run the tests with both
big and little endian. In the past we only compiled for big
endian, and then it was hard to see if any big endian bugfixes
would impact the little endian result etc.
Raphael Isemann [Fri, 29 Nov 2019 11:40:19 +0000 (12:40 +0100)]
[lldb][NFC] Early exit in ClangASTContext::CreateInstance
Pavel Labath [Fri, 29 Nov 2019 11:48:25 +0000 (12:48 +0100)]
[lldb] Fix windows build for 38870af
Raphael Isemann [Fri, 29 Nov 2019 11:26:33 +0000 (12:26 +0100)]
[lldb][NFC] Simplify regex_chars in CommandCompletions
Raphael Isemann [Fri, 29 Nov 2019 11:05:47 +0000 (12:05 +0100)]
[lldb][NFC] Remove dead logging code from DWARFASTParserClang::CompleteRecordType
This code is behind a `if (log)` that is always a nullptr as the initializer
was commented out. One could uncomment the initializer code, but then this logging
code just leads to a deadlock as it tries to aquire the module lock.
This removes the logging code until I get this working again.
Sam McCall [Fri, 29 Nov 2019 11:05:00 +0000 (12:05 +0100)]
[clangd] Fix 407ac2e, which was broken and committed too soon
Pavel Labath [Thu, 28 Nov 2019 15:22:44 +0000 (16:22 +0100)]
[lldb] Remove FileSpec->CompileUnit inheritance
Summary:
CompileUnit is a complicated class. Having it be implicitly convertible
to a FileSpec makes reasoning about it even harder.
This patch replaces the inheritance by a simple member and an accessor
function. This avoid the need for casting in places where one needed to
force a CompileUnit to be treated as a FileSpec, and does not add much
verbosity elsewhere.
It also fixes a bug where we were wrongly comparing CompileUnit& and a
CompileUnit*, which compiled due to a combination of this inheritance
and the FileSpec*->FileSpec implicit constructor.
Reviewers: teemperor, JDevlieghere, jdoerfert
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D70827
Victor Campos [Tue, 19 Nov 2019 09:55:16 +0000 (09:55 +0000)]
[ARM] Fix instruction selection for ARMISD::CMOV with f16 type
Summary:
In the cases where the CMOV (f16) SDNode is used with condition codes
LT, LE, VC or NE, it is successfully selected into a VSEL instruction.
In the remaining cases, however, instruction selection fails since VSEL
does not support other condition codes.
This patch handles such cases by using the single-precision version of
the VMOV instruction.
Reviewers: ostannard, dmgreen
Reviewed By: dmgreen
Subscribers: kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70667
Ilya Biryukov [Fri, 29 Nov 2019 10:32:58 +0000 (11:32 +0100)]
[Syntax] Build SimpleDeclaration node that groups multiple declarators
Summary:
Also remove the temporary TopLevelDeclaration node and add
UnknownDeclaration to represent other unknown nodes.
See the follow-up change for building more top-level declarations.
Adding declarators is also pretty involved and will be done in another
follow-up patch.
Reviewers: gribozavr2
Reviewed By: gribozavr2
Subscribers: merge_guards_bot, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70787
Raphael Isemann [Fri, 29 Nov 2019 10:34:18 +0000 (11:34 +0100)]
[lldb][NFC] Fix header guard comment in ThreadSafeDenseMap.h
Ilya Biryukov [Fri, 29 Nov 2019 10:10:01 +0000 (11:10 +0100)]
[AST] Remove unused and undefined `TypeLoc::IgnoreMacroDefinitions` function. NFC
Looks like an accidental leftover from the older version of the code.
Sam McCall [Thu, 28 Nov 2019 18:22:50 +0000 (19:22 +0100)]
[clangd] Log cc1 args at verbose level.
Summary: This will help debugging driver issues.
Reviewers: kbobyrev
Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70832
Haojian Wu [Thu, 28 Nov 2019 15:48:49 +0000 (16:48 +0100)]
[clangd] Correct the file path in Edit::replacements when generating the rename edit.
Summary:
The file path was set to the file content previously, and it isn't
covered by normal clangd & unittest code path (as we only uses the
offset, length, replacement text).
Reviewers: ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D70828
Ilya Biryukov [Fri, 29 Nov 2019 08:48:00 +0000 (09:48 +0100)]
[Syntax] Add a comment explaining the pointer keys in std::map<Token*, ...>. NFC
Ilya Biryukov [Fri, 29 Nov 2019 08:44:25 +0000 (09:44 +0100)]
[Syntax] Remove unused parameter from `TreeBuilder::markChildToken`. NFC
Georgii Rymar [Fri, 29 Nov 2019 08:38:27 +0000 (11:38 +0300)]
[llvm-readelf][test] - Update comment in elf-verdef-invalid.test. NFC.
It was suggested to change it during review of D70810,
but I've forgotten to update it before commit.
Georgii Rymar [Thu, 28 Nov 2019 10:20:25 +0000 (13:20 +0300)]
[llvm-readelf/llvm-readobj] - Check version of SHT_GNU_verdef section entries when dumping.
Elfxx_Verdef contains the following field:
vd_version
Version revision. This field shall be set to 1.
(https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html)
Our code should check the struct version for correctness. This patch does that.
(This will help to simplify or eliminate ELFDumper<ELFT>::LoadVersionDefs() which
has it's own logic to parse version definitions for no reason. It checks the
struct version currently).
Differential revision: https://reviews.llvm.org/D70810
David Zarzycki [Fri, 29 Nov 2019 07:22:56 +0000 (09:22 +0200)]
[libcxx] Add -Wno-deprecated-copy to the test config