platform/upstream/llvm.git
4 years ago[CMake] Separate the detection Darwin platforms architectures for the
Dan Liew [Fri, 13 Sep 2019 17:31:22 +0000 (17:31 +0000)]
[CMake] Separate the detection Darwin platforms architectures for the
built-ins from the rest of compiler-rt.

The detection of supported platform (os) architectures for Darwin relies
on the `darwin_test_archs()` CMake function. This is used both for
building the builtins (`builtin-config-ix.cmake`) and for the rest of
the compiler-rt (`config-ix.cmake`).

`darwin_test_archs()`  implements a cache, presumably to speed up CMake
re-configures.  Unfortunately this caching is buggy because it depends
on external global state (i.e. the `TEST_COMPILE_ONLY` variable) and
this is not taken into account. For `config-ix.cmake`
`TEST_COMPILE_ONLY` is not set and for `builtin-config-ix.cmake`
`TEST_COMPILE_ONLY` is set to `On`.  This makes the
`darwin_test_archs()` function racey in the sense that a call from one
calling context will poison the cache for the other calling context.

This is actually an issue George Karpenkov discovered a while back
and had an incomplete patch for (https://reviews.llvm.org/D45337)
but this was never merged.

To workaround this, this patch switches to using a different set of
variables for the platform architecture builtins, i.e.
`DARWIN_<OS>_ARCHS` -> `DARWIN_<OS>_BUILTIN_ARCHS`. This avoids the
cache poisoning problem because the cached variable names are different.
This also has the advantage that the the configured architectures for
builtins and the rest of the compiler-rt are now independent and
can be set differently if necessary.

Note in `darwin_test_archs()` we also now pass `-w` to the compiler
because `try_compile_only()` treats compiler warnings as errors.  This
was extremely fragile because compiler warnings (can easily appear due
to a buggy compiler or SDK headers) would cause compiler-rt to think an
architecture on Darwin wasn't supported.

rdar://problem/48637491

llvm-svn: 371871

4 years ago[Remarks][NFC] Forward declare ParsedStringTable
Francis Visoiu Mistrih [Fri, 13 Sep 2019 17:27:28 +0000 (17:27 +0000)]
[Remarks][NFC] Forward declare ParsedStringTable

llvm-svn: 371870

4 years ago[Remarks][NFC] Use StringLiteral for magic numbers
Francis Visoiu Mistrih [Fri, 13 Sep 2019 16:46:23 +0000 (16:46 +0000)]
[Remarks][NFC] Use StringLiteral for magic numbers

llvm-svn: 371869

4 years ago[AArch64][GlobalISel] Add support for sibcalling callees with varargs
Jessica Paquette [Fri, 13 Sep 2019 16:10:19 +0000 (16:10 +0000)]
[AArch64][GlobalISel] Add support for sibcalling callees with varargs

This adds support for tail calling callees with varargs, equivalent to how it
is done in AArch64ISelLowering.

This only works for sibling calls, and does not add the necessary support for
musttail with varargs. (See r345641 for equivalent ISelLowering support.) This
should be implemented when we stop falling back on musttail.

Update call-translator-tail-call.ll to show that we can now tail call varargs.

Differential Revision: https://reviews.llvm.org/D67518

llvm-svn: 371868

4 years agoRecommit r370502: Make `vector` unconditionally move elements when
Eric Fiselier [Fri, 13 Sep 2019 16:09:33 +0000 (16:09 +0000)]
Recommit r370502: Make `vector` unconditionally move elements when
exceptions are disabled.

The patch was reverted due to some confusion about non-movable types. ie
types
that explicitly delete their move constructors. However, such types do
not meet
the requirement for `MoveConstructible`, which is required by
`std::vector`:

Summary:

`std::vector<T>` is free choose between using copy or move operations
when it
needs to resize. The standard only candidates that the correct exception
safety
guarantees are provided. When exceptions are disabled these guarantees
are
trivially satisfied. Meaning vector is free to optimize it's
implementation by
moving instead of copying.

This patch makes `std::vector` unconditionally move elements when
exceptions are
disabled. This optimization is conforming according to the current
standard wording.

There are concerns that moving in `-fno-noexceptions`mode will be a
surprise to
users. For example, a user may be surprised to find their code is slower
with
exceptions enabled than it is disabled. I'm sympathetic to this
surprised, but
I don't think it should block this optimization.

Reviewers: mclow.lists, ldionne, rsmith
Reviewed By: ldionne
Subscribers: zoecarver, christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D62228

llvm-svn: 371867

4 years ago[lldb] - Update unit tests after lib/ObjectYAML change.
George Rimar [Fri, 13 Sep 2019 16:00:28 +0000 (16:00 +0000)]
[lldb] - Update unit tests after lib/ObjectYAML change.

An update after r371865

llvm-svn: 371866

4 years ago[yaml2obj/ObjectYAML] - Cleanup the error reporting API, add custom errors handlers.
George Rimar [Fri, 13 Sep 2019 16:00:16 +0000 (16:00 +0000)]
[yaml2obj/ObjectYAML] - Cleanup the error reporting API, add custom errors handlers.

This is a continuation of the YAML library error reporting
refactoring/improvement and the idea by itself was mentioned
in the following thread:
https://reviews.llvm.org/D67182?id=218714#inline-603404

This performs a cleanup of all object emitters in the library.
It allows using the custom one provided by the caller.

One of the nice things is that each tool can now print its tool name,
e.g: "yaml2obj: error: <text>"

Also, the code became a bit simpler.

Differential revision: https://reviews.llvm.org/D67445

llvm-svn: 371865

4 years agoOnly initialize the streams cout/wcout/cerr/wcerr etc once, rather than any time...
Marshall Clow [Fri, 13 Sep 2019 15:28:06 +0000 (15:28 +0000)]
Only initialize the streams cout/wcout/cerr/wcerr etc once, rather than any time Init::Init is called. Fixes PR#43300

llvm-svn: 371864

4 years agoFix build in C++20
Eric Fiselier [Fri, 13 Sep 2019 15:13:11 +0000 (15:13 +0000)]
Fix build in C++20

llvm-svn: 371863

4 years ago[docs][llvm-readelf][llvm-readobj] Improve --stack-sizes documentation
James Henderson [Fri, 13 Sep 2019 15:01:39 +0000 (15:01 +0000)]
[docs][llvm-readelf][llvm-readobj] Improve --stack-sizes documentation

llvm-readobj's document was missing --stack-sizes entirely from its
document, so this patch adds it. It also adds a note to the llvm-readelf
description that the switch is only implemented for GNU style output
currently. For reference, --stack-sizes was added in r367942.

Reviewed by: MaskRay

Differential Revision: https://reviews.llvm.org/D67548

llvm-svn: 371862

4 years ago[X86] Use incDecVectorConstant to simplify the min/max code in LowerVSETCC.
Craig Topper [Fri, 13 Sep 2019 14:59:08 +0000 (14:59 +0000)]
[X86] Use incDecVectorConstant to simplify the min/max code in LowerVSETCC.

incDecVectorConstant is used for a similar reason in LowerVSETCCWithSUBUS
so we might as well share the code.

llvm-svn: 371861

4 years agoFix a few spellos in docs.
Nico Weber [Fri, 13 Sep 2019 14:58:24 +0000 (14:58 +0000)]
Fix a few spellos in docs.

(Trying to debug an incremental build thing on a bot...)

llvm-svn: 371860

4 years ago[Sema][Typo Correction] Fix potential infite loop on ambiguity checks
David Goldman [Fri, 13 Sep 2019 14:43:24 +0000 (14:43 +0000)]
[Sema][Typo Correction] Fix potential infite loop on ambiguity checks

Summary:
This fixes a bug introduced in D62648, where Clang could infinite loop
if it became stuck on a single TypoCorrection when it was supposed to
be testing ambiguous corrections. Although not a common case, it could
happen if there are multiple possible corrections with the same edit
distance.

The fix is simply to wipe the TypoExpr from the `TransformCache` so that
the call to `TransformTypoExpr` doesn't use the `CachedEntry`.

Reviewers: rsmith

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67515

llvm-svn: 371859

4 years agogn build: pacify "gn format" after 371102
Nico Weber [Fri, 13 Sep 2019 14:35:20 +0000 (14:35 +0000)]
gn build: pacify "gn format" after 371102

llvm-svn: 371858

4 years ago[PowerPC][NFC] Move codegen tests to PowerPC from MIR/PowerPC
Jinsong Ji [Fri, 13 Sep 2019 14:18:36 +0000 (14:18 +0000)]
[PowerPC][NFC] Move codegen tests to PowerPC from MIR/PowerPC

All tests with -run-pass !=none should not in MIR/, See MIR/README.

```
Tests for codegen passes should NOT be here but in
test/CodeGen/sometarget. As
a rule of thumb this directory should only contain tests using
'llc -run-pass none'.
```

llvm-svn: 371857

4 years ago[ADT] Remove a workaround for old versions of clang
Benjamin Kramer [Fri, 13 Sep 2019 13:47:49 +0000 (13:47 +0000)]
[ADT] Remove a workaround for old versions of clang

llvm-svn: 371856

4 years ago[docs][llvm-objcopy][llvm-strip] Improve --strip-unneeded description
James Henderson [Fri, 13 Sep 2019 13:26:52 +0000 (13:26 +0000)]
[docs][llvm-objcopy][llvm-strip] Improve --strip-unneeded description

Behaviour was recently added to this switch to strip debug sections too.
See r369761.

This change also makes the description for the --strip-unneeded switch
consistent between the two docs.

Reviewed by: MaskRay

Differential Revision: https://reviews.llvm.org/D67546

llvm-svn: 371855

4 years agoclang-format: Add support for formatting (some) lambdas with explicit template parame...
Nico Weber [Fri, 13 Sep 2019 13:18:55 +0000 (13:18 +0000)]
clang-format: Add support for formatting (some) lambdas with explicit template parameters.

This patch makes cases work where the lambda's template list doesn't
contain any of + - ! ~ / % << | || && ^ == != >= <= ? : true false
(see added FIXME).

Ports r359967 to clang-format.

Differential Revision: https://reviews.llvm.org/D67246

llvm-svn: 371854

4 years agoFix depfile name construction
Luke Cheeseman [Fri, 13 Sep 2019 13:15:35 +0000 (13:15 +0000)]
Fix depfile name construction

- When using -o, the provided filename is using for constructing the depfile
  name (when -MMD is passed).
- The logic looks for the rightmost '.' character and replaces what comes after
  with 'd'.
- This works incorrectly when the filename has no extension and the directories
  have '.' in them (e.g. out.dir/test)
- This replaces the funciton to just llvm::sys::path functionality

Differential Revision: https://reviews.llvm.org/D67542

llvm-svn: 371853

4 years agolld-link: Add a flag /lldignoreenv that makes lld-link ignore env vars.
Nico Weber [Fri, 13 Sep 2019 13:13:52 +0000 (13:13 +0000)]
lld-link: Add a flag /lldignoreenv that makes lld-link ignore env vars.

This is useful for enforcing that builds are independent of the
environment; it can be used when all system library paths are added
via /libpath: already. It's similar ot cl.exe's /X flag.

Since it should also affect %LINK% (the other caller of
`Process::GetEnv` in lld/COFF), the early-option-parsing needs
to move around a bit. The options are:

- Add a manual loop over the argv ArrayRef and look for "/lldignoreenv".
  This repeats the name of the flag in both Options.td and in
  DriverUtils.cpp.

- Add yet another table.ParseArgs() call just for /lldignoreenv before
  adding %LINK%.

- Use the existing early ParseArgs() that's there for --rsp-quoting and use
  it for /lldignoreenv for %LINK% as well. This means --rsp-quoting
  and /lldignoreenv can't be passed via %LINK%.

I went with the third approach.

Differential Revision: https://reviews.llvm.org/D67456

llvm-svn: 371852

4 years agogn build: (manually) merge r371834, take 2
Nico Weber [Fri, 13 Sep 2019 13:07:54 +0000 (13:07 +0000)]
gn build: (manually) merge r371834, take 2

llvm-svn: 371851

4 years agoRevert "gn build: (manually) merge r371834"
Nico Weber [Fri, 13 Sep 2019 13:04:59 +0000 (13:04 +0000)]
Revert "gn build: (manually) merge r371834"

This reverts commit abc7e2b6004cd693cf3b6dedbc7908e099c7ac6a.
The commit was incomplete. I'll revert and reland the full commit,
so that the correct change is a single commit.

llvm-svn: 371850

4 years agogn build: (manually) merge r371834
Nico Weber [Fri, 13 Sep 2019 12:59:06 +0000 (12:59 +0000)]
gn build: (manually) merge r371834

llvm-svn: 371849

4 years agogn build: Merge r371822
Nico Weber [Fri, 13 Sep 2019 12:58:58 +0000 (12:58 +0000)]
gn build: Merge r371822

llvm-svn: 371848

4 years agogn build: (manually) merge r371787
Nico Weber [Fri, 13 Sep 2019 12:58:52 +0000 (12:58 +0000)]
gn build: (manually) merge r371787

llvm-svn: 371847

4 years ago[ADT] Make DenseMap use allocate_buffer
Benjamin Kramer [Fri, 13 Sep 2019 12:32:40 +0000 (12:32 +0000)]
[ADT] Make DenseMap use allocate_buffer

This unlocks some goodies like sized deletion and gets the alignment
right on platforms that chose to provide a lower default new alignment.

llvm-svn: 371846

4 years ago[llvm-size] Fix spelling errors (Berkely -> Berkeley)
James Henderson [Fri, 13 Sep 2019 12:00:42 +0000 (12:00 +0000)]
[llvm-size] Fix spelling errors (Berkely -> Berkeley)

llvm-svn: 371845

4 years ago[Orc] Roll back ThreadPool to std::function
Benjamin Kramer [Fri, 13 Sep 2019 11:59:51 +0000 (11:59 +0000)]
[Orc] Roll back ThreadPool to std::function

MSVC doesn't allow move-only types in std::packaged_task. Boo.

llvm-svn: 371844

4 years ago[Orc] Address the remaining move-capture FIXMEs
Benjamin Kramer [Fri, 13 Sep 2019 11:35:33 +0000 (11:35 +0000)]
[Orc] Address the remaining move-capture FIXMEs

This required spreading unique_function a bit more, which I think is a
good thing.

llvm-svn: 371843

4 years ago[lldb][NFC] Remove ArgEntry::ref member
Raphael Isemann [Fri, 13 Sep 2019 11:26:48 +0000 (11:26 +0000)]
[lldb][NFC] Remove ArgEntry::ref member

The StringRef should always be identical to the C string, so we
might as well just create the StringRef from the C-string. This
might be slightly slower until we implement the storage of ArgEntry
with a string instead of a std::unique_ptr<char[]>. Until then we
have to do the additional strlen on the C string to construct the
StringRef.

llvm-svn: 371842

4 years ago[X86] negateFMAOpcode - extend to support FMADDSUB/FMSUBADD and output negation....
Simon Pilgrim [Fri, 13 Sep 2019 11:22:40 +0000 (11:22 +0000)]
[X86] negateFMAOpcode - extend to support FMADDSUB/FMSUBADD and output negation. NFCI.

Some prep work for PR42863, this change allows us to move all the FMA opcode mappings into the negateFMAOpcode helper.

For the FMADDSUB/FMSUBADD cases, we can only negate the accumulator - any other negations will result in an error.

llvm-svn: 371840

4 years ago[ASTImporter] Add development internals docs
Gabor Marton [Fri, 13 Sep 2019 11:21:52 +0000 (11:21 +0000)]
[ASTImporter] Add development internals docs

Reviewers: a_sidorin, shafik, teemperor, gamesh411, balazske, dkrupp, a.sidorin

Subscribers: rnkovacs, Szelethus, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66336

llvm-svn: 371839

4 years ago[ARM] Add earlyclobber for cross beat MVE instructions
David Green [Fri, 13 Sep 2019 11:20:17 +0000 (11:20 +0000)]
[ARM] Add earlyclobber for cross beat MVE instructions

rL367544 added @earlyclobbers for the MVE VREV64 instruction. This adds the
same for a number of other 32bit instructions that are similarly unpredictable
if the destination equals the source (due to the cross beat nature of the
instructions).
This includes:
  VCADD.f32
  VCADD.i32
  VCMUL.f32
  VHCADD.s32
  VMULLT/B.s/u32
  VQDMLADH{X}.s32
  VQRDMLADH{X}.s32
  VQDMLSDH{X}.s32
  VQRDMLSDH{X}.s32
  VQDMULLT/B.s32 with Qm and Rm

No tests here as this would require intrinsics (or very interesting codegen) to
manifest. The tests will follow naturally as the intrinsics are added.

Differential Revision: https://reviews.llvm.org/D67462

llvm-svn: 371838

4 years ago[lldb][NFC] Simplify Args::ReplaceArgumentAtIndex
Raphael Isemann [Fri, 13 Sep 2019 10:41:29 +0000 (10:41 +0000)]
[lldb][NFC] Simplify Args::ReplaceArgumentAtIndex

This code is not on any performance critical path that would
justify this shortening optimization. It also makes it possible
to turn 'ref' into a function (as this is the only place where
we modify this ArgEntry member).

llvm-svn: 371836

4 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Fri, 13 Sep 2019 09:46:16 +0000 (09:46 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64146

llvm-svn: 371834

4 years ago[AArch64] More @llvm.fma.f16 tests
Sjoerd Meijer [Fri, 13 Sep 2019 09:44:13 +0000 (09:44 +0000)]
[AArch64] More @llvm.fma.f16 tests

Follow up of rL371321 that added FMA FP16 patterns. This adds more tests
for @llvm.fma.f16. This probably shows we miss one fmsub optimisation
opportunity, which I will look into.

llvm-svn: 371833

4 years agoFix a perl warning: Scalar value @ArgParts[0] better written as $ArgParts[0] at ...
Sylvestre Ledru [Fri, 13 Sep 2019 09:31:19 +0000 (09:31 +0000)]
Fix a perl warning: Scalar value @ArgParts[0] better written as $ArgParts[0] at /usr/share/clang/scan-build-10/libexec/ccc-analyzer line 502.

llvm-svn: 371832

4 years ago[Alignment] Introduce llvm::Align to MCSection
Guillaume Chatelet [Fri, 13 Sep 2019 09:29:59 +0000 (09:29 +0000)]
[Alignment] Introduce llvm::Align to MCSection

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet, JDevlieghere

Subscribers: arsenm, sdardis, jvesely, nhaehnle, sbc100, hiraditya, aheejin, jrtc27, atanasyan, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67486

llvm-svn: 371831

4 years ago[lib/ObjectYAML] - Change interface to return `bool` instead of `int`. NFCI
George Rimar [Fri, 13 Sep 2019 09:12:38 +0000 (09:12 +0000)]
[lib/ObjectYAML] - Change interface to return `bool` instead of `int`. NFCI

It was suggested in comments for D67445 to split this part.

Differential revision: https://reviews.llvm.org/D67488

llvm-svn: 371828

4 years ago[ARM] Add support for MVE vmaxv and vminv
Sam Tebbs [Fri, 13 Sep 2019 09:11:46 +0000 (09:11 +0000)]
[ARM] Add support for MVE vmaxv and vminv

This patch adds vecreduce_smax, vecredude_umax, vecreduce_smin, vecreduce_umin and selection for vmaxv and minv.

Differential Revision: https://reviews.llvm.org/D66413

llvm-svn: 371827

4 years ago[llvm-objdump] Fix llvm-objdump --all-headers output order
George Rimar [Fri, 13 Sep 2019 08:56:28 +0000 (08:56 +0000)]
[llvm-objdump] Fix llvm-objdump --all-headers output order

Patch by Justice Adams!

Made llvm-objdump --all-headers output match the order of GNU objdump for compatibility reasons.

Old order of the headers output:
* file header
* section header table
* symbol table
* program header table
* dynamic section

New order of the headers output (GNU compatible):
* file header information
* program header table
* dynamic section
* section header table
* symbol table

(Relevant BugZilla Bug: https://bugs.llvm.org/show_bug.cgi?id=41830)

Differential revision: https://reviews.llvm.org/D67357

llvm-svn: 371826

4 years ago[Polly] Fix lib/Transform/ScheduleOptimizer.cpp compilation on Solaris
Rainer Orth [Fri, 13 Sep 2019 08:45:06 +0000 (08:45 +0000)]
[Polly] Fix lib/Transform/ScheduleOptimizer.cpp compilation on Solaris

lib/Transform/ScheduleOptimizer.cpp fails to compile on Solaris, both on the 9.x
branch (first noticed when running test-release.sh without -no-polly) and on trunk:

  /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/lib/Transform/ScheduleOptimizer.cpp: In function â€˜MicroKernelParamsTy getMicroKernelParams(const llvm::TargetTransformInfo*, polly::MatMulInfoTy)’:
  /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/lib/Transform/ScheduleOptimizer.cpp:914:62: error: call of overloaded â€˜sqrt(long unsigned int)’ is ambiguous
    914 |       ceil(sqrt(Nvec * LatencyVectorFma * ThroughputVectorFma) / Nvec) * Nvec;
        |                                                              ^
  In file included from /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/math.h:24,
                   from /usr/gcc/9/include/c++/9.1.0/cmath:45,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm-c/DataTypes.h:28,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/Support/DataTypes.h:16,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/ADT/Hashing.h:47,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/ADT/ArrayRef.h:12,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/include/polly/ScheduleOptimizer.h:12,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/lib/Transform/ScheduleOptimizer.cpp:48:
  /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:220:21: note: candidate: â€˜long double std::sqrt(long double)’
    220 |  inline long double sqrt(long double __X) { return __sqrtl(__X); }
        |                     ^~~~
  /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:186:15:
note: candidate: â€˜float std::sqrt(float)’
    186 |  inline float sqrt(float __X) { return __sqrtf(__X); }
        |               ^~~~
  /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:74:15:
note: candidate: â€˜double std::sqrt(double)’
     74 | extern double sqrt __P((double));
        |               ^~~~
  /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/lib/Transform/ScheduleOptimizer.cpp:915:67:
error: call of overloaded â€˜ceil(long unsigned int)’ is ambiguous
    915 |   int Mr = ceil(Nvec * LatencyVectorFma * ThroughputVectorFma / Nr);
        |                                                                   ^
  In file included from /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/math.h:24,
                   from /usr/gcc/9/include/c++/9.1.0/cmath:45,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm-c/DataTypes.h:28,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/Support/DataTypes.h:16,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/ADT/Hashing.h:47,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/include/llvm/ADT/ArrayRef.h:12,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/include/polly/ScheduleOptimizer.h:12,
                   from /var/llvm/llvm-9.0.0-rc4/rc4/llvm.src/tools/polly/lib/Transform/ScheduleOptimizer.cpp:48:
  /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:196:21: note: candidate: â€˜long double std::ceil(long double)’
    196 |  inline long double ceil(long double __X) { return __ceill(__X); }
        |                     ^~~~
  /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:160:15:
note: candidate: â€˜float std::ceil(float)’
    160 |  inline float ceil(float __X) { return __ceilf(__X); }
        |               ^~~~
  /usr/gcc/9/lib/gcc/x86_64-pc-solaris2.11/9.1.0/include-fixed/iso/math_iso.h:76:15:
note: candidate: â€˜double std::ceil(double)’
     76 | extern double ceil __P((double));
        |               ^~~~

Fixed by adding casts to disambiguate, checked that it now compiles on both
amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11 and on x86_64-pc-linux-gnu.

Differential Revision: https://reviews.llvm.org/D67442

llvm-svn: 371825

4 years agoRevert "Fix test failures after r371640"
Dmitri Gribenko [Fri, 13 Sep 2019 08:26:59 +0000 (08:26 +0000)]
Revert "Fix test failures after r371640"

This reverts commit r371645, because r371640 was reverted.

llvm-svn: 371824

4 years ago[lldb][NFC] Make ArgEntry::quote private and provide a getter
Raphael Isemann [Fri, 13 Sep 2019 08:26:00 +0000 (08:26 +0000)]
[lldb][NFC] Make ArgEntry::quote private and provide a getter

llvm-svn: 371823

4 years ago[compiler-rt] Add ubsan interface header.
Pierre Gousseau [Fri, 13 Sep 2019 08:22:58 +0000 (08:22 +0000)]
[compiler-rt] Add ubsan interface header.

This is to document __ubsan_default_options().

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D67503

llvm-svn: 371822

4 years ago[Clang][ASTImporter] Added visibility check for FunctionTemplateDecl.
Balazs Keri [Fri, 13 Sep 2019 08:03:49 +0000 (08:03 +0000)]
[Clang][ASTImporter] Added visibility check for FunctionTemplateDecl.

Summary:
ASTImporter makes now difference between function templates with same
name in different translation units if these are not visible outside.

Reviewers: martong, a.sidorin, shafik, a_sidorin

Reviewed By: a_sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67490

llvm-svn: 371820

4 years ago[BasicBlockUtils] Add optional BBName argument, in line with BB:splitBasicBlock
Florian Hahn [Fri, 13 Sep 2019 08:03:32 +0000 (08:03 +0000)]
[BasicBlockUtils] Add optional BBName argument, in line with BB:splitBasicBlock

Reviewers: spatel, asbirlea, craig.topper

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D67521

llvm-svn: 371819

4 years ago[AArch64] MachineCombiner FMA matching. NFC.
Sjoerd Meijer [Fri, 13 Sep 2019 07:38:54 +0000 (07:38 +0000)]
[AArch64] MachineCombiner FMA matching. NFC.

Follow-up of rL371321 that added some more FP16 FMA patterns, and an attempt to
reduce the copy-pasting and make this more readable.

Differential Revision: https://reviews.llvm.org/D67403

llvm-svn: 371818

4 years agoFor PR17164: split -fno-lax-vector-conversion into three different
Richard Smith [Fri, 13 Sep 2019 06:02:15 +0000 (06:02 +0000)]
For PR17164: split -fno-lax-vector-conversion into three different
levels:

 -- none: no lax vector conversions [new GCC default]
 -- integer: only conversions between integer vectors [old GCC default]
 -- all: all conversions between same-size vectors [Clang default]

For now, Clang still defaults to "all" mode, but per my proposal on
cfe-dev (2019-04-10) the default will be changed to "integer" as soon as
that doesn't break lots of testcases. (Eventually I'd like to change the
default to "none" to match GCC and general sanity.)

Following GCC's behavior, the driver flag -flax-vector-conversions is
translated to -flax-vector-conversions=integer.

This reinstates r371805, reverted in r371813, with an additional fix for
lldb.

llvm-svn: 371817

4 years agoFix interaction between r371813 and r371814.
Richard Smith [Fri, 13 Sep 2019 05:29:16 +0000 (05:29 +0000)]
Fix interaction between r371813 and r371814.

llvm-svn: 371816

4 years ago[TargetRegisterInfo] Remove SVT argument from getCommonSubClass.
Craig Topper [Fri, 13 Sep 2019 05:24:37 +0000 (05:24 +0000)]
[TargetRegisterInfo] Remove SVT argument from getCommonSubClass.

This was added to support fp128 on x86-64, but appears to be
unneeded now. This may be because the FR128 register class
added back then was merged with the VR128 register class later.

llvm-svn: 371815

4 years agoRemove reliance on lax vector conversions from altivec.h and its test.
Richard Smith [Fri, 13 Sep 2019 05:19:12 +0000 (05:19 +0000)]
Remove reliance on lax vector conversions from altivec.h and its test.

llvm-svn: 371814

4 years agoRevert "For PR17164: split -fno-lax-vector-conversion into three different"
Jonas Devlieghere [Fri, 13 Sep 2019 05:16:59 +0000 (05:16 +0000)]
Revert "For PR17164: split -fno-lax-vector-conversion into three different"

This breaks the LLDB build. I tried reaching out to Richard, but haven't
gotten a reply yet.

llvm-svn: 371813

4 years agoAMDGPU/GlobalISel: Fix assert on multi-return side effect intrinsics
Matt Arsenault [Fri, 13 Sep 2019 04:12:12 +0000 (04:12 +0000)]
AMDGPU/GlobalISel: Fix assert on multi-return side effect intrinsics

llvm.amdgcn.else hits this.

llvm-svn: 371812

4 years agoAMDGPU/GlobalISel: Legalize s32->s16 G_SITOFP/G_UITOFP
Matt Arsenault [Fri, 13 Sep 2019 04:04:55 +0000 (04:04 +0000)]
AMDGPU/GlobalISel: Legalize s32->s16 G_SITOFP/G_UITOFP

llvm-svn: 371811

4 years ago[RISCV] Support stack offset exceed 32-bit for RV64
Shiva Chen [Fri, 13 Sep 2019 04:03:32 +0000 (04:03 +0000)]
[RISCV] Support stack offset exceed 32-bit for RV64

Differential Revision: https://reviews.llvm.org/D61884

llvm-svn: 371810

4 years agoRevert "[RISCV] Support stack offset exceed 32-bit for RV64"
Shiva Chen [Fri, 13 Sep 2019 04:03:24 +0000 (04:03 +0000)]
Revert "[RISCV] Support stack offset exceed 32-bit for RV64"

This reverts commit 1c340c62058d4115d21e5fa1ce3a0d094d28c792.

llvm-svn: 371809

4 years agoAMDGPU/GlobalISel: Fix RegBankSelect for amdgcn.else
Matt Arsenault [Fri, 13 Sep 2019 03:55:49 +0000 (03:55 +0000)]
AMDGPU/GlobalISel: Fix RegBankSelect for amdgcn.else

llvm-svn: 371808

4 years agoAMDGPU/GlobalISel: Select 16-bit VALU bit ops
Matt Arsenault [Fri, 13 Sep 2019 03:55:43 +0000 (03:55 +0000)]
AMDGPU/GlobalISel: Select 16-bit VALU bit ops

llvm-svn: 371807

4 years ago[RISCV] Support stack offset exceed 32-bit for RV64
Shiva Chen [Fri, 13 Sep 2019 02:50:13 +0000 (02:50 +0000)]
[RISCV] Support stack offset exceed 32-bit for RV64

Differential Revision: https://reviews.llvm.org/D61884

llvm-svn: 371806

4 years agoFor PR17164: split -fno-lax-vector-conversion into three different
Richard Smith [Fri, 13 Sep 2019 02:20:00 +0000 (02:20 +0000)]
For PR17164: split -fno-lax-vector-conversion into three different
levels:

 -- none: no lax vector conversions [new GCC default]
 -- integer: only conversions between integer vectors [old GCC default]
 -- all: all conversions between same-size vectors [Clang default]

For now, Clang still defaults to "all" mode, but per my proposal on
cfe-dev (2019-04-10) the default will be changed to "integer" as soon as
that doesn't break lots of testcases. (Eventually I'd like to change the
default to "none" to match GCC and general sanity.)

Following GCC's behavior, the driver flag -flax-vector-conversions is
translated to -flax-vector-conversions=integer.

llvm-svn: 371805

4 years ago[ELF] Delete a redundant assignment to SectionBase::assigned. NFC
Fangrui Song [Fri, 13 Sep 2019 02:18:04 +0000 (02:18 +0000)]
[ELF] Delete a redundant assignment to SectionBase::assigned. NFC

LinkerScript::discard marks a section dead. It is unnecessary to set the
`assigned` bit.

llvm-svn: 371804

4 years agoAMDGPU/GlobalISel: Legalize G_FFLOOR
Matt Arsenault [Fri, 13 Sep 2019 01:48:15 +0000 (01:48 +0000)]
AMDGPU/GlobalISel: Legalize G_FFLOOR

llvm-svn: 371803

4 years agoTemporarily revert r371640 "LiveIntervals: Split live intervals on multiple dead...
Tim Shen [Fri, 13 Sep 2019 01:34:25 +0000 (01:34 +0000)]
Temporarily revert r371640 "LiveIntervals: Split live intervals on multiple dead defs".

It reveals a miscompile on Hexagon. See PR43302 for details.

llvm-svn: 371802

4 years ago[ScopBuilder] Skip getting leader when merging statements to close holes.
Michael Kruse [Fri, 13 Sep 2019 01:04:38 +0000 (01:04 +0000)]
[ScopBuilder] Skip getting leader when merging statements to close holes.

Function joinOrderedInstructions merges instructions when a leader is encountered twice.
It also notices that leaders in SeenLeaders may lose their leadership in previous merging,
and tries to handle the case using following code:

    Instruction *PrevLeader = UnionFind.getLeaderValue(SeenLeaders.back());

However, this is wrong because it always gets leader for the last element of SeenLeaders,
and I believe it's wrong even we get leader for Prev here.  As a result, Statements in cases
like the one in patch aren't merged as expected.  After investigation, I believe it's
unnecessary to get leader instruction at all.  This is based on fact: Although leaders in
SeenLeaders could lose leadership, they only lose to others in SeenLeaders, in other words,
one existing leader will be chosen as new leader of merged equivalent statements.  We can
take advantage of this and simply check if current leader equals to Prev and break merging
if it does.

The patch also adds a new test.

Patch by bin.narwal <bin.narwal@gmail.com>

Differential Revision: https://reviews.llvm.org/D67007

llvm-svn: 371801

4 years agoAMDGPU/GlobalISel: Legalize G_FMAD
Matt Arsenault [Fri, 13 Sep 2019 00:44:35 +0000 (00:44 +0000)]
AMDGPU/GlobalISel: Legalize G_FMAD

Unlike SelectionDAG, treat this as a normally legalizable operation.
In SelectionDAG this is supposed to only ever formed if it's legal,
but I've found that to be restricting. For AMDGPU this is contextually
legal depending on whether denormal flushing is allowed in the use
function.

Technically we currently treat the denormal mode as a subtarget
feature, so custom lowering could be avoided. However I consider this
to be a defect, and this should be contextually dependent on the
controllable rounding mode of the parent function.

llvm-svn: 371800

4 years agoRevert r371785.
Manoj Gupta [Fri, 13 Sep 2019 00:28:37 +0000 (00:28 +0000)]
Revert r371785.

r371785 is causing fails on clang-hexagon-elf buildbots.

llvm-svn: 371799

4 years agoAMDGPU/GlobalISel: Select G_CTPOP
Matt Arsenault [Fri, 13 Sep 2019 00:11:20 +0000 (00:11 +0000)]
AMDGPU/GlobalISel: Select G_CTPOP

llvm-svn: 371798

4 years agoDAG/GlobalISel: Correct type profile of bitcount ops
Matt Arsenault [Fri, 13 Sep 2019 00:11:14 +0000 (00:11 +0000)]
DAG/GlobalISel: Correct type profile of bitcount ops

The result integer does not need to be the same width as the input.
AMDGPU, NVPTX, and Hexagon all have patterns working around the types
matching. GlobalISel defines these as being different type indexes.

llvm-svn: 371797

4 years ago[Target] Move InferiorCall to Process
Alex Langford [Fri, 13 Sep 2019 00:02:05 +0000 (00:02 +0000)]
[Target] Move InferiorCall to Process

Summary:
InferiorCall is only ever used in Process, and it is not specific to
POSIX. By moving it to Process, we can remove all dependencies on plugins from
Process. Moving InferiorCall to Process seems to achieve this quite well.
Additionally, the name InferiorCall is a little vague now, so we rename
it something a bit more specific.

Reviewers: JDevlieghere, clayborg, compnerd, labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D67472

llvm-svn: 371796

4 years agoThe setUp/tearDown methods I added mssed up the test function; reorder.
Jason Molenda [Fri, 13 Sep 2019 00:01:49 +0000 (00:01 +0000)]
The setUp/tearDown methods I added mssed up the test function; reorder.

Thanks to Ted Woodward for catching this one.

llvm-svn: 371795

4 years ago[libclang] Fix UninstallAbortingLLVMFatalErrorHandler test
Jan Korous [Thu, 12 Sep 2019 23:51:48 +0000 (23:51 +0000)]
[libclang] Fix UninstallAbortingLLVMFatalErrorHandler test

llvm-svn: 371794

4 years agoAMDGPU: Add immarg to llvm.amdgcn.init.exec.from.input
Matt Arsenault [Thu, 12 Sep 2019 23:46:54 +0000 (23:46 +0000)]
AMDGPU: Add immarg to llvm.amdgcn.init.exec.from.input

As far as I can tell this has to be a constant.

llvm-svn: 371793

4 years agoLiveIntervals: Remove assertion
Matt Arsenault [Thu, 12 Sep 2019 23:46:51 +0000 (23:46 +0000)]
LiveIntervals: Remove assertion

This testcase is invalid, and caught by the verifier. For the verifier
to catch it, the live interval computation needs to complete. Remove
the assert so the verifier catches this, which is less confusing.

In this testcase there is an undefined use of a subregister, and lanes
which aren't used or defined. An equivalent testcase with the
super-register shrunk to have no untouched lanes already hit this
verifier error.

llvm-svn: 371792

4 years agoAMDGPU: Inline constant when materalizing FI with add on gfx9
Matt Arsenault [Thu, 12 Sep 2019 23:46:46 +0000 (23:46 +0000)]
AMDGPU: Inline constant when materalizing FI with add on gfx9

This was relying on the SGPR usable for the carry out clobber to also
be used for the input. There was no carry out on gfx9. With no carry
out clobber to worry about, so the literal can just be directly used
with a VOP2 add.

llvm-svn: 371791

4 years ago[Test] Restructure check lines to show differences between modes more clearly
Philip Reames [Thu, 12 Sep 2019 23:22:37 +0000 (23:22 +0000)]
[Test] Restructure check lines to show differences between modes more clearly

With the landing of the previous patch (in particular D66318) there are a lot fewer diffs now.  I added an experimental O0 line, and updated all the tests to group experimental and non-experimental O0/O3 together.

Skimming the remaining diffs, there's only a few which are obviously incorrect.  There's a large number which are questionable, so more todo.

llvm-svn: 371790

4 years agoRename nonvolatile_load/store to simple_load/store [NFC]
Philip Reames [Thu, 12 Sep 2019 23:03:39 +0000 (23:03 +0000)]
Rename nonvolatile_load/store to simple_load/store [NFC]

Implement the TODO from D66318.

llvm-svn: 371789

4 years ago[AArch64][GlobalISel] Support tail calling with swiftself parameters
Jessica Paquette [Thu, 12 Sep 2019 23:00:59 +0000 (23:00 +0000)]
[AArch64][GlobalISel] Support tail calling with swiftself parameters

Swiftself uses a callee-saved register. We can tail call when the register used
in the caller and callee is the same.

This behaviour is equivalent to that in `TargetLowering::parametersInCSRMatch`.

Update call-translator-tail-call.ll to verify that we can do this. When we
support inline assembly, we can write a check similar to the one in the
general swiftself.ll. For now, we need to verify that we get the correct COPY
instruction after call lowering.

Differential Revision: https://reviews.llvm.org/D67511

llvm-svn: 371788

4 years ago[libclang] Expose abort()-ing LLVM fatal error handler
Jan Korous [Thu, 12 Sep 2019 22:55:55 +0000 (22:55 +0000)]
[libclang] Expose abort()-ing LLVM fatal error handler

Differential Revision: https://reviews.llvm.org/D66775

llvm-svn: 371787

4 years ago[SDAG] Update generic code to conservatively check for isAtomic in addition to isVolatile
Philip Reames [Thu, 12 Sep 2019 22:49:17 +0000 (22:49 +0000)]
[SDAG] Update generic code to conservatively check for isAtomic in addition to isVolatile

This is the first sweep of generic code to add isAtomic bailouts where appropriate. The intention here is to have the switch from AtomicSDNode to LoadSDNode/StoreSDNode be close to NFC; that is, I'm not looking to allow additional optimizations at this time. That will come later.  See D66309 for context.

Differential Revision: https://reviews.llvm.org/D66318

llvm-svn: 371786

4 years agoAdd -Wpoison-system-directories warning
Manoj Gupta [Thu, 12 Sep 2019 22:36:13 +0000 (22:36 +0000)]
Add -Wpoison-system-directories warning

When using clang as a cross-compiler, we should not use system
headers to do the compilation.
This CL adds support of a new warning flag -Wpoison-system-directories which
emits warnings if --sysroot is set and headers from common host system location
are used.
By default the warning is disabled.

The intention of the warning is to catch bad includes which are usually
generated by third party build system not targeting cross-compilation.
Such cases happen in Chrome OS when someone imports a new package or upgrade
one to a newer version from upstream.

Patch by: denik (Denis Nikitin)

llvm-svn: 371785

4 years ago[NFC] Sort source files in Utility/CMakeLists.txt
Jonas Devlieghere [Thu, 12 Sep 2019 22:34:59 +0000 (22:34 +0000)]
[NFC] Sort source files in Utility/CMakeLists.txt

llvm-svn: 371784

4 years ago[NFC] Fix file header filename to be Range.h
Greg Clayton [Thu, 12 Sep 2019 22:23:03 +0000 (22:23 +0000)]
[NFC] Fix file header filename to be Range.h

llvm-svn: 371783

4 years ago[Docs] Adds page for reference docs
DeForest Richards [Thu, 12 Sep 2019 22:17:04 +0000 (22:17 +0000)]
[Docs] Adds page for reference docs

Adds a Reference Documentation page for LLVM and API reference documentation.

llvm-svn: 371782

4 years ago[analyzer] Fix the 'analyzer-enabled-checkers.c' test on non-linux machines.
Artem Dergachev [Thu, 12 Sep 2019 22:11:15 +0000 (22:11 +0000)]
[analyzer] Fix the 'analyzer-enabled-checkers.c' test on non-linux machines.

'-Xclang -triple' doesn't seem to override the default target triple
as reliably as '--target'. This leads to test failing due to
platform-specific checks getting unexpectedly enabled.

llvm-svn: 371781

4 years ago[AArch64][GlobalISel] Support sibling calls with outgoing arguments
Jessica Paquette [Thu, 12 Sep 2019 22:10:36 +0000 (22:10 +0000)]
[AArch64][GlobalISel] Support sibling calls with outgoing arguments

This adds support for lowering sibling calls with outgoing arguments.

e.g

```
define void @foo(i32 %a)
```

Support is ported from AArch64ISelLowering's `isEligibleForTailCallOptimization`.
The only thing that is missing is a full port of
`TargetLowering::parametersInCSRMatch`. So, if we're using swiftself,
we'll never tail call.

- Rename `analyzeCallResult` to `analyzeArgInfo`, since the function is now used
  for both outgoing and incoming arguments
- Teach `OutgoingArgHandler` about tail calls. Tail calls use frame indices for
  stack arguments.
- Teach `lowerFormalArguments` to set the bytes in the caller's stack argument
  area. This is used later to check if the tail call's parameters will fit on
  the caller's stack.
- Add `areCalleeOutgoingArgsTailCallable` to perform the eligibility check on
  the callee's outgoing arguments.

For testing:

- Update call-translator-tail-call to verify that we can now tail call with
  outgoing arguments, use G_FRAME_INDEX for stack arguments, and respect the
  size of the caller's stack
- Remove GISel-specific check lines from speculation-hardening.ll, since GISel
  now tail calls like the other selectors
- Add a GISel test line to tailcall-string-rvo.ll since we can tail call in that
  test now
- Add a GISel test line to tailcall_misched_graph.ll since we tail call there
  now. Add specific check lines for GISel, since the debug output from the
  machine-scheduler differs with GlobalISel. The dependency still holds, but
  the output comes out in a different order.

Differential Revision: https://reviews.llvm.org/D67471

llvm-svn: 371780

4 years ago[PowerPC] Remove the SPE4RC register class and instead add f32 to the GPRC register...
Craig Topper [Thu, 12 Sep 2019 22:07:35 +0000 (22:07 +0000)]
[PowerPC] Remove the SPE4RC register class and instead add f32 to the GPRC register class.

Summary:
Since the SPE4RC register class contains an identical set of registers
and an identical spill size to the GPRC class its slightly confusing
the tablegen emitter. It's preventing the GPRC_and_GPRC_NOR0 synthesized
register class from inheriting VTs and AltOrders from GPRC or GPRC_NOR0.
This is because SPE4C is found first in the super register class list
when inheriting these properties and it doesn't set the VTs or
AltOrders the same way as GPRC or GPRC_NOR0.

This patch replaces all uses of GPE4RC with GPRC and allows GPRC and
GPRC_NOR0 to contain f32.

The test changes here are because the AltOrders are being inherited
to GPRC_NOR0 now.

Found while trying to determine if getCommonSubClass needs to take
a VT argument. It was originally added to support fp128 on x86-64,
I've changed some things about that so that it might be needed
anymore. But a PowerPC test crashed without it and I think its
due to this subclass issue.

Reviewers: jhibbits, nemanjai, kbarton, hfinkel

Subscribers: wuzish, nemanjai, mehdi_amini, hiraditya, kbarton, MaskRay, dexonsmith, jsji, shchenz, steven.zhang, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67513

llvm-svn: 371779

4 years ago[COFF] Fix to not add archive name to buffer identifiers when they come
Amy Huang [Thu, 12 Sep 2019 22:04:56 +0000 (22:04 +0000)]
[COFF] Fix to not add archive name to buffer identifiers when they come
from thin archives.

Currently lld adds the archive name to MemoryBufferRef identifiers in order to
ensure they are unique. For thin archives, since the file name is already unique and we
want to keep the original path to the file, don't add the archive name.

Differential Revision: https://reviews.llvm.org/D67295

llvm-svn: 371778

4 years agoRemove a duplicate test
Philip Reames [Thu, 12 Sep 2019 21:40:15 +0000 (21:40 +0000)]
Remove a duplicate test

Turns out I'd already added exactly the same test under the name non_unit_stride.

llvm-svn: 371777

4 years ago[SCEV] Add smin support to getRangeRef
Philip Reames [Thu, 12 Sep 2019 21:32:27 +0000 (21:32 +0000)]
[SCEV] Add smin support to getRangeRef

We were failing to compute trip counts (both exact and maximum) for any loop which involved a comparison against either an umin or smin. It looks like this simply got missed when we added smin/umin to SCEV.  (Note: umin was submitted separately earlier today.  Turned out two folks hit this at the same time.)

Differential Revision: https://reviews.llvm.org/D67514

llvm-svn: 371776

4 years ago[DAGCombiner][X86] Pass the CmpOpVT to reduceSelectOfFPConstantLoads so X86 can exclu...
Craig Topper [Thu, 12 Sep 2019 21:30:18 +0000 (21:30 +0000)]
[DAGCombiner][X86] Pass the CmpOpVT to reduceSelectOfFPConstantLoads so X86 can exclude fp128 compares.

The X86 decision assumes the compare will produce a result in an XMM
register, but that can't happen for an fp128 compare since those
go to a libcall the returns an i32. Pass the VT so X86 can check
the type.

llvm-svn: 371775

4 years ago[ConstantFolding] Expand folding of some library functions
Evandro Menezes [Thu, 12 Sep 2019 21:23:22 +0000 (21:23 +0000)]
[ConstantFolding] Expand folding of some library functions

Expanding the folding of `nearbyint()`, `rint()` and `trunc()` to library
functions, in addition to the current support for intrinsics.

Differential revision: https://reviews.llvm.org/D67468

llvm-svn: 371774

4 years ago[ClangTidy] Adjust the name getCheckName to getCheckerName due to API change.
Tim Shen [Thu, 12 Sep 2019 21:18:44 +0000 (21:18 +0000)]
[ClangTidy] Adjust the name getCheckName to getCheckerName due to API change.

llvm-svn: 371773

4 years agoFix llvm-reduce tests so that they don't assume the source code is
Tim Shen [Thu, 12 Sep 2019 21:03:49 +0000 (21:03 +0000)]
Fix llvm-reduce tests so that they don't assume the source code is
writable.

Instead of copying over the original file permissions, just create
a new file and add the executable bit.

llvm-svn: 371772

4 years ago[SelectionDAGBuilder] Simplify loop in visitSelect back to how it was before r255558.
Craig Topper [Thu, 12 Sep 2019 21:00:32 +0000 (21:00 +0000)]
[SelectionDAGBuilder] Simplify loop in visitSelect back to how it was before r255558.

This code was changed to accomodate fp128 being softened to itself
during type legalization on x86-64. This was done in order to create
libcalls while having fp128 as a legal type. We're now doing the
libcall creation during LegalizeDAG and the type legalization changes
to enable the old behavior have been removed. So this change to
SelectionDAGBuilder is no longer needed.

llvm-svn: 371771

4 years ago[X86] Move negateFMAOpcode helper earlier to help future patch. NFCI.
Simon Pilgrim [Thu, 12 Sep 2019 20:39:56 +0000 (20:39 +0000)]
[X86] Move negateFMAOpcode helper earlier to help future patch. NFCI.

llvm-svn: 371770

4 years ago[LV] Update test case after r371768.
Florian Hahn [Thu, 12 Sep 2019 20:07:17 +0000 (20:07 +0000)]
[LV] Update test case after r371768.

llvm-svn: 371769

4 years ago[SCEV] Support SCEVUMinExpr in getRangeRef.
Florian Hahn [Thu, 12 Sep 2019 20:03:32 +0000 (20:03 +0000)]
[SCEV] Support SCEVUMinExpr in getRangeRef.

This patch adds support for SCEVUMinExpr to getRangeRef,
similar to the support for SCEVUMaxExpr.

Reviewers: sanjoy.google, efriedma, reames, nikic

Reviewed By: sanjoy.google

Differential Revision: https://reviews.llvm.org/D67177

llvm-svn: 371768

4 years agoImprove code generation for thread_local variables:
Richard Smith [Thu, 12 Sep 2019 20:00:24 +0000 (20:00 +0000)]
Improve code generation for thread_local variables:

Summary:
 * Don't bother using a thread wrapper when the variable is known to
   have constant initialization.
 * Emit the thread wrapper as discardable-if-unused in TUs that don't
   contain a definition of the thread_local variable.
 * Don't emit the thread wrapper at all if the thread_local variable
   is unused and discardable; it will be emitted by all TUs that need
   it.

Reviewers: rjmccall, jdoerfert

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67429

llvm-svn: 371767

4 years ago[Clang][CodeGen] support alias attribute w/ gnu_inline
Nick Desaulniers [Thu, 12 Sep 2019 19:53:35 +0000 (19:53 +0000)]
[Clang][CodeGen] support alias attribute w/ gnu_inline

Summary:
r369705 did not consider the addition of gnu_inline on function
declarations of alias attributed functions. This resulted in a reported
regression in the clang-9-rc4 release from the Zig developers building
glibc, which was observable as a failed assertion:

llvm-project/clang/lib/AST/Decl.cpp:3336: bool
clang::FunctionDecl::isInlineDefinitionExternallyVisible() const:
Assertion `(doesThisDeclarationHaveABody() || willHaveBody()) && "Must
be a function definition"' failed.

Alias function declarations do not have bodies, so allow us to proceed
if we have the alias function attribute but no body/definition, and add
a test case.  The emitted symbols and their linkage matches GCC for the
added test case.

Link: https://bugs.llvm.org/show_bug.cgi?id=43268
Reviewers: aaron.ballman, rsmith, erichkeane, andrewrk

Reviewed By: andrewrk

Subscribers: cfe-commits, andrewrk, hans, srhines

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67455

llvm-svn: 371766