15 months ago[libc] Move implementations of cosf, sinf, sincosf to src/math directory.
Siva Chandra Reddy [Mon, 23 Mar 2020 19:00:35 +0000 (12:00 -0700)]
[libc] Move implementations of cosf, sinf, sincosf to src/math directory.

NFC intended in the implementaton. Only mechanical changes to fit the LLVM
libc implementation standard have been done.

Math testing infrastructure has been added. This infrastructure compares the
results produced by the libc with the high precision results from MPFR.
Tests making use of this infrastructure have been added for cosf, sinf and

Reviewers: abrachet, phosek

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

15 months ago[MachineSink] Fix for breaking phi edges with instructions with multiple defs
David Green [Thu, 16 Apr 2020 14:23:49 +0000 (15:23 +0100)]
[MachineSink] Fix for breaking phi edges with instructions with multiple defs

BreakPHIEdge would be set based on whether the instruction needs to
insert a new critical edge to allow sinking into a block where the uses
are PHI nodes. But for instructions with multiple defs it would be reset
on the second def, allowing the instruciton to sink where it should not.

Fixes PR44981

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

15 months ago[MLIR] Fix MLIR build - add missing CMake dependency
Uday Bondhugula [Thu, 16 Apr 2020 15:10:38 +0000 (20:40 +0530)]
[MLIR] Fix MLIR build - add missing CMake dependency

This will fix a failure when using a linker sensitive to the order in
which libraries are passed.

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

15 months ago[flang] Use the Flang cmake-functions to add targets.
Mehdi Chinoune [Thu, 16 Apr 2020 12:34:17 +0000 (13:34 +0100)]
[flang] Use the Flang cmake-functions to add targets.

Summary: It also removes the cycle-dependency between FortranSemantics and FortranEvaluate.

Reviewers: #flang, jdoerfert, sscalpone

Reviewed By: #flang, sscalpone

Subscribers: DavidTruby, schweitz, tskeith, mgorny, aartbik, llvm-commits

Tags: #flang, #llvm

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

15 months ago[clang][AST] Support AST files larger than 512M
Dmitry Polukhin [Sat, 21 Mar 2020 20:52:51 +0000 (13:52 -0700)]
[clang][AST] Support AST files larger than 512M

Clang uses 32-bit integers for storing bit offsets from the beginning of
the file that results in 512M limit on AST file. This diff replaces
absolute offsets with relative offsets from the beginning of
corresponding data structure when it is possible. And uses 64-bit
offsets for DeclOffests and TypeOffssts because these coder AST
section may easily exceeds 512M alone.

This diff breaks AST file format compatibility so VERSION_MAJOR bumped.

Test Plan:
Existing clang AST serialization tests
Tested on clangd with ~700M and ~900M preamble files

Reviewers: rsmith, dexonsmith

Subscribers: ilya-biryukov, kadircet, usaxena95, cfe-commits

Tags: #clang

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

15 months agoMCValue.h - cleanup include and forward declaration. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 14:18:10 +0000 (15:18 +0100)]
MCValue.h - cleanup include and forward declaration. NFC.
Remove MCSymbol.h include
Remove unused MCAsmInfo forward declaration

15 months ago[ASTImporter] Fix bug introduced in 2ba4e3a4598b
Gabor Marton [Thu, 16 Apr 2020 13:48:13 +0000 (15:48 +0200)]
[ASTImporter] Fix bug introduced in 2ba4e3a4598b

2ba4e3a4598b (Move FPFeatures from BinaryOperator bitfields to Trailing
storage, D76384) introduced an assertion failure during CTU analysis.
The reason is that in ASTNodeImporter::VisitCompoundAssignOperator the
LHSType and the ResultType have been imported twice.

