Commit Graph

338630 Commits

Author SHA1 Message Date
Sam McCall f06f439fad [clangd] targetDecl() returns only NamedDecls.
Summary:
While it's perfectly reasonable for non-named decls such as
static_assert to resolve to themselves:
 - nothing else ever resolves to them
 - features based on references (hover, highlight, find refs etc) tend
   to be uninteresting where only trivial references are possible
 - returning NamedDecl is a more convenient API (we cast to it in many places)
 - this aligns closer to findExplicitReferences/explicitReferenceTargets

This fixes a crash in explicitReferenceTargets: if the target is a
non-named decl then there's an invalid unchecked cast to NamedDecl.

In practice this means when hovering over e.g. a static_assert:
 - before ac3f9e4842, we would show a (boring) hover card
 - after ac3f9e4842, we would crash
 - after this patch, we will show nothing

Reviewers: kadircet, ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72163
2020-01-03 18:18:40 +01:00
Alexey Bataev add743b434 [OPENMP]Fix crash on error message for declare reduction.
If the qualified reduction name is specified and not found, the compiler
may crash because of not specified parameter.
2020-01-03 12:13:03 -05:00
Nico Weber ba3484c051 [clang-format/java] format multiple qualified annotations on one declaration better
Before:
    class Foo {
      @CommandLineFlags
          .Add
          @Features.foo
          public void test() {}
    }

Now:
    class Foo {
        @Features.foo
        @CommandLineFlags.Add
        public void test() { }
    }

See also https://crbug.com/1034115
2020-01-03 12:11:44 -05:00
Kelvin Li 427ffa2cdb [OpenMP] diagnose zero-length array section in the depend clause
The OpenMP specification disallows having zero-length array
sections in the depend clause (OpenMP 5.0 2.17.11).

Differential Revision: https://reviews.llvm.org/D71969
2020-01-03 11:55:37 -05:00
Johannes Doerfert d2d2fb19f7 [Attributor][FIX] Allow dead users of rewritten function
If we replace a function with a new one because we rewrite the
signature, dead users may still refer to the old version. With this
patch we reuse the code that deals with dead functions, which the old
versions are, to avoid problems.
2020-01-03 10:43:40 -06:00
Johannes Doerfert 6b9ee2d6cd [Attributor][NFC] Unify the way we delete dead functions 2020-01-03 10:43:40 -06:00
Johannes Doerfert c90681b681 [Attributor][FIX] Don't crash on ptr2int/int2ptr instructions
An integer isn't allowed in getAlignmentForValue so we need to stop at a
ptr2int instruction during exploration.
2020-01-03 10:43:40 -06:00
Johannes Doerfert 412a0101a9 [Attributor][FIX] Do not derive nonnull and dereferenceable w/o access
An inbounds GEP results in poison if the value is not "inbounds", not in
UB. We accidentally derived nonnull and dereferenceable from these
inbounds GEPs even in the absence of accesses that would make the poison
to UB.
2020-01-03 10:43:40 -06:00
Johannes Doerfert a4b3588ba2 [Attributor][FIX] Return CHANGED once a pessimistic fixpoint is reached. 2020-01-03 10:43:40 -06:00
Tyker b4b904e19b [Diagnostic] Fixed add ftabstop to -Wmisleading-indentation
Summary:
this allow much better support of codebases like the linux kernel that mix tabs and spaces.

-ftabstop=//Width// allow specifying how large tabs are considered to be.

Reviewers: xbolva00, aaron.ballman, rsmith

Reviewed By: aaron.ballman

Subscribers: mstorsjo, cfe-commits, jyknight, riccibruno, rsmith, nathanchance

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71037
2020-01-03 17:22:24 +01:00
Matt Arsenault 53fc484067 AMDGPU/GlobalISel: Fix off by one in operand index
This should be looking at the RHS of the add for a constant.
2020-01-03 10:30:30 -05:00
Roman Lebedev 0727e2b90c
[DAGCombiner][X86][AArch64] Generalize `A-(A&B)`->`A&(~B)` fold (PR44448)
The fold 'A - (A & (B - 1))' -> 'A & (0 - B)'
added in 8dab0a4a7d
is too specific. It should/can just be 'A - (A & B)' -> 'A & (~B)'

