LLVM/llvm 364506llvm/trunk/include/llvm/CodeGen MIRYamlMapping.h MachineFunction.h, llvm/trunk/lib/CodeGen MIRPrinter.cpp

[MachineFunction] Base support for call site info tracking

Add an attribute into the MachineFunction that tracks call site info.

([8/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda at cisco.com>
Co-authored-by: Nikola Prica <nikola.prica at rt-rk.com>
Co-authored-by: Ivan Baev <ibaev at cisco.com>

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

LLVM/llvm 364505llvm/trunk/lib/Bitcode/Reader BitcodeReader.cpp

Fix -Wunused-variable warnings after r364464

/work/llvm.monorepo/llvm/lib/Bitcode/Reader/BitcodeReader.cpp: In function
‘llvm::Expected<std::basic_string<char> > 
warning: unused variable ‘BitCode’ [-Wunused-variable]
     switch (unsigned BitCode = MaybeBitCode.get()) {
/work/llvm.monorepo/llvm/lib/Bitcode/Reader/BitcodeReader.cpp: In member function
‘llvm::Error {anonymous}::ModuleSummaryIndexBitcodeReader::parseModule()’:
warning: unused variable ‘BitCode’ [-Wunused-variable]
         switch (unsigned BitCode = MaybeBitCode.get()) {

LLVM/llvm 364504llvm/trunk/include/llvm/Bitcode BitstreamReader.h

Fix GCC 4 build after r364464

It was failing with:

In file included from 
In member function 'llvm::Expected<long unsigned int> 
llvm::SimpleBitstreamCursor::ReadVBR64(unsigned int)':
error: could not convert 'MaybeRead' from 'llvm::Expected<unsigned int>' to 
'llvm::Expected<long unsigned int>'
       return MaybeRead;
error: could not convert 'MaybeRead' from 'llvm::Expected<unsigned int>' to 
'llvm::Expected<long unsigned int>'
         return MaybeRead;

LLVM/llvm 364503lldb/trunk/source/Plugins/ABI/SysV-x86_64 ABISysV_x86_64.cpp

[lldb] [Plugins/SysV-x86_64] NetBSD is also using SysV ABI

Reenable SysV x86_64 ABI usage on NetBSD that was accidentally removed
in r364216.  This fixes numerous test failures with messages similar
to the following:

  error: Can't run the expression locally: Interpreter doesn't handle
  one of the expression's opcodes

LLVM/llvm 364502cfe/trunk/include/clang/AST Decl.h, cfe/trunk/lib/CodeGen CGDebugInfo.cpp CGExpr.cpp

[clang] Add DISuprogram and DIE for a func decl

Attach a unique DISubprogram to a function declaration that will be
used for call site debug info.

([7/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda at cisco.com>
Co-authored-by: Nikola Prica <nikola.prica at rt-rk.com>
Co-authored-by: Ivan Baev <ibaev at cisco.com>

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

LLVM/llvm 364501llvm/trunk/utils/gn/secondary/clang/lib/Tooling/DependencyScanning BUILD.gn, llvm/trunk/utils/gn/secondary/llvm/lib/DebugInfo/GSYM BUILD.gn

gn build: Follow-up to r364491 "[GN] Update build files"

- Merge r364427 (GSYM lib) more: It was missing the new unit test
  (as pointed out by llvm/utils/gn/build/sync_source_lists_from_cmake.py),
  and it had some superfluous deps not present in the cmake build.

- Merge r364474 (clang DependencyScanning lib) more: The deps didn't
  quite match cmake.

LLVM/llvm 364500llvm/trunk/docs LangRef.rst, llvm/trunk/lib/CodeGen/AsmPrinter DwarfDebug.cpp

[IR] Add DISuprogram and DIE for a func decl

A unique DISubprogram may be attached to a function declaration used for
call site debug info.

([6/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda at cisco.com>
Co-authored-by: Nikola Prica <nikola.prica at rt-rk.com>
Co-authored-by: Ivan Baev <ibaev at cisco.com>

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

LLVM/llvm 364499llvm/trunk/lib/Target/X86 X86ISelDAGToDAG.cpp

[X86] Remove (vzext_movl (scalar_to_vector (load))) matching code from 

I think this will be turning into vzext_load during DAG combine.

LLVM/llvm 364498llvm/trunk/lib/Target/X86 X86ISelDAGToDAG.cpp, llvm/trunk/test/CodeGen/X86 fold-load-unops.ll

[X86] Teach selectScalarSSELoad to not narrow volatile loads.

LLVM/llvm 364497llvm/trunk/test/Transforms/InstCombine signbit-lshr-and-icmpeq-zero.ll signbit-shl-and-icmpeq-zero.ll

[InstCombine][NFCI] Fix test comments.

For fold
(X & (signbit l>> Y)) ==/!= 0 -> (X << Y) >=/< 0
(X & (signbit << Y)) ==/!= 0 -> (X l>> Y) >=/< 0

Test cases of X being constant are positive tests not negative.

Prep work for D62818.

LLVM/llvm 364496llvm/trunk/lib/Target/PowerPC PPCEarlyReturn.cpp

[NFC][PowerPC] Improve the for loop in Early Return


In `PPCEarlyReturn.cpp`
183       for (MachineFunction::iterator I = MF.begin(); I != MF.end();) {
184         MachineBasicBlock &B = *I++;
185         if (processBlock(B))
186           Changed = true;
187       }
Above code can be improved to:
184       for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E;) {
185         MachineBasicBlock &B = *I++;
186         Changed |= processBlock(B);
187       }

Reviewed By: hfinkel

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

LLVM/llvm 364495cfe/trunk/lib/CodeGen CGDecl.cpp

[NFC] Return early for types with size zero

LLVM/llvm 364494lldb/trunk/source/Plugins/Process/gdb-remote GDBRemoteCommunicationReplayServer.cpp

[Reproducers] Fix flakiness and off-by-one during replay.

This fixes two replay issues that caused the tests to behave

1. It fixes an off-by-one error, where all replies where shifted by 1
   because of a `+` packet that should've been ignored.

2. It fixes another off-by-one-error, where an asynchronous ^C was
   offsetting all subsequent packets. The reason is that we
   'synchronize' requests and replies. In reality, a stop reply is only
   sent when the process halt. During replay however, we instantly
   report the stop, as the reply to packets like continue (vCont).

Both packets should be ignored, and indeed, checking the gdb-remote log,
no unexpected packets are received anymore.

Additionally, be more pedantic when it comes to unexpected packets and
return an failure form the replay server. This way we should be able to
catch these things faster in the future.

LLVM/llvm 364493llvm/trunk/utils/gn/secondary/llvm/lib/DebugInfo GSYM, llvm/trunk/utils/gn/secondary/llvm/lib/DebugInfo/GSYM BUILD.gn

[GN] Fix check-llvm

LLVM/llvm 364492cfe/trunk/lib/CodeGen CGDecl.cpp

[NFC] Remove unneeded local variables

LLVM/llvm 364491llvm/trunk/utils/gn/secondary/clang-tools-extra/clangd BUILD.gn, llvm/trunk/utils/gn/secondary/clang-tools-extra/clangd/unittests BUILD.gn

[GN] Update build files

LLVM/llvm 364490llvm/trunk/lib/Target/ARM Thumb1FrameLowering.cpp ARMFrameLowering.cpp, llvm/trunk/test/CodeGen/ARM scavenging.mir

[ARM] Don't reserve R12 on Thumb1 as an emergency spill slot.

The current implementation of ThumbRegisterInfo::saveScavengerRegister
is bad for two reasons: one, it's buggy, and two, it blocks using R12
for other optimizations.  So this patch gets rid of it, and adds the
necessary support for using an ordinary emergency spill slot on Thumb1.

(Specifically, I think saveScavengerRegister was broken by r305625, and
nobody noticed for two years because the codepath is almost never used.
The new code will also probably not be used much, but it now has better
tests, and if we fail to emit a necessary emergency spill slot we get a
reasonable error message instead of a miscompile.)

A rough outline of the changes in the patch:

1. Gets rid of ThumbRegisterInfo::saveScavengerRegister.
2. Modifies ARMFrameLowering::determineCalleeSaves to allocate an
emergency spill slot for Thumb1.
3. Implements useFPForScavengingIndex, so the emergency spill slot isn't
placed at a negative offset from FP on Thumb1.
4. Modifies the heuristics for allocating an emergency spill slot to
support Thumb1.  This includes fixing ExtraCSSpill so we don't try to
use "lr" as a substitute for allocating an emergency spill slot.
5. Allocates a base pointer in more cases, so the emergency spill slot
is always accessible.

    [14 lines not shown]

LLVM/llvm 364489cfe/trunk/lib/Parse ParseObjc.cpp, cfe/trunk/test/Parser objc-interfaces.m

[ObjC] Improve error message for a malformed objc-type-name

If the type didn't exist, we used to emit a really bad error:

t.m:3:12: error: expected ')'
-(nullable NoSuchType)foo3;


LLVM/llvm 364488llvm/trunk/test/Bitcode invalid.test

Fix Bitcode/invalid.test

On the armv8 bot the failure is slightly different in the number it prints. Don't check 
the numbers. This was caused by r364464.

LLVM/llvm 364487cfe/branches/release_80/lib/AST MicrosoftMangle.cpp, cfe/branches/release_80/test/CodeGenCXX char8_t.cpp

Merging r354633:

r354633 | rsmith | 2019-02-21 15:04:35 -0800 (Thu, 21 Feb 2019) | 3 lines

Use _Q as MS ABI mangling for char8_t.

Thanks to Yuriy Solodkyy for letting us know the mangling here.

LLVM/llvm 364486compiler-rt/trunk/cmake config-ix.cmake

[GWP-ASan] D63736 broke ARMv7/v8 sanitizer bots.

Remove ARM32/ARM64 support for GWP-ASan due to a strange SEGV when
running scudo's preinit.c test. Disabling to make the bots go green
while investigating.

LLVM/llvm 364485llvm/trunk/cmake/modules GetHostTriple.cmake

[cmake] Allow config.guess to be run with MSYS on Windows

With r363420, config.guess can no longer be run with MSYS on Windows and this
patch should be able to fix this particular case.

Reviewers: compnerd

Reviewed By: compnerd

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

LLVM/llvm 364484lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client TestNestedRegDefinitions.py, lldb/trunk/source/Plugins/Process/gdb-remote ProcessGDBRemote.cpp ProcessGDBRemote.h

Support nested target.xml register definition files, lack of reg group markers.

The qemu x86_64 target returns a target.xml register definition file which
includes other xml files and they include others, etc.  Also, the registers
are not put in register groups like lldb wants to see.

This patch (1) puts registers that aren't in a register group in a "general"
register group, (2) change ProcessGDBRemote::GetGDBServerRegisterInfo to
be a method that starts the parsing, asking a recurisve function to fetch
and parse target.xml, (3) adds 
ProcessGDBRemote::GetGDBServerRegisterInfoXMLAndProcess which can recusively
call itself to read and parse included xml files, (4) in addition to expecting
the top-level <target> element (which only happens in the top level xml file),
also an xml file that consists of a <feature> node - read the register 
defintions and includes from that <feature> element.  

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

LLVM/llvm 364483cfe/branches release_80, cfe/branches/release_80/lib/CodeGen CGDebugInfo.cpp

Merging r359809:
r359809 | rnk | 2019-05-02 10:45:54 -0700 (Thu, 02 May 2019) | 27 lines

Use primary template parameter names for variable template debug info

Fixes PR41677

  template <typename LHS, typename RHS> constexpr bool is_same_v = false;
  template <typename T> constexpr bool is_same_v<T, T> = true;
  template constexpr bool is_same_v<int, int>;

Before this change, when emitting debug info for the
`is_same_v<int, int>` global variable, clang would crash because it
would try to use the template parameter list from the partial
specialization to give parameter names to template arguments. This
doesn't work in general, since a partial specialization can have fewer
arguments than the primary template. Therefore, always use the primary
template. Hypothetically we could try to use the parameter names from
the partial specialization when possible, but it's not clear this really
helps debugging in practice.

Reviewers: JDevlieghere, aprantl, ormris, dblaikie

    [7 lines not shown]

LLVM/llvm 364482llvm/trunk/lib/Transforms/Scalar SCCP.cpp

[SCCP] Fix non-deterministic uselists of return values (DenseMap -> MapVector)

LLVM/llvm 364481lldb/trunk/examples/python x86_64_linux_target_definition.py x86_64_qemu_target_definition.py

Use the // integer divide operator in these 
target definition files, like Davide's change to x86_64_target_definition.py.

LLVM/llvm 364480cfe/trunk/lib/CodeGen CGDebugInfo.cpp

Fix formatting after r364479

The reflowing obscurs the functional changes, so here is a separate

LLVM/llvm 364479cfe/trunk/lib/CodeGen BackendUtil.cpp, cfe/trunk/lib/Driver/ToolChains Clang.cpp

[Clang] Remove unused -split-dwarf and obsolete -enable-split-dwarf

The changes in D59673 made the choice redundant, since we can achieve
single-file split DWARF just by not setting an output file name.
Like llc we can also derive whether to enable Split DWARF from whether
-split-dwarf-file is set, so we don't need the flag at all anymore.

The test CodeGen/split-debug-filename.c distinguished between having set
or not set -enable-split-dwarf with -split-dwarf-file, but we can
probably just always emit the metadata into the IR.

The flag -split-dwarf wasn't used at all anymore.

Reviewers: dblaikie, echristo

Reviewed By: dblaikie

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

LLVM/llvm 364478llvm/trunk/lib/Transforms/Vectorize SLPVectorizer.cpp, llvm/trunk/test/Transforms/SLPVectorizer/X86 lookahead.ll

[SLP] Look-ahead operand reordering heuristic.

Summary: This patch introduces a new heuristic for guiding operand reordering. The new 
"look-ahead" heuristic can look beyond the immediate predecessors. This helps break ties 
when the immediate predecessors have identical opcodes (see lit test for an example).

Reviewers: RKSimon, ABataev, dtemirbulatov, Ayal, hfinkel, rnk

Reviewed By: RKSimon, dtemirbulatov

Subscribers: rnk, rcorcs, llvm-commits

Tags: #llvm

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

LLVM/llvm 364477llvm/trunk/test/Transforms/InstCombine broadcast.ll

[InstCombine] change 'tmp' variable names; NFC

I don't think there was anything going wrong here,
but the auto-generating CHECK line script is known
to have problems with 'TMP' because it uses that
to match nameless values.

This is a retry of rL364452.

LLVM/llvm 364476cfe/trunk/lib/AST ASTContext.cpp, cfe/trunk/test/CodeGenCXX ms-constexpr-var-template.cpp

Revert r363191 "[MS] Pretend constexpr variable template specializations are inline"

The next Visual Studio update will fix this issue, and it doesn't make
sense to implement this non-conforming behavior going forward.

LLVM/llvm 364475zorg/trunk/buildbot/osuosl/master/config builders.py

[zorg] Fixes for solaris11-amd64, solaris11-sparcv9  builders

The first few days of running the Solaris 11 buildbots revealed a couple of

- The builders didn't honor the slaves' configured jobs property, but were
  running with the full parallelism discovered by ninja.  That massivly
  impacts other builders running on these systems, so im explicitly
  configuring jobs in the builder configs, too.

- Along the same line, the number of paralllel links is the worst problem
  here.  I had experimented with the LLVM_PARALLEL_LINK_JOBS option in
  the past, but only now (in cmake/modules/HandleLLVMOptions.cmake)
  discovered that it's Ninja-only. I'm reducing it to 4 here as an

- Unlike Solaris/x86, the Solaris/SPARC configure triplet defaults to
  sparc-sun-solaris2.11, which results in clang creating 32-bit
  binaries by default.  It turns out to be an inconsistency in
  config.guess which I'm trying to get resolved.  In the meantime, I'm
  forcing the proper triplet on both sparc and x86.

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

LLVM/llvm 364474cfe/trunk/include/clang/Tooling/DependencyScanning DependencyScanningWorker.h, cfe/trunk/lib/Tooling Tooling.cpp

[clang-scan-deps] Introduce the DependencyScanning library with the
thread worker code and better error handling

This commit extracts out the code that will powers the fast scanning
worker into a new file in a new DependencyScanning library. The error
and output handling is improved so that the clients can gather
errors/results from the worker directly.

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

LLVM/llvm 364473llvm/trunk/lib/Target/AMDGPU SIRegisterInfo.cpp

AMDGPU: Assert SPAdj is 0

LLVM/llvm 364472llvm/trunk/lib/CodeGen PrologEpilogInserter.cpp

PEI: Add default handling of spills to registers

LLVM/llvm 364471llvm/trunk/utils/UpdateTestChecks asm.py

[UpdateTestChecks][NFC] Remove entries with same prefix

Matching is 'lossy', triples with same prefix can be dropped.

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

LLVM/llvm 364470llvm/trunk/lib/Target/AMDGPU SIFrameLowering.cpp, llvm/trunk/test/CodeGen/AMDGPU callee-special-input-sgprs.ll

[AMDGPU] Fix Livereg computation during epilogue insertion

The LivePhysRegs calculated in order to find a scratch register in the
epilogue code wrongly uses 'LiveIns'. Instead, it should use the
'Liveout' sets.  For the liveness, also considering the operands of
the terminator (return) instruction which is the insertion point for
the scratch-exec-copy instruction.

Patch by Christudasan Devadasan

LLVM/llvm 364469llvm/trunk/lib/Target/X86 X86ISelLowering.cpp, llvm/trunk/test/CodeGen/X86 buildvec-insertvec.ll promote-vec3.ll

[X86] Rework the logic in LowerBuildVectorv16i8 to make better use of any_extend and break 
false dependencies. Other improvements

This patch rewrites the loop iteration to only visit every other element starting with 
element 0. And we work on the "even" element and "next" element at the same time. The 
"First" logic has been moved to the bottom of the loop and doesn't run on every element. I 
believe it could create dangling nodes previously since we didn't check if we were going 
to use SCALAR_TO_VECTOR for the first insertion. I got rid of the "First" variable and 
just do a null check on V which should be equivalent. We also no longer use undef as the 
starting V for vectors with no zeroes to avoid false dependencies. This matches v8i16.

I've changed all the extends and OR operations to use MVT::i32 since that's what they'll 
be promoted to anyway. I've tried to use zero_extend only when necessary and use 
any_extend otherwise. This resulted in some improvements in tests where we are now able to 
promote aligned (i32 (extload i8)) to a 32-bit load.

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

LLVM/llvm 364468cfe/trunk/lib/Driver/ToolChains WebAssembly.cpp, cfe/trunk/test/Driver wasm-toolchain.c

[WebAssembly] Implement Address Sanitizer for Emscripten

This diff enables address sanitizer on Emscripten.

On Emscripten, real memory starts at the value passed to --global-base.

All memory before this is used as shadow memory, and thus the shadow mapping
function is simply dividing by 8.

Reviewers: tlively, aheejin, sbc100

Reviewed By: sbc100

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, 

Tags: #clang, #llvm

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

LLVM/llvm 364467lld/trunk/test/wasm global-base.test, lld/trunk/wasm Symbols.h Writer.cpp

[wasm-ld] Add __global_base symbol to mark the value of --global-base

This is needed for address sanitizer on Emscripten. As everything in
memory starts at the value passed to --global-base, everything before
that can be used as shadow memory.

This symbol is added so that the library for the ASan runtime can know
where the shadow memory ends and real memory begins.

This is split from D63742.

Reviewers: tlively, aheejin, sbc100

Subscribers: sunfish, llvm-commits

Tags: #llvm

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

LLVM/llvm 364466debuginfo-tests/trunk nrvo-string.cpp

Make nrvo-string test more robust.

The breakpoint locations were in places where clang doesn't actually
emit a source location for and depend on the debugger's ability to
move the breakpoint forward onto a line that is already in the
function epilogue. In my testing older versions of LLDB fail to do
that, so I'm modifying the test to force a break-able location by
calling a noinline function.


LLVM/llvm 364465lldb/trunk/examples/python x86_64_target_definition.py

[x86-64] Use `//` for integer division in the target definition.

This forces integer division and works with python 2 and python 3.


LLVM/llvm 364464cfe/trunk/lib/Serialization ASTReader.cpp GlobalModuleIndex.cpp, llvm/trunk/include/llvm/Bitcode BitstreamReader.h

BitStream reader: propagate errors

The bitstream reader handles errors poorly. This has two effects:

 * Bugs in file handling (especially modules) manifest as an "unexpected end of
   file" crash
 * Users of clang as a library end up aborting because the code unconditionally
   calls `report_fatal_error`

The bitstream reader should be more resilient and return Expected / Error as
soon as an error is encountered, not way late like it does now. This patch
starts doing so and adopting the error handling where I think it makes sense.
There's plenty more to do: this patch propagates errors to be minimally useful,
and follow-ups will propagate them further and improve diagnostics.


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

LLVM/llvm 364463llvm/trunk/lib/Target/X86 X86ISelLowering.cpp

[X86] Remove isTypePromotionOfi1ZeroUpBits and its helpers.

This was trying to optimize concat_vectors with zero of setcc or
kand instructions. But I think it produced the same code we
produce for a concat_vectors with 0 even it it doesn't come from
one of those operations.

LLVM/llvm 364462cfe/trunk/tools/c-index-test c-index-test.c

Print NULL as "(null)" in diagnostic message

Passing a null pointer to the printf family for a %s format specifier leads to undefined 
behaviour. The tests currently expect (null). Explicitly test for a null pointer and 
provide the expected string.

Authored By: andusy

Reviewers: hubert.reinterpretcast, xingxue, jasonliu, daltenty, cebowleratibm

Reviewed By: hubert.reinterpretcast

Subscribers: arphaman, jsji, cfe-commits

Tags: #llvm

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

LLVM/llvm 364461llvm/trunk/include/llvm/Support LEB128.h

Fix some undefined behavior (excessive shift of signed value) in r364253 detected by ubsan

LLVM/llvm 364460llvm/trunk/tools/llvm-objcopy/ELF Object.cpp Object.h

llvm-objcopy: silence warning introduced in r364296

Change-Id: I306e866d497e55945fb3b471eb0727b63ad9e4b9

LLVM/llvm 364459llvm/trunk/include/llvm/DebugInfo/GSYM InlineInfo.h

Fix Wdocumentation warnings. NFCI.

LLVM/llvm 364458llvm/trunk/lib/Target/X86 X86ISelLowering.cpp, llvm/trunk/test/CodeGen/X86 vector-shuffle-combining.ll

[X86][SSE] getFauxShuffleMask - handle OR(x,y) where x and y have no overlapping bits

Create a per-byte shuffle mask based on the computeKnownBits from each operand - if for 
each byte we have a known zero (or both) then it can be safely blended.

Fixes PR41545

LLVM/llvm 364457lldb/trunk/source/Utility FileCollector.cpp

[Reproducers] Copy over access/modification time in the FileCollector.

Copy over access and modification time for the files included in the
reproducer. This is needed to pass tests that check the integrity of
object files based on their time stamp.