clang: ../../git/llvm-project/clang/lib/Basic/SourceManager.cpp:918: clang::FileID clang::SourceManager::getFileIDLoaded(unsigned int) const: Assertion `0 && "Invalid SLocOffset or bad function choice"' failed.
clang::SourceManager::getDecomposedExpansionLoc(clang::SourceLocation) const
clang::SourceManager::getPresumedLoc(clang::SourceLocation, bool) const
llvm::Error clang::ASTImporter::importInto<clang::SourceLocation>(clang::SourceLocation&, clang::SourceLocation const&)
clang::ASTNodeImporter::ImportDeclParts(clang::NamedDecl*, clang::DeclContext*&, clang::DeclContext*&, clang::DeclarationName&, clang::NamedDecl*&, clang::SourceLocation&)
clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*)
clang::ASTNodeImporter::VisitRecordType(clang::RecordType const*)
clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*)
clang::ASTNodeImporter::VisitElaboratedType(clang::ElaboratedType const*)
clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*)
clang::ASTNodeImporter::VisitPointerType(clang::PointerType const*)
clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*)
clang::QualType clang::ASTNodeImporter::importChecked<clang::QualType>(llvm::Error&, clang::QualType const&)

15 months agoAntiDepBreaker.h - remove unused MachineOperand.h include. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 13:59:31 +0000 (14:59 +0100)]
AntiDepBreaker.h - remove unused MachineOperand.h include. NFC.

15 months agoMCObjectWriter.h - remove unnecessary includes. NFC
Simon Pilgrim [Thu, 16 Apr 2020 13:55:39 +0000 (14:55 +0100)]
MCObjectWriter.h - remove unnecessary includes. NFC

The EndianStream.h/raw_ostream.h headers should be removed as well but we have a lot of other files that are implicitly relying on them being present.

15 months agoWasmEHFuncInfo.h - reduce BasicBlock.h/MachineBasicBlock.h includes to just forward...
Simon Pilgrim [Thu, 16 Apr 2020 13:09:20 +0000 (14:09 +0100)]
WasmEHFuncInfo.h - reduce BasicBlock.h/MachineBasicBlock.h includes to just forward declarations. NFC.

15 months ago[libc++] Support arbitrary .sh.X extensions in the new format
Louis Dionne [Thu, 16 Apr 2020 13:52:44 +0000 (09:52 -0400)]
[libc++] Support arbitrary .sh.X extensions in the new format

This allows writing all kinds of ShTests, for example .sh.py tests for
testing Python code.

15 months ago[mlir][Linalg] Drop function attribute from generic ops.
Nicolas Vasilache [Thu, 16 Apr 2020 13:46:00 +0000 (09:46 -0400)]
[mlir][Linalg] Drop function attribute from generic ops.

The function attribute in generic ops is not paying for itself.
A region is the more standardized way of specifying a custom computation.
If needed this region can call a function directly.
This is deemed more natural than managing a dedicated function attribute.

This also simplifies named ops generation by trimming unnecessary complexity.

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

15 months agoDisallow [[nodiscard]] on a function pointer declaration.
Aaron Ballman [Thu, 16 Apr 2020 13:27:37 +0000 (09:27 -0400)]
Disallow [[nodiscard]] on a function pointer declaration.

This is not allowed by [dcl.attr.nodiscard]p1 for the standard attribute, but
is still supported for the [[clang::warn_unused_result]] spelling.

15 months ago[Float2Int] Stop passing around a reference to the class member Roots. NFC
Bjorn Pettersson [Wed, 15 Apr 2020 11:32:31 +0000 (13:32 +0200)]
[Float2Int] Stop passing around a reference to the class member Roots. NFC

The Float2IntPass got a class member called Roots, but Roots
was also passed around to member function as a reference. This
patch simply remove those references.

15 months ago[clang-format] Do not interpret C# deconstruction in a foreach as a cast
Jonathan Coe [Thu, 16 Apr 2020 13:20:51 +0000 (14:20 +0100)]
[clang-format] Do not interpret C# deconstruction in a foreach as a cast

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits, MyDeveloperDay

Tags: #clang-format, #clang

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

15 months ago[MLIR] Add IndexAttr to primitive attributes kinds in tablegen.
Ulysse Beaugnon [Thu, 16 Apr 2020 08:28:02 +0000 (10:28 +0200)]
[MLIR] Add IndexAttr to primitive attributes kinds in tablegen.

OpBase.td defined attributes kind for all integer types expect index. This
commit fixes that by adding an IndexAttr attribute kind. Update the
respective tests.

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

15 months ago[VE] Update logical operation instructions
Kazushi (Jam) Marukawa [Thu, 16 Apr 2020 12:34:53 +0000 (14:34 +0200)]
[VE] Update logical operation instructions

Changing all mnemonic to match assembly instructions to simplify mnemonic
naming rules. This time update all fixed-point arithmetic instructions.
This also corrects bswp operand type.

Reviewed By: simoll

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

15 months agoRevert "[MLIR] Add IndexAttr to primitive attributes kinds in tablegen."
Benjamin Kramer [Thu, 16 Apr 2020 12:28:18 +0000 (14:28 +0200)]
Revert "[MLIR] Add IndexAttr to primitive attributes kinds in tablegen."

This reverts commit 997f33cfeec9cd8c5bc913cf862794e986a4bd39. Breaks check-mlir

******************** TEST 'MLIR :: IR/attribute.mlir' FAILED ********************
: 'RUN: at line 1';   mlir-opt llvm-project/mlir/test/IR/attribute.mlir -split-input-file -verify-diagnostics | /FileCheck llvm-project/mlir/test/IR/attribute.mlir
Exit Code: 1

Command Output (stderr):
llvm-project/mlir/test/IR/attribute.mlir split at line #1:19:3: error: unexpected error: 'test.int_attrs' op requires attribute 'index_attr'
  "test.int_attrs"() {
llvm-project/mlir/test/IR/attribute.mlir split at line #120:6:3: error: unexpected error: 'test.int_attrs' op requires attribute 'index_attr'
  "test.int_attrs"() {
llvm-project/mlir/test/IR/attribute.mlir split at line #120:5:6: error: expected error "'si32_attr' failed to satisfy constraint: 32-bit signed integer attribute" was not produced
  // expected-error @+1 {{'si32_attr' failed to satisfy constraint: 32-bit signed integer attribute}}
llvm-project/mlir/test/IR/attribute.mlir split at line #133:5:3: error: unexpected error: 'test.int_attrs' op requires attribute 'index_attr'
  "test.int_attrs"() {
llvm-project/mlir/test/IR/attribute.mlir split at line #133:4:6: error: expected error "'ui32_attr' failed to satisfy constraint: 32-bit unsigned integer attribute" was not produced
  // expected-error @+1 {{'ui32_attr' failed to satisfy constraint: 32-bit unsigned integer attribute}}
llvm-project/mlir/test/IR/attribute.mlir:9:12: error: CHECK: expected string not found in input
 // CHECK: any_i32_attr = 5 : ui32
<stdin>:3:1: note: scanning from here
module {
<stdin>:21:28: note: possible intended match here
 "test.non_negative_int_attr"() {i32attr = 5 : i32, i64attr = 10 : i64} : () -> ()

15 months ago[MLIR] Allow for multiple gpu modules during translation.
Stephan Herhut [Thu, 16 Apr 2020 11:14:43 +0000 (13:14 +0200)]
[MLIR] Allow for multiple gpu modules during translation.

This change makes the ModuleTranslation threadsafe by locking on the
LLVMContext. Furthermore, we now clone the llvm module into a new
context when compiling to PTX similar to what the OrcJit does.

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

15 months agoyaml2obj.h - cleanup includes and forward declaration. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 11:58:44 +0000 (12:58 +0100)]
yaml2obj.h - cleanup includes and forward declaration. NFC.
Reduce StringRef.h/Error.h includes to just the necessary STLExtras.h include and StringRef/Twine forward declarations
Remove unused Expected<> forward declaration

15 months agoParser.h/cpp - cleanup includes and forward declaration. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 11:37:46 +0000 (12:37 +0100)]
Parser.h/cpp - cleanup includes and forward declaration. NFC.
Parser.h - Reduce MemoryBuffer.h include to just the necessary StringRef.h include and MemoryBufferRef forward declaration
Parser.cpp - Remove unused raw_ostream.h include

15 months agoPass.h/cpp - cleanup includes and forward declaration. NFC.
Simon Pilgrim [Thu, 16 Apr 2020 11:08:10 +0000 (12:08 +0100)]
Pass.h/cpp - cleanup includes and forward declaration. NFC.

Remove unused BasicBlock forward declaration from Pass.h and Attributes/BasicBlock includes from Pass.cpp
Add BasicBlock forward declaration to UnifyFunctionExitNodes.h which was relying on Pass.h

15 months agoRevert "Revert "[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef""
Matthias Gehre [Thu, 16 Apr 2020 12:10:06 +0000 (14:10 +0200)]
Revert "Revert "[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef""

This reverts commit bac85ab3b55d02f0a1e824712f185af42cd1ea04.

15 months agoExpose AtomicType in the libclang C API.
Henry Jen [Thu, 16 Apr 2020 11:58:02 +0000 (07:58 -0400)]
Expose AtomicType in the libclang C API.

15 months agoRevert "[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef"
Benjamin Kramer [Thu, 16 Apr 2020 12:05:29 +0000 (14:05 +0200)]
Revert "[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef"

This reverts commit 83d5131d87a6f929b21b54e3fc0f9636ff64c808. Spams
llvm/ADT/StringRef.h:57:11: warning: unknown attribute 'Pointer' ignored [-Wunknown-attributes]

15 months agoIntroduce llvm::sys::Process::getProcessId() and adopt it
Sergej Jaskiewicz [Mon, 13 Apr 2020 11:26:35 +0000 (14:26 +0300)]
Introduce llvm::sys::Process::getProcessId() and adopt it

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

15 months ago[FileCheck] - Fix the false positive when -implicit-check-not is used with an unknown...
Georgii Rymar [Mon, 13 Apr 2020 15:10:53 +0000 (18:10 +0300)]
[FileCheck] - Fix the false positive when -implicit-check-not is used with an unknown -check-prefix.

Imagine we have the following invocation:

`FileCheck -check-prefix=UNKNOWN-PREFIX -implicit-check-not=something`

When the check prefix does not exist it does not fail.
This patch fixes the issue.

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

15 months ago[clangd] Pull installed gRPC and introduce clangd-remote-(server|client)
Kirill Bobyrev [Thu, 16 Apr 2020 09:10:03 +0000 (11:10 +0200)]
[clangd] Pull installed gRPC and introduce clangd-remote-(server|client)

This patch allows using installed gRPC to build two simple tools which
currently provide the functionality of looking up the symbol by name.
remote-index-client is a simplified version of dexp which connects to
remote-index-server passes lookup requests.

I also significantly reduced the scope of this patch to prevent large changelist
and more bugs. The next steps would be:

* Extending Protocol for deep copies of Symbol and inherit RemoteIndex from
  Index to unify the interfaces
* Make remote-index-server more generic and merge the remote index client with
* Modify Clangd to allow using remote index instead of the local one for all
  global index requests

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

15 months ago[MIR] Add comments to INLINEASM immediate flag MachineOperands
Konstantin Schwarz [Tue, 14 Apr 2020 07:24:40 +0000 (09:24 +0200)]
[MIR] Add comments to INLINEASM immediate flag MachineOperands

The INLINEASM MIR instructions use immediate operands to encode the values of some operands.
The MachineInstr pretty printer function already handles those operands and prints human readable annotations instead of the immediates. This patch adds similar annotations to the output of the MIRPrinter, however uses the new MIROperandComment feature.

Reviewers: SjoerdMeijer, arsenm, efriedma

Reviewed By: arsenm

Subscribers: qcolombet, sdardis, jvesely, wdng, nhaehnle, hiraditya, jrtc27, atanasyan, kerbowa, llvm-commits

Tags: #llvm

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

15 months ago[LiveIntervals] Replace handleMoveIntoBundle
Carl Ritson [Thu, 16 Apr 2020 10:57:55 +0000 (19:57 +0900)]
[LiveIntervals] Replace handleMoveIntoBundle

The current handleMoveIntoBundle implementation is unusable,
it attempts to access the slot indexes of bundled instructions.
It also leaves bundled instructions with slot indexes assigned.

Replace handleMoveIntoBundle this with a more explicit
handleMoveIntoNewBundle function which recalculates the live
intervals for all instructions moved into a newly formed bundle,
and removes slot indexes from these instructions.

Reviewers: arsenm, MaskRay, kariddi, tpr, qcolombet

Reviewed By: qcolombet

Subscribers: MatzeB, wdng, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

15 months ago[AST] Fix an undefine behavior when creating an empty recovery expr.
Haojian Wu [Thu, 16 Apr 2020 08:38:54 +0000 (10:38 +0200)]
[AST] Fix an undefine behavior when creating an empty recovery expr.

We forgot to initialize the NumExpr member in one of the constructors,
which leads crashes in preamble serialization.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

15 months agoFix -Wdocumentation-html warning
David Zarzycki [Thu, 16 Apr 2020 10:32:17 +0000 (06:32 -0400)]
Fix -Wdocumentation-html warning

15 months ago[CGExprAgg] Fix infinite loop in `findPeephole`
Ehud Katz [Thu, 16 Apr 2020 10:26:23 +0000 (13:26 +0300)]
[CGExprAgg] Fix infinite loop in `findPeephole`

Simplify the function using IgnoreParenNoopCasts.

Fix PR45476

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

15 months ago[MSan] Enable for SystemZ
Ilya Leoshkevich [Wed, 15 Apr 2020 23:01:11 +0000 (01:01 +0200)]
[MSan] Enable for SystemZ

This patch adds runtime support, adjusts tests and enables MSan.

Like for ASan and UBSan, compile the tests with -mbackchain.

Reviewers: eugenis, uweigand, jonpa, vitalybuka

Reviewed By: eugenis, vitalybuka

Subscribers: vitalybuka, mgorny, hiraditya, #sanitizers, stefansf, Andreas-Krebbel

Tags: #sanitizers

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

15 months ago[clang] Const correct ComputePreambleBounds
Kadir Cetinkaya [Thu, 16 Apr 2020 09:54:48 +0000 (11:54 +0200)]
[clang] Const correct ComputePreambleBounds

15 months ago[lldb/unittests] Better error messages when creating sockets fails
Pavel Labath [Thu, 16 Apr 2020 09:57:40 +0000 (11:57 +0200)]
[lldb/unittests] Better error messages when creating sockets fails

We get failures in SocketTestUtilities on the pre-merge bots. This
might give us a clue as to what's wrong.

15 months agoLangOptions cannot depend on ASTContext, make it not use ASTContext directly
Benjamin Kramer [Thu, 16 Apr 2020 09:45:02 +0000 (11:45 +0200)]
LangOptions cannot depend on ASTContext, make it not use ASTContext directly

Fixes a layering violation introduced in 2ba4e3a4598b165245c581c506a813cd4a7dce33.

15 months ago[LiveDebugValues] Terminate open ranges on DBG_VALUE $noreg
Jeremy Morse [Thu, 16 Apr 2020 09:24:47 +0000 (10:24 +0100)]
[LiveDebugValues] Terminate open ranges on DBG_VALUE $noreg

In D68209, LiveDebugValues::transferDebugValue had a call to
OpenRanges.erase shifted, and by accident this led to a code path where
DBG_VALUEs of $noreg would not have their open range terminated, allowing
variable locations to extend past blocks where they were terminated.

This patch correctly terminates the open range, if present, when such a
DBG_VAUE is encountered, and adds a test for this behaviour.

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

15 months agoAlso look for devtoolset-9 gcc toolchain
Stephan Dollberg [Thu, 16 Apr 2020 09:17:10 +0000 (11:17 +0200)]
Also look for devtoolset-9 gcc toolchain

devtoolset-9 has been out for a while so also look for it.

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

15 months ago[MLIR] Fix fusion of linalg.indexed_generic producer into tiled (Indexed)GenericOp.
Alexander Belyaev [Thu, 16 Apr 2020 08:39:42 +0000 (10:39 +0200)]
[MLIR] Fix fusion of linalg.indexed_generic producer into tiled (Indexed)GenericOp.

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

15 months ago[MLIR] NFC after commit D77478.
Lorenzo Chelini [Thu, 16 Apr 2020 08:30:11 +0000 (10:30 +0200)]
[MLIR] NFC after commit D77478.

Remove leftovers 'applyPatternsGreedily' from the codebase.

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

15 months ago[MLIR] Add IndexAttr to primitive attributes kinds in tablegen.
Ulysse Beaugnon [Thu, 16 Apr 2020 08:28:02 +0000 (10:28 +0200)]
[MLIR] Add IndexAttr to primitive attributes kinds in tablegen.

OpBase.td defined attributes kind for all integer types expect index. This
commit fixes that by adding an IndexAttr attribute kind.

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

15 months ago[MLIR] [EDSC] Add folded_xxxx handles for common std instructions.
Pierre Oechsel [Thu, 16 Apr 2020 08:24:48 +0000 (10:24 +0200)]
[MLIR] [EDSC] Add folded_xxxx handles for common std instructions.

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

15 months ago[Attributor][NFC] Reduce indention for call site attribute seeding
Johannes Doerfert [Wed, 15 Apr 2020 16:59:50 +0000 (11:59 -0500)]
[Attributor][NFC] Reduce indention for call site attribute seeding

Also added a TODO to remind us that indirect calls could be optimized as

15 months ago[Attributor][NFC] Do not create temporary maps during lookup
Johannes Doerfert [Wed, 15 Apr 2020 07:14:56 +0000 (02:14 -0500)]
[Attributor][NFC] Do not create temporary maps during lookup

The AAMap.lookup() call created a temporary value if the key was not
present. Since the value was another map it was not free to create it.
Instead of a lookup we now use find and compare the result against the
end iterator explicitly. The result is the same but we never need to
create a temporary map.

15 months agoRevert "Revert "[GlobalISel] Fix invalid combine of unmerge(merge) with intermediate...
Dominik Montada [Thu, 16 Apr 2020 07:02:46 +0000 (09:02 +0200)]
Revert "Revert "[GlobalISel] Fix invalid combine of unmerge(merge) with intermediate cast""

This reverts commit 1265899c5f7d34034a8c1f67e69a5ab6087310e7.

15 months ago[CallSite removal][TargetLowering] Remove ArgListEntry::setAttributes signature that...
Craig Topper [Thu, 16 Apr 2020 06:28:03 +0000 (23:28 -0700)]
[CallSite removal][TargetLowering] Remove ArgListEntry::setAttributes signature that took an ImmutableCallSite. NFC

There's another signature that takes a CallBase. The uses of the
ImmutableCallSite version were removed in previous patches.

15 months ago[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef
Matthias Gehre [Mon, 19 Aug 2019 21:28:04 +0000 (23:28 +0200)]
[LifetimeAnalysis] Add [[gsl::Pointer]] to llvm::StringRef

This detected the bugs fixed in

The warning itself was implemented in

Reviewers: zturner, mehdi_amini, gribozavr

Subscribers: dexonsmith, Szelethus, xazax.hun, llvm-commits

Tags: #llvm

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

15 months ago[Attributor][FIX] Handle droppable uses when replacing values
Johannes Doerfert [Sat, 11 Apr 2020 04:41:59 +0000 (23:41 -0500)]
[Attributor][FIX] Handle droppable uses when replacing values

Since we use the fact that some uses are droppable in the Attributor we
need to handle them explicitly when we replace uses. As an example, an
assumed dead value can have live droppable users. In those we cannot
replace the value simply by an undef. Instead, we either drop the uses
(via `dropDroppableUses`) or keep them as they are. In this patch we do
both, depending on the situation. For values that are dead but not
necessarily removed we keep droppable uses around because they contain
information we might be able to use later. For values that are removed
we drop droppable uses explicitly to avoid replacement with undef.

15 months ago[InstCombine] Simplify calls with casted `returned` attribute
Johannes Doerfert [Sun, 12 Apr 2020 17:41:56 +0000 (12:41 -0500)]
[InstCombine] Simplify calls with casted `returned` attribute

The handling of the `returned` attribute in D75815 did miss the case
where the argument is (bit)casted to a different type. This is
explicitly allowed by the language reference and exposed by the

Reviewed By: lebedev.ri

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

15 months ago[MustExecute][NFC] Copy function_ref instead of passing a reference
Johannes Doerfert [Sat, 11 Apr 2020 17:36:24 +0000 (12:36 -0500)]
[MustExecute][NFC] Copy function_ref instead of passing a reference

15 months ago[Attributor][FIX] Properly check for accesses to globals
Johannes Doerfert [Tue, 14 Apr 2020 23:49:59 +0000 (18:49 -0500)]
[Attributor][FIX] Properly check for accesses to globals

The check if globals were accessed was not always working because two
bits are set for NO_GLOBAL_MEM. The new check works also if only on kind
of globals (internal/external) is accessed.

15 months ago[Attributor][NFC] Run the verifier only on functions and under EXPENSIVE_CHECKS
Johannes Doerfert [Mon, 13 Apr 2020 17:24:09 +0000 (12:24 -0500)]
[Attributor][NFC] Run the verifier only on functions and under EXPENSIVE_CHECKS

Running the verifier is expensive so we want to avoid it even in runs
that enable assertions. As we move closer to enabling the Attributor
this code will be executed by some buildbots but not cause overhead for
most people.

15 months ago[CallSite removal][TargetLibraryInfo] Replace ImmutableCallSite with CallBase in...
Craig Topper [Thu, 16 Apr 2020 05:02:35 +0000 (22:02 -0700)]
[CallSite removal][TargetLibraryInfo] Replace ImmutableCallSite with CallBase in one of the getLibFunc signatures. NFC

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

15 months ago[llvm][NFC][CallSite] Removed CallSite from some implementation details.
Mircea Trofin [Wed, 15 Apr 2020 23:50:57 +0000 (16:50 -0700)]
[llvm][NFC][CallSite] Removed CallSite from some implementation details.

Reviewers: craig.topper, dblaikie

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

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

15 months ago[X86] Add interface X86II::isPseudo
Shengchen Kan [Thu, 16 Apr 2020 04:37:24 +0000 (12:37 +0800)]
[X86] Add interface X86II::isPseudo

Avoid duplicate code in X86MCCodeEmitter, NFCI.

15 months ago[MC][COFF][ELF] Reject instructions in IMAGE_SCN_CNT_UNINITIALIZED_DATA/SHT_NOBITS...
Fangrui Song [Tue, 14 Apr 2020 18:05:21 +0000 (11:05 -0700)]

For `.bss; nop`, MC inappropriately calls abort() (via report_fatal_error()) with a message
`cannot have fixups in virtual section!`
It is a bug to crash for invalid user input. Fix it by erroring out early in EmitInstToData().

Similarly, emitIntValue() in a virtual section (SHT_NOBITS in ELF) can crash with the mssage
`non-zero initializer found in section '.bss'` (see D4199)
It'd be nice to report the location but so many directives can call emitIntValue()
and it is difficult to track every location.
Note, COFF does not crash because MCAssembler::writeSectionData() is not

Note, GNU as' arm64 backend reports ``Error: attempt to store non-zero value in section `.bss'``
for a non-zero .inst but fails to do so for other instructions.
We simply reject all instructions, even if the encoding is all zeros.