Even if we don't manage to fold `~` into B,
we have likely formed `ANDN` node.
Also, this way there's less similar-but-duplicate folds.

Name: X - (X & Y)  ->  X & (~Y)
%o = and i32 %X, %Y
%r = sub i32 %X, %o
  =>
%n = xor i32 %Y, -1
%r = and i32 %X, %n

https://rise4fun.com/Alive/kOUl

See
  https://bugs.llvm.org/show_bug.cgi?id=44448
  https://reviews.llvm.org/D71499
2020-01-03 17:55:47 +03:00
Roman Lebedev 473deaf34b
[NFC][X86][AArch64] Add 'A - (A & B)' pattern tests (PR44448)
The fold 'A - (A & (B - 1))' -> 'A & (0 - B)'
added in 8dab0a4a7d
is too specific. It should just be 'A - (A & B)' -> 'A & (~B)'

Name: X - (X & Y)  ->  X & (~Y)
%o = and i32 %X, %Y
%r = sub i32 %X, %o
  =>
%n = xor i32 %Y, -1
%r = and i32 %X, %n

https://rise4fun.com/Alive/kOUl

See
  https://bugs.llvm.org/show_bug.cgi?id=44448
  https://reviews.llvm.org/D71499
2020-01-03 17:55:46 +03:00
Roman Lebedev df4119c114
[NFC][X86] Add BMI runlines to align-down.ll test 2020-01-03 17:55:46 +03:00
Roman Lebedev 86403c0ff8
[DAGCombiner] `~(add X, -1)` -> `neg X` fold
The fold 'A - (A & (B - 1))' -> 'A & (0 - B)'
added in 8dab0a4a7d
is too specific. It should just be 'A - (A & B)' -> 'A & (~B)',
but we currently fail to sink that '~' into `(B - 1)`.

Name: ~(X - 1)  ->  (0 - X)
%o = add i32 %X, -1
%r = xor i32 %o, -1
  =>
%r = sub i32 0, %X

https://rise4fun.com/Alive/rjU
2020-01-03 17:55:46 +03:00
Roman Lebedev d09ac032ee
[NFC][DAGCombine][X86] '~(X - 1)' pattern tests
The fold 'A - (A & (B - 1))' -> 'A & (0 - B)'
added in 8dab0a4a7d
is too specific. It should just be 'A - (A & B)' -> 'A & (~B)',
but we currently fail to sink that '~' into `(B - 1)`.

Name: ~(X - 1)  ->  (0 - X)
%o = add i32 %X, -1
%r = xor i32 %o, -1
  =>
%r = sub i32 0, %X

https://rise4fun.com/Alive/rjU
2020-01-03 17:55:46 +03:00
Roman Lebedev 3d492d7503
[DAGCombine][X86][Thumb2/LowOverheadLoops] `A - (A & C)` -> `A & (~C)` fold (PR44448)
While we do manage to fold integer-typed IR in middle-end,
we can't do that for the main motivational case of pointers.

There is @llvm.ptrmask() intrinsic which may or may not be helpful,
but i'm not sure it is fully considered canonical yet,
not everything is fully aware of it likely.

Name: PR44448  ptr - (ptr & C) -> ptr & (~C)
%bias = and i32 %ptr, C
%r = sub i32 %ptr, %bias
  =>
%r = and i32 %ptr, ~C

See
  https://bugs.llvm.org/show_bug.cgi?id=44448
  https://reviews.llvm.org/D71499
2020-01-03 17:55:45 +03:00
Roman Lebedev e4de8db67e
[NFC][DAGCombine][X86] Tests for 'A - (A & C)' pattern (PR44448)
Name: PR44448  ptr - (ptr & C) -> ptr & (~C)
%bias = and i32 %ptr, C
%r = sub i32 %ptr, %bias
  =>