The Mach-O counterpart is D48517 (see `test/MC/MachO/zerofill-text.s`)

Reviewed By: rnk, skan

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

15 months agoFix build by adding missing CMake link dependency
Mehdi Amini [Thu, 16 Apr 2020 03:47:02 +0000 (03:47 +0000)]
Fix build by adding missing CMake link dependency

This would only fail when using a linker that is sensitive to the order
in which the libraries are passed on the command line (like bfd).

15 months ago[X86][MC][NFC] Code cleanup in X86MCCodeEmitter
Shengchen Kan [Thu, 16 Apr 2020 03:24:35 +0000 (11:24 +0800)]
[X86][MC][NFC] Code cleanup in X86MCCodeEmitter

Make some function static, move the definitions of functions to a better
place and use C++ style cast, etc.

15 months ago[Attributor] Lazily collect function information
Johannes Doerfert [Sat, 11 Apr 2020 17:37:09 +0000 (12:37 -0500)]
[Attributor] Lazily collect function information

Before, we eagerly analyzed all the functions to collect information
about them, e.g. what instructions may read/write memory. This had
multiple drawbacks:
  - In CGSCC-mode we can end up looking at a callee which is not in the
    SCC but for which we need an initialized cache.
  - We end up looking at functions that we deem dead and never need to
    analyze in the first place.
  - We have a implicit dependence which is easy to break.

This patch moves the function analysis into the information cache and
makes it lazy. There is no real functional change expected except due to
the first reason above.

15 months ago[Attributor] Replace call graph call sites after function replacement
Johannes Doerfert [Thu, 16 Apr 2020 03:21:17 +0000 (22:21 -0500)]
[Attributor] Replace call graph call sites after function replacement

The CallGraphUpdater allows to directly alter call site information and
we should do so. This might appease the windows buildbot that crashes
during the SCC traversal.

15 months ago[X86][MC][NFC] Refine code in X86MCCodeEmitter
Shengchen Kan [Thu, 16 Apr 2020 02:36:31 +0000 (10:36 +0800)]
[X86][MC][NFC] Refine code in X86MCCodeEmitter

As we mentioned in D78180, merge some if clauses and use CamelCase for
variables, etc.

15 months ago[NFC, msan] Increase stack in small stack tests
Vitaly Buka [Thu, 16 Apr 2020 02:36:11 +0000 (19:36 -0700)]
[NFC, msan] Increase stack in small stack tests

Test fails in our setup if used with libunwind.
It needs just few bytest to pass.

15 months agoFix memory leak introduced by llvmorg-11-init-11960-gbab6df86aef.
Richard Smith [Thu, 16 Apr 2020 02:38:49 +0000 (19:38 -0700)]
Fix memory leak introduced by llvmorg-11-init-11960-gbab6df86aef.