%r = and i32 %ptr, ~C

The main motivational pattern involes pointer-typed values,
so this transform can't really be done in middle-end.

See
  https://bugs.llvm.org/show_bug.cgi?id=44448
  https://reviews.llvm.org/D71499
2020-01-03 17:55:45 +03:00
Roman Lebedev 1711be78f7
[NFC][DAGCombine] Clarify comment for 'A - (A & (B - 1))' fold 2020-01-03 17:55:42 +03:00
Sam Parker 69cfbb460e [ARM][NFC] Update MIR test 2020-01-03 14:51:15 +00:00
serge-sans-paille dfadb74f25 Use llvm_canonicalize_cmake_booleans where intended
Differential Revision: https://reviews.llvm.org/D72130
2020-01-03 15:42:35 +01:00
serge-sans-paille b2be259fa9 Fix compiler extension testing
Correctly declare example dependency. Pipe stderr through FileCheck.

Differential Revision: https://reviews.llvm.org/D72130
2020-01-03 15:42:35 +01:00
serge-sans-paille 61aea827df Fix typo in compiler extension testing
s/CHECK-/CHECK

Differential Revision: https://reviews.llvm.org/D72130
2020-01-03 15:42:35 +01:00
Ankit 369a919514 Fix for a dangling point bug in DeadStoreElimination pass
The patch makes sure that the LastThrowing pointer does not point to any instruction deleted by call to DeleteDeadInstruction.

While iterating through the instructions the pass maintains a pointer to the lastThrowing Instruction. A call to deleteDeadInstruction deletes a dead store and other instructions feeding the original dead instruction which also become dead. The instruction pointed by the lastThrowing pointer could also be deleted by the call to DeleteDeadInstruction and thus it becomes a dangling pointer. Because of this, we see an error in the next iteration.

In the patch, we maintain a list of throwing instructions encountered previously and use the last non deleted throwing instruction from the container.

Reviewers: fhahn, bcahoon, efriedma

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D65326
2020-01-03 14:28:44 +00:00
Sanjay Patel 1640582743 [InstCombine] replace undef elements in vector constant when doing icmp folds (PR44383)
As shown in P44383:
https://bugs.llvm.org/show_bug.cgi?id=44383
...we can't safely propagate a vector constant through this icmp fold
if that vector constant contains undefined elements.

We know that each defined element of the constant is safe though, so
find the first of those and replicate it into the formerly undef lanes.

Differential Revision: https://reviews.llvm.org/D72101
2020-01-03 09:16:57 -05:00
Jay Foad 8382f87145 Fix typo "psuedo" in comments 2020-01-03 14:05:58 +00:00
Jay Foad 07bc851b21 [TargetLowering] Remove comments referring to TLOF
These have been obsolete since about r221926, when
TargetLoweringObjectFile was completely moved from TargetLowering to
TargetMachine.
2020-01-03 13:35:03 +00:00
Lei Zhang b3d2867769 [mlir][spirv] Fix shader ABI attribute prefix and add verification
This commit fixes shader ABI attributes to use `spv.` as the prefix
so that they match the dialect's namespace. This enables us to add
verification hooks in the SPIR-V dialect to verify them.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D72062
2020-01-03 07:44:27 -05:00
James Henderson cc6be11872 [test][ELF] Use CHECK-NEXT to properly verify error messages
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D72092
2020-01-03 12:38:09 +00:00
James Henderson 418cd8216b [DebugInfo] Remove redundant checks for past-the-end of prologue
The V5 directory and filename tables had checks in to make sure we
hadn't read past the end of the line table prologue. Since previous
changes to the data extractor class ensure we never read past the end,
these checks are now redundant, so this patch removes them.

There is still a check to show that the whole prologue remains within
the prologue length.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D71768
2020-01-03 12:35:32 +00:00
Anastasia Stulova e456165f9f [OpenCL] Add link to C++ for OpenCL documentation
Remove description of language mode from the language
extensions and add a link to pdf document.

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72076
2020-01-03 12:01:03 +00:00
Ilya Biryukov 04f627f6b9 [Syntax] Build spanning SimpleDecalration for classes, structs, etc
When they are free-standing, e.g. `struct X;` or `struct X {};`.
Although this complicates the common case (of free-standing class
declarations), this ensures the less common case (e.g. `struct X {} a;`)
are handled uniformly and produce similar syntax trees.
2020-01-03 12:33:11 +01:00
James Henderson 7b4badf6f9 [test][llvm-dwarfdump] Use --implicit-check-not to simplify test checks
This removes the need to duplicate the LASTONLY check pattern and the
last part of the NONFATAL pattern in the modified test.

Reviewed By: MaskRay, JDevlieghere

Differential Revision: https://reviews.llvm.org/D71757
2020-01-03 11:22:20 +00:00
James Henderson f6f0cb4fd1 [test][llvm-dwarfdump] Normalise contents and checks for line tables
The line tables in debug_line_malformed.s had contents that varied more
than was necessary for the testing, making it harder to follow what was
important. This patch normalises them so that they all share
more-or-less the same body. Additionally, it makes the testing for what
was printed more consistent, to show that the right parts of the line
table prologue and body are/are not parsed and printed.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D71755
2020-01-03 11:19:00 +00:00
James Henderson 91cbcbd9e5 [test][llvm-dwarfdump] Add missing checks for table dumping
Some of the tables in debug_line_malformed.s were not being checked in
the NONFATAL checks in debug_line_invalid.test (only the warnings coming
from them were being checked). This made the test harder to follow.
Additionally, a later change will change the way the errors are handled
such that more of the line table will be printed. That will require
checks for these tables (or something equivalent) so that the difference
in behaviour can be observed. This patch adds checks for the three
tables that were missing checks.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D71753
2020-01-03 11:06:31 +00:00
Roman Lebedev 8dab0a4a7d
[DAGCombine][X86][AArch64] 'A - (A & (B - 1))' -> 'A & (0 - B)' fold (PR44448)
While we do manage to fold integer-typed IR in middle-end,
we can't do that for the main motivational case of pointers.

There is @llvm.ptrmask() intrinsic which may or may not be helpful,
but i'm not sure it is fully considered canonical yet,
not everything is fully aware of it likely.

https://rise4fun.com/Alive/ZVdp

Name: ptr - (ptr & (alignment-1))  ->  ptr & (0 - alignment)
  %mask = add i64 %alignment, -1
  %bias = and i64 %ptr, %mask
  %r = sub i64 %ptr, %bias
=>
  %highbitmask = sub i64 0, %alignment
  %r = and i64 %ptr, %highbitmask

See
  https://bugs.llvm.org/show_bug.cgi?id=44448
  https://reviews.llvm.org/D71499
2020-01-03 13:58:36 +03:00
Roman Lebedev c0cbe3fbb7
[NFC][DAGCombine][X86][AArch64] Tests for 'A - (A & (B - 1))' pattern (PR44448)
https://rise4fun.com/Alive/ZVdp

Name: ptr - (ptr & (alignment-1))  ->  ptr & (0 - alignment)
  %mask = add i64 %alignment, -1
  %bias = and i64 %ptr, %mask
  %r = sub i64 %ptr, %bias
=>
  %highbitmask = sub i64 0, %alignment
  %r = and i64 %ptr, %highbitmask

The main motivational pattern involes pointer-typed values,
so this transform can't really be done in middle-end.

See
  https://bugs.llvm.org/show_bug.cgi?id=44448
  https://reviews.llvm.org/D71499
2020-01-03 13:58:36 +03:00
Raphael Isemann 2e03324441 [lldb][NFC] Remove forward declaration for non-existent type clang::Action and delete references to it
There is no clang::Action anymore so our forward decl for it and the obsolete pointer in the
ASTStructExtractor can both go (that code anyway didn't do anything).
2020-01-03 11:24:16 +01:00
Raphael Isemann 1711f886fd [lldb][NFC] Document TypeSystem and related Compiler* classes 2020-01-03 10:38:38 +01:00
Sam Parker 8f6a67632a [ARM][NFC] Move tail predication checks
Extract the tail predication validation checks out into their own
LowOverHeadLoop method.
2020-01-03 03:50:54 -05:00
Craig Topper 3186b18b99 [X86] Reorder X86any* PatFrags to put the strict node first so that chain property will be inferred for the instruction by the tablegen backend.
Also use X86any_vfpround instead of X86vfpround in some instruction
definitions so the strict version can be used to infer the chain
property.

Without these changes we don't propagate strict FP chain through
isel for some instructions.
2020-01-03 00:11:55 -08:00
Kadir Cetinkaya b2eaac3e3e
[clangd] Replace shortenNamespace with getQualification
Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71652
2020-01-03 09:05:30 +01:00
TH3CHARLie abd707848b [llvm-size] print a blank line between archieve members when using sysv format
Summary: This patch is related to https://bugs.llvm.org/show_bug.cgi?id=42967 and it fixes llvm-size's sysv format output by adding a blank line between archieve members

Reviewers: jhenderson, Jim, MaskRay

Reviewed By: jhenderson, Jim, MaskRay

Subscribers: MaskRay, Jim, rupprecht, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71957
2020-01-03 14:05:55 +08:00
Craig Topper bd46e29742 [X86] Re-enable lowerUINT_TO_FP_vXi32 under fast-math by using an FSUB instead of an FADD.
Summary:
We previously disabled this under fast math due to aggressive
reassociation by the machine combiner. But I think we can work
around this by using a FSUB instead of FADD for the first
operation.

This matches the similar algorithm we do for uint_to_fp i64->f64
in TargetLowering::expandUINT_TO_FP. If reassociation hasn't
been a problem for that, hopefully its not a problem here.

Reviewers: RKSimon, spatel, scanon

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71968
2020-01-02 21:46:53 -08:00
QingShan Zhang 2133d3c558 [DAGCombine] Initialize the default operation action for SIGN_EXTEND_INREG for vector type as 'expand' instead of 'legal'
For now, we didn't set the default operation action for SIGN_EXTEND_INREG for
vector type, which is 0 by default, that is legal. However, most target didn't
have native instructions to support this opcode. It should be set as expand by
default, as what we did for ANY_EXTEND_VECTOR_INREG.

Differential Revision: https://reviews.llvm.org/D70000
2020-01-03 03:26:41 +00:00
Wang, Pengfei 60333a5317 [X86] Enable strict FP by default and remove option -disable-strictnode-mutation. NFCI. 2020-01-03 10:59:34 +08:00
Kazuaki Ishizaki a050327064 [mlir] NFC: Fix broken links in docs
Summary: This commit fixes missing links that are caused by the repository movement.

Reviewers: Jim, rriddle, jpienaar

Reviewed By: Jim, rriddle, jpienaar

Subscribers: arpith-jacob, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D72065
2020-01-03 10:26:27 +08:00
Hideto Ueno 5fc02dc0a7 Revert "[Attributor] AAValueConstantRange: Value range analysis using constant range"
This reverts commit e996303431.
2020-01-03 11:03:56 +09:00
Kamil Rytarowski 0da15ff318 [compiler-rt] [netbsd] Switch to syscall for ThreadSelfTlsTcb()
This change avoids using internal, namespaced per-CPU calls that
are not a stable interface to read the TSL base value.
2020-01-03 02:40:52 +01:00
Justin Hibbits 2c4620ad57 [PowerPC]: Fix predicate handling with SPE
SPE floating-point compare instructions only update the GT bit in the CR
field.  All predicates must therefore be reduced to GT/LE.
2020-01-02 19:30:53 -06:00