15 months ago[Attributor] Remove large and seemingly useless test
Johannes Doerfert [Thu, 9 Apr 2020 00:04:57 +0000 (19:04 -0500)]
[Attributor] Remove large and seemingly useless test

This was supposed to be part of D76588 already.

15 months ago[CallGraphUpdater][NFC] Minor updates to D77855
Johannes Doerfert [Thu, 9 Apr 2020 20:43:31 +0000 (15:43 -0500)]
[CallGraphUpdater][NFC] Minor updates to D77855

I uploaded the old version accidentally instead of the one with these
minor adjustments requested by the reviewers.

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

15 months ago[X86][MC][NFC] Reduce the parameters of functions in X86MCCodeEmitter(Part I)
Shengchen Kan [Wed, 15 Apr 2020 05:37:46 +0000 (13:37 +0800)]
[X86][MC][NFC] Reduce the parameters of functions in X86MCCodeEmitter(Part I)

The function in X86MCCodeEmitter has too many parameters to make it look
messy, and some parameters are unnecessary. This is the first patch to
reduce their parameters.

The follwing operations are cheap
unsigned Opcode = MI.getOpcode();
const MCInstrDesc &Desc = MCII.get(Opcode);
uint64_t TSFlags = Desc.TSFlags;
So if we pass a `MCInst`, we don't need to pass `MCInstrDesc`;
if we pass a `MCInstrDesc`, we don't need to pass `TSFlags`.

Reviewers: craig.topper, MaskRay, pengfei

Reviewed By: craig.topper

Subscribers: annita.zhang, hiraditya, llvm-commits

Tags: #llvm

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

15 months ago[MC] Replace MCSection*::getName() with MCSection::getName(). NFC
Fangrui Song [Wed, 15 Apr 2020 22:49:05 +0000 (15:49 -0700)]
[MC] Replace MCSection*::getName() with MCSection::getName(). NFC

I plan to use MCSection::getName() in D78138. Having the function in the base class is also convenient for debugging.

Reviewed By: rnk

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

15 months ago[Attributor] Unify testing (=updates,prefixes,run configurations,...)
Johannes Doerfert [Thu, 9 Apr 2020 00:04:57 +0000 (19:04 -0500)]
[Attributor] Unify testing (=updates,prefixes,run configurations,...)

When the Attributor was created the test update scripts were not well
suited to deal with the challenges of IR attribute checking. This
partially improved.

Since then we also added three additional configurations that need
testing; in total we now have the following four:
{ TUNIT, CGSCC } x { old pass manager (OPM), new pass manager (NPM) }

Finally, the number of developers and tests grew rapidly (partially due
to the addition of ArgumentPromotion and IPConstantProp tests), which
resulted in tests only being run in some configurations, different
prefixes being used, and different "styles" of checks being used.

Due to the above reasons I believed we needed to take another look at
the test update scripts. While we started to use them, via UTC_ARGS:
--enable/disable, the other problems remained. To improve the testing
situation for *all* configurations, to simplify future updates to the
test, and to help identify subtle effects of future changes, we now use
the test update scripts for (almost) all Attributor tests.

An exhaustive prefix list minimizes the number of check lines and makes
it easy to identify and compare configurations.

Tests have been adjusted in the process but we tried to keep their
intend unchanged.

Reviewed By: sstefan1

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

15 months agoAnother attempt of D77452 - da0e91fee614e8686f48db28e6507c8abe061fc2
Walter Erquinigo [Sat, 4 Apr 2020 02:42:58 +0000 (19:42 -0700)]
Another attempt of D77452 - da0e91fee614e8686f48db28e6507c8abe061fc2
[intel-pt] Improve the way the test determines whether to run

- Now I'm creating a default value for the new test parameter
- I fixed a small mistake in the skipping logic of the test

... I forgot to clear the cmake cache when testing my diff

15 months ago[mlir][Inliner] Store the resolved call by-value instead of by-reference
River Riddle [Thu, 16 Apr 2020 00:41:31 +0000 (17:41 -0700)]
[mlir][Inliner] Store the resolved call by-value instead of by-reference

This avoids asan failures as more calls may be added during inlining, invalidating the reference.

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

15 months agoRevert "Attempt to fix build with MSVC."
Richard Smith [Thu, 16 Apr 2020 00:40:00 +0000 (17:40 -0700)]
Revert "Attempt to fix build with MSVC."

This reverts commit 30853cd689efd73a005163436673c13a29eca805.

The problem that this change was working around was fixed in

15 months agoRemove vptr dispatch from FoldingSet.
Richard Smith [Wed, 15 Apr 2020 22:00:08 +0000 (15:00 -0700)]
Remove vptr dispatch from FoldingSet.

Instead of storing a vptr in each FoldingSet instance, form an
equivalent struct and pass it implicitly from FoldingSet into the
various FoldingSetBase methods.

This has three benefits:
 * FoldingSet becomes one pointer smaller.
 * Under LTO, the "virtual" functions are much easier to inline.
 * The element type no longer needs to be complete when instantiating
   FoldingSet<T>, only when instantiating an insert / lookup member.

Reviewers: rnk

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

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

15 months ago[Reassociate] Preserve AAManager and BasicAA analyses.
Alina Sbirlea [Wed, 15 Apr 2020 22:58:57 +0000 (15:58 -0700)]
[Reassociate] Preserve AAManager and BasicAA analyses.

Now Reassociate Pass invalidates the analysis results of AAManager and BasicAA,
but it saves GlobalsAA, although it seems that it should preserve them, since
it affects only Unary and Binary operators.

Author: kpolushin (Kirill)

Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D77137

15 months ago[MC] Rename MCSection*::getSectionName() to getName(). NFC
Fangrui Song [Wed, 15 Apr 2020 22:49:05 +0000 (15:49 -0700)]
[MC] Rename MCSection*::getSectionName() to getName(). NFC

A pending change will merge MCSection*::getName() to MCSection::getName().

15 months ago[CallGraphUpdater] Remove nodes from their SCC (old PM)
Johannes Doerfert [Thu, 9 Apr 2020 20:43:31 +0000 (15:43 -0500)]
[CallGraphUpdater] Remove nodes from their SCC (old PM)

We can and should remove deleted nodes from their respective SCCs. We
did not do this before and this was a potential problem even though I
couldn't locally trigger an issue. Since the `DeleteNode` would assert
if the node was not in the SCC, we know we only remove nodes from their
SCC and only once (when run on all the Attributor tests).

Reviewers: lebedev.ri, hfinkel, fhahn, probinson, wristow, loladiro, sstefan1, uenoku

Subscribers: hiraditya, bollu, uenoku, llvm-commits

Tags: #llvm

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

15 months ago[CallGraphUpdater] Update the ExternalCallingNode for node replacements
Johannes Doerfert [Thu, 9 Apr 2020 20:21:24 +0000 (15:21 -0500)]
[CallGraphUpdater] Update the ExternalCallingNode for node replacements

While it is uncommon that the ExternalCallingNode needs to be updated,
it can happen. It is uncommon because most functions listed as callees
have external linkage, modifying them is usually not allowed. That said,
there are also internal functions that have, or better had, their
"address taken" at construction time. We conservatively assume various
uses cause the address "to be taken". Furthermore, the user might have
become dead at some point. As a consequence, transformations, e.g., the
Attributor, might be able to replace a function that is listed
as callee of the ExternalCallingNode.

Since there is no function corresponding to the ExternalCallingNode, we
did just remove the node from the callee list if we replaced it (so
far). Now it would be preferable to replace it if needed and remove it
otherwise. However, removing the node has implications on the CGSCC
iteration. Locally, that caused some other nodes to be never visited
but it is for sure possible other (bad) side effects can occur. As it
seems conservatively safe to keep the new node in the callee list we
will do that for now.

Reviewers: lebedev.ri, hfinkel, fhahn, probinson, wristow, loladiro, sstefan1, uenoku

Subscribers: hiraditya, bollu, uenoku, llvm-commits

Tags: #llvm

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

15 months ago[CallGraphUpdater] Properly remove strongly connected components (oldPM)
Johannes Doerfert [Sun, 12 Apr 2020 16:52:06 +0000 (11:52 -0500)]
[CallGraphUpdater] Properly remove strongly connected components (oldPM)

The old code did eliminate references from and to functions that were
about to be deleted only just before we deleted them. This can cause
references from other functions that are supposed to be deleted to still
exist, depending on the order. If the functions form a strongly
connected component the problem manifests regardless of the order in
which we try to actually delete the functions.

This patch introduces a two step deletion. First we remove all
references and then we delete the function. Note that this only affects
the old call graph. There should not be any functional changes if no old
style call graph was given.

To test this we delete two strongly connected functions instead of one
in an existing test.

Reviewers: hfinkel

Subscribers: hiraditya, bollu, llvm-commits

Tags: #llvm

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

15 months agoRevert "[intel-pt] Improve the way the test determines whether to run"
Walter Erquinigo [Wed, 15 Apr 2020 23:35:29 +0000 (16:35 -0700)]
Revert "[intel-pt] Improve the way the test determines whether to run"

This reverts commit da0e91fee614e8686f48db28e6507c8abe061fc2.

There's a failure in
caused by a missing python object.

15 months ago[intel-pt] Improve the way the test determines whether to run
Walter Erquinigo [Sat, 4 Apr 2020 02:42:58 +0000 (19:42 -0700)]
[intel-pt] Improve the way the test determines whether to run

@labath raised a concern on the way I was skipping this test. I think that was
fair and I found a better way.
Now I'm skipping if the CMAKE flag LLDB_BUILD_INTEL_PT is false.
I added an enabled_plugins entry in the dotest configuration, which gets
set by lit or lldb-dotest. The only available plugin right now is
'intel-pt', but I imagine it will be useful in the future for other
kinds of plugins that get determined at configuration time. I didn't
want to add a new argument option --enable-intel-pt or something or the
sort, as it wouldn't be useful for other cases.

Reviewers: labath, clayborg

Subscribers: lldb-commits, labath

Tags: #lldb

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

15 months ago[SVE] Remove calls to getBitWidth from x86
Christopher Tetreault [Wed, 15 Apr 2020 22:29:30 +0000 (15:29 -0700)]
[SVE] Remove calls to getBitWidth from x86

Reviewers: efriedma, RKSimon, sdesmalen

Reviewed By: RKSimon

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

15 months ago[CallSite removal][CallSiteSplitting] Use CallBase instead of CallSite. NFC
Craig Topper [Wed, 15 Apr 2020 22:11:44 +0000 (15:11 -0700)]
[CallSite removal][CallSiteSplitting] Use CallBase instead of CallSite. NFC

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

15 months ago[CallSite removal][CloneFunction] Use CallSite instead of CallBase. NFC
Craig Topper [Wed, 15 Apr 2020 22:11:14 +0000 (15:11 -0700)]
[CallSite removal][CloneFunction] Use CallSite instead of CallBase. NFC

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

15 months ago[AMDGPU] Fixed lane mask in test. NFC.
Stanislav Mekhanoshin [Wed, 15 Apr 2020 22:16:14 +0000 (15:16 -0700)]
[AMDGPU] Fixed lane mask in test. NFC.

15 months ago[SVE] Fix unsigned is always >= 0
Christopher Tetreault [Wed, 15 Apr 2020 22:16:17 +0000 (15:16 -0700)]
[SVE] Fix unsigned is always >= 0

Reviewers: efriedma, sdesmalen

Reviewed By: sdesmalen

Subscribers: tschuett, rkruppe, psnobl, cfe-commits

Tags: #clang

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

15 months ago[LLVM][SupportTests] Ask the OS how large the page size is instead of guessing.
Michael Spencer [Wed, 15 Apr 2020 22:12:08 +0000 (15:12 -0700)]
[LLVM][SupportTests] Ask the OS how large the page size is instead of guessing.

PPC64 had a larger than expected page size. Instead of guessing just
use the same API that `MemoryBuffer` does to determine the page size.

15 months ago[AIX][PowerPC] Implement caller byval arguments in stack memory
Chris Bowler [Wed, 15 Apr 2020 21:57:31 +0000 (17:57 -0400)]
[AIX][PowerPC] Implement caller byval arguments in stack memory

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

15 months ago[PoisonChecking] Further clarify file scope comment, and update to match naming now...
Philip Reames [Wed, 15 Apr 2020 20:15:12 +0000 (13:15 -0700)]
[PoisonChecking] Further clarify file scope comment, and update to match naming now used in code

15 months ago[NFC] Adjust style and clarify comments in PoisonChecking
Philip Reames [Wed, 15 Apr 2020 20:11:10 +0000 (13:11 -0700)]
[NFC] Adjust style and clarify comments in PoisonChecking

15 months ago[NFC] Use new canCreatePoison to make code intent more clear in PoisonChecking
Philip Reames [Wed, 15 Apr 2020 19:34:48 +0000 (12:34 -0700)]
[NFC] Use new canCreatePoison to make code intent more clear in PoisonChecking

15 months ago[LLVM][SupportTests] Fix Windows build breakage
Michael Spencer [Wed, 15 Apr 2020 21:46:29 +0000 (14:46 -0700)]
[LLVM][SupportTests] Fix Windows build breakage

`MemoryBuffer::getOpenFile` take an OS file handle, not an int.

15 months ago[builtins] Fix unprototypes function declaration
Ayke van Laethem [Wed, 15 Apr 2020 13:32:58 +0000 (15:32 +0200)]
[builtins] Fix unprototypes function declaration

The following declarations were missing a prototype:

    FE_ROUND_MODE __fe_getround();
    int __fe_raise_inexact();

Discovered while fixing a bug in Clang related to unprototyped function
calls (see the previous commit).

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

15 months ago[AVR] Use the correct address space for non-prototyped function calls
Ayke van Laethem [Tue, 14 Apr 2020 16:13:41 +0000 (18:13 +0200)]
[AVR] Use the correct address space for non-prototyped function calls

Some function declarations like this:

    void foo();

do not have a type declaration, for that you'd use:

    void foo(void);

Clang internally bitcasts the variadic function declaration to a
function pointer, but doesn't use the correct address space on AVR. This
commit fixes that.

This fix is necessary to let Clang compile compiler-rt for AVR.

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

15 months ago[nfc] [lldb] Introduce DWARF callbacks (fixed-up)
Jan Kratochvil [Wed, 15 Apr 2020 21:39:40 +0000 (23:39 +0200)]
[nfc] [lldb] Introduce DWARF callbacks (fixed-up)

As requested by @labath in https://reviews.llvm.org/D73206#1949516
providing DWARF index callbacks refactorization.

It is a re-landing of the patch with a regression fix the previous
commit had.

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

15 months ago[NFC] correct "thier" to "their"
Josh Stone [Wed, 15 Apr 2020 21:38:43 +0000 (14:38 -0700)]
[NFC] correct "thier" to "their"

15 months ago[docs] Fix an RST error introduced in e823068306e.
Lang Hames [Wed, 15 Apr 2020 18:44:17 +0000 (11:44 -0700)]
[docs] Fix an RST error introduced in e823068306e.

This should fix the 'Explicit markup ends without a blank line' error seen on

Thanks to Daniel Sanders for spotting this.

15 months agoPR45561: Return a literal string rather than an error string to avoid returning refer...
David Blaikie [Wed, 15 Apr 2020 21:26:31 +0000 (14:26 -0700)]
PR45561: Return a literal string rather than an error string to avoid returning reference to local

Changing the underlying YAML support to allow returning a literal
string, rather than a StringRef, would probably be a bigger refactor so
I didn't do that.

15 months agoRemove extra ‘;’. NFC.
Michael Liao [Wed, 15 Apr 2020 21:19:48 +0000 (17:19 -0400)]
Remove extra ‘;’. NFC.

15 months agoRevert "[lit] Keep original cfg file case around."
Nico Weber [Wed, 15 Apr 2020 21:17:18 +0000 (17:17 -0400)]
Revert "[lit] Keep original cfg file case around."

This reverts commit bc3f54de1827e58655c34477d09211cbc42589bd.

The patch breaks in the following two scenarios:

1. When manually passing an absolute path to llvm-lit with a lower-case
   drive letter: `python bin\llvm-lit.py -sv c:\llvm-project\clang\test\PCH`

2. When the PWD has a lower-case drive letter, like after running
   `cd c:\` with a lower-case "c:" (cmd's default is upper-case, but
   it takes case-ness from what's passed to `cd` apparently).

15 months ago[Clang] Expose RequiresNullTerminator in FileManager.
Michael Spencer [Thu, 9 Apr 2020 03:29:39 +0000 (20:29 -0700)]
[Clang] Expose RequiresNullTerminator in FileManager.

This is needed to fix the reason
0a2be46cfdb698fe (Modules: Invalidate out-of-date PCMs as they're
discovered) and 5b44a4b07fc1d ([modules] Do not cache invalid state for
modules that we attempted to load.) were reverted.

These patches changed Clang to use `isVolatile` when loading modules.
This had the side effect of not using mmap when loading modules, and
thus greatly increased memory usage.

The reason it wasn't using mmap is because `MemoryBuffer` plays some
games with file size when you request null termination, and it has to
disable these when `isVolatile` is set as the size may change by the
time it's mmapped. Clang by default passes
`RequiresNullTerminator = true`, and `shouldUseMmap` ignored if
`RequiresNullTerminator` was even requested.

This patch adds `RequiresNullTerminator` to the `FileManager` interface
so Clang can use it when loading modules, and changes `shouldUseMmap` to
only take volatility into account if `RequiresNullTerminator` is true.
This is fine as both `mmap` and a `read` loop are vulnerable to
modifying the file while reading, but are immune to the rename Clang
does when replacing a module file.

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