platform/upstream/llvm.git
2 years ago[NFC] Run script to autogenerate CHECK lines for CodeGen/AArch64/fast-isel-cmp-vec.ll
David Sherwood [Wed, 12 Jan 2022 12:03:29 +0000 (12:03 +0000)]
[NFC] Run script to autogenerate CHECK lines for CodeGen/AArch64/fast-isel-cmp-vec.ll

2 years ago[VP] llvm.vp.merge intrinsic and LangRef
Simon Moll [Wed, 12 Jan 2022 10:22:48 +0000 (11:22 +0100)]
[VP] llvm.vp.merge intrinsic and LangRef

llvm.vp.merge interprets the %evl operand differently than the other vp
intrinsics: all lanes at positions greater or equal than the %evl
operand are passed through from the second vector input. Otherwise it
behaves like llvm.vp.select.

Reviewed By: craig.topper

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

2 years ago[X86][XOP] Add SimplifyDemandedVectorElts handling for xop shifts
Simon Pilgrim [Wed, 12 Jan 2022 12:17:06 +0000 (12:17 +0000)]
[X86][XOP] Add SimplifyDemandedVectorElts handling for xop shifts

Noticed while investigating how to improve funnel shift codegen

2 years ago[X86][XOP] Add tests for missing demanded elts handling for xop shifts
Simon Pilgrim [Wed, 12 Jan 2022 12:11:52 +0000 (12:11 +0000)]
[X86][XOP] Add tests for missing demanded elts handling for xop shifts

Noticed while investigating how to improve funnel shift codegen

2 years ago[IRBuilder] Migrate icmp-folding to value-based FoldICmp.
Florian Hahn [Wed, 12 Jan 2022 12:37:46 +0000 (12:37 +0000)]
[IRBuilder] Migrate icmp-folding to value-based FoldICmp.

Depends on D116935.

Reviewed By: nikic, lebedev.ri

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

2 years ago[lldb][AArch64] Correct top nibble setting in memory tag read tests
David Spickett [Wed, 12 Jan 2022 12:17:52 +0000 (12:17 +0000)]
[lldb][AArch64] Correct top nibble setting in memory tag read tests

Due to a missing cast the << 60 always resulted in zero leaving
the top nibble empty. So we weren't actually testing that lldb
ignores those bits in addition to the tag bits.

Correct that and also set the top nibbles to ascending values
so that we can catch if lldb only removes one of the tag bits
and top nibble, but not both.

In future the tag manager will likely only remove the tag bits
and leave non-address bits to the ABI plugin but for now make
sure we're testing what we claim to implement.

2 years ago[RISCV][llvm] Update CSRs
Shao-Ce SUN [Wed, 12 Jan 2022 12:13:30 +0000 (20:13 +0800)]
[RISCV][llvm] Update CSRs

According the newest RISC-V Privileged Spec, updated CSRs.

Reviewed By: asb

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

2 years ago[NFC] [Coroutines] Add regression tests for symmetric transfer and coroutine elision
Chuanqi Xu [Wed, 12 Jan 2022 11:34:49 +0000 (19:34 +0800)]
[NFC] [Coroutines] Add regression tests for symmetric transfer and coroutine elision

2 years ago[gn build] Port 35cca45b09b8
LLVM GN Syncbot [Wed, 12 Jan 2022 11:14:10 +0000 (11:14 +0000)]
[gn build] Port 35cca45b09b8

2 years ago[X86][LLD] Update datelayout in LLD tests. NFCI
Phoebe Wang [Wed, 12 Jan 2022 11:08:01 +0000 (19:08 +0800)]
[X86][LLD] Update datelayout in LLD tests. NFCI

rG1bb0caf56168 changed the datalayout of f80 on Windows 32 bits. But it
missed the related use in the LLD tests. This patch will fix the
problem catched by buildbot.

2 years agoMisleading bidirectional detection
serge-sans-paille [Tue, 28 Sep 2021 09:23:22 +0000 (11:23 +0200)]
Misleading bidirectional detection

This patch implements detection of incomplete bidirectional sequence withing
comments and string literals within clang-tidy.

It detects the bidi part of https://www.trojansource.codes/trojan-source.pdf

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

2 years ago[BuildLibCalls] Add nounwind,willreturn to memset_pattern{4,8,16}.
Florian Hahn [Wed, 12 Jan 2022 10:32:52 +0000 (10:32 +0000)]
[BuildLibCalls] Add nounwind,willreturn to memset_pattern{4,8,16}.

Similar to memset, memset_pattern{4,8,16} all will return and do not
unwind. Use fallthrough to include all attributes also set for memset.

Reviewed By: nikic

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

2 years ago[CodeGen][Debuginfo][NFC] Refactor DIE values SizeOf method to not depend on AsmPrinter.
Alexey Lapshin [Mon, 10 Jan 2022 18:38:53 +0000 (21:38 +0300)]
[CodeGen][Debuginfo][NFC] Refactor DIE values SizeOf method to not depend on AsmPrinter.

SizeOf() method of DIE values(unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const)
depends on AsmPrinter. AsmPrinter is too specific class here. This patch removes dependency
on AsmPrinter and use dwarf::FormParams structure instead. It allows calculate DIE values
size without using AsmPrinter. That refactoring is useful for D96035([dsymutil][DWARFlinker]
implement separate multi-thread processing for compile units.)

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

2 years agoRevert (2) "[AST] Add RParen loc for decltype AutoTypeloc."
Florian Hahn [Wed, 12 Jan 2022 10:09:37 +0000 (10:09 +0000)]
Revert (2) "[AST] Add RParen loc for decltype AutoTypeloc."

This reverts commit 41fbdfa4d5601cccbcdc0ded8ef35190d502f7f3.

The commit breaks stage 2 builds with debug info, e.g.
https://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/5088/console

Clang crashes with the following assertion when building
llvm-project/llvm/lib/Support/Timer.cpp

/usr/local/bin/sccache /Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/host-compiler/bin/clang++  -DGTEST_HAS_RTTI=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I/Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/llvm-project/llvm/lib/Support -Iinclude -I/Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/llvm-project/llvm/include -fno-stack-protector -fno-common -Wno-profile-instr-unprofiled -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -fmodules -fmodules-cache-path=/Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/clang-build/Build/module.cache -fcxx-modules -Xclang -fmodules-local-submodule-visibility -gmodules -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -flto=thin  -O2 -g -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk   -std=c++14  -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o -c /Users/buildslave/jenkins/workspace/clang-stage2-Rthinlto/llvm-project/llvm/lib/Support/Timer.cpp
Assertion failed: (((getOffset()+Offset) & MacroIDBit) == 0 && "offset overflow"), function getLocWithOffset, file /Users/buildslave/jenkins/workspace/clang-stage1-RA/llvm-project/clang/include/clang/Basic/SourceLocation.h, line 135.

2 years ago[flang] Fix overallocation by fir-to-llvm-ir pass
Diana Picus [Tue, 21 Dec 2021 13:10:51 +0000 (13:10 +0000)]
[flang] Fix overallocation by fir-to-llvm-ir pass

When converting a fir.alloca of an array to the LLVM dialect, we used to
multiply the allocated size by all the constant factors encoded in the
array type. This is fine when the array type is converted to the element
type for the purposes of the allocation, but if it's converted to an
array type, then we might be allocating too much space. For example, for
`%2 = fir.alloca !fir.array<8x16x32xf32>, %0, %1` we would allocate
%0 * %1 * 8 * 16 * 32 x llvm.array<32 x array<16 * array<8 x f32>>>. We
really only need to allocate %0 * %1 such arrays.

This patch fixes the issue by taking note of the array type that we're
trying to allocate. It tries to match the behaviour of
LLVMTypeConverter::convertPointerLike, which returns a pointer to the
element type only when the array type doesn't have a constant interior.
We consequently only multiply with the constant factors in the array
type if the array type doesn't have a constant interior.

This has the nice side effect that it gets rid of some redundant
multiplications with the constant 1 in some cases.

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

2 years ago[lldb] Don't print "Command Options Usage:" for an alias with no options
David Spickett [Fri, 17 Dec 2021 13:49:35 +0000 (13:49 +0000)]
[lldb] Don't print "Command Options Usage:" for an alias with no options

"shell" is an alias to "platform shell -h --". Previously you would get this
help text:

(lldb) help shell
Run a shell command on the host.  Expects 'raw' input (see 'help raw-input'.)

Syntax: shell <shell-command>

Command Options Usage:

'shell' is an abbreviation for 'platform shell -h   --'

Since the code doesn't handle the base command having options
but the alias removing them. With these changes you get:

(lldb) help shell
Run a shell command on the host.  Expects 'raw' input (see 'help raw-input'.)

Syntax: shell <shell-command>

'shell' is an abbreviation for 'platform shell -h   --'

Note that we already handle a non-alias command having no options,
for example "quit":

(lldb) help quit
Quit the LLDB debugger.

Syntax: quit [exit-code]

Reviewed By: JDevlieghere, jingham

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

2 years ago[clang][CodeComplete] Perform approximate member search in bases
Kadir Cetinkaya [Tue, 11 Jan 2022 17:55:53 +0000 (18:55 +0100)]
[clang][CodeComplete] Perform approximate member search in bases

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

2 years ago[mlir][linalg][bufferize] Add pass options for `createDeallocs`
Matthias Springer [Wed, 12 Jan 2022 09:40:08 +0000 (18:40 +0900)]
[mlir][linalg][bufferize] Add pass options for `createDeallocs`

This change makes it possible to use a different buffer deallocation strategy. E.g., `-buffer-deallocation` can be used, which also works for allocations that are not in destination-passing style.

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

2 years ago[Clang] Make Clang copy its CMake modules into the build dir
Andrzej Warzynski [Thu, 6 Jan 2022 10:03:22 +0000 (10:03 +0000)]
[Clang] Make Clang copy its CMake modules into the build dir

LLVM has a documented mechanism for passing configuration information to
an out of tree project using CMake. See
https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project.
Similar logic applies to "standalone" builds of other sub-projects
within LLVM that depend on each other. For example, a standalone build
of Flang will use this mechanism to acquire Clang's configuration.

Currently, the relevant CMake modules for Clang will only be copied into
the installation directory. This means that in order to configure a
standalone build of Flang, one has to first build and then install
Clang. This is not required for LLVM nor for MLIR - other sub-projects
that Flang depends on (i.e. the CMake modules for LLVM and MLIR are
available in the build dir, so installation is not needed).

This change removes the need for installing Clang in order to access its
configuration. It makes sure that the required CMake modules are copied
into the build directory. This will make Clang behave consistently with
LLVM and MLIR in this respect. It will also simplify building Flang as
standalone sub-project.

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

2 years ago[X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to match with ICC
Phoebe Wang [Fri, 17 Dec 2021 15:09:33 +0000 (23:09 +0800)]
[X86][MS] Change the alignment of f80 to 16 bytes on Windows 32bits to match with ICC

MSVC currently doesn't support 80 bits long double. ICC supports it when
the option `/Qlong-double` is specified. Changing the alignment of f80
to 16 bytes so that we can be compatible with ICC's option.

Reviewed By: rnk, craig.topper

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

2 years ago[libc++] Quick fix to remove a narrowing conversion from the in_out_result test.
Konstantin Varlamov [Wed, 12 Jan 2022 09:49:37 +0000 (01:49 -0800)]
[libc++] Quick fix to remove a narrowing conversion from the in_out_result test.

This needs a proper solution in a follow-up. The issue is that the
Standard defines conversions between `in_out_result` classes with
different template types as just `return {in, out};`. Because the
expression uses list initialization, it will fail to compile if the
conversion happens to be narrowing -- which is probably unintended.

Surprisingly, this error wasn't caught by the CI.

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

2 years ago[ARM] Remove FeaturePerfMon from armv7-m
David Green [Wed, 12 Jan 2022 09:44:53 +0000 (09:44 +0000)]
[ARM] Remove FeaturePerfMon from armv7-m

FeaturePerfMon relates to the PMU extensions available in armv7-a, and
should not be available in v7-m (it requires loading from a system
register with a mrc). Sink it down a level in the dependency map so that
it isn't present in ARMv7m or HasV8MMainlineOps.

It is also removed from the Neoverse-N2, as it will already be
transitively included.

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

2 years ago[JITLink][AArch64] Add support for splitting eh-frames on AArch64.
Lang Hames [Wed, 12 Jan 2022 09:36:08 +0000 (20:36 +1100)]
[JITLink][AArch64] Add support for splitting eh-frames on AArch64.

This is needed for DWARF eh-frame exception handling on AArch64.

https://github.com/llvm/llvm-project/issues/52921.

Original patch by David Nadlinger <code@klickverbot.at> (thanks David!),
testcase and comments added by me.

2 years ago[flang] Make the `flang` wrapper script check the Bash version
Andrzej Warzynski [Tue, 4 Jan 2022 19:02:23 +0000 (19:02 +0000)]
[flang] Make the `flang` wrapper script check the Bash version

The `flang` wrapper script has been written in a relatively modern
version of Bash and it fails on systems with older versions. This patch
makes the script check the version of Bash being used to run it and
generates an error when unsupported version is used.

This was discussed in more detail in:
  * https://github.com/flang-compiler/f18-llvm-project/issues/1344.
Many thanks to Anthony Cabrera for the suggestion and for identifying
the oldest version of Bash that we can use here.

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

2 years ago[IRBuilder] Migrate add-folding to value-based FoldAdd.
Florian Hahn [Wed, 12 Jan 2022 09:24:46 +0000 (09:24 +0000)]
[IRBuilder] Migrate add-folding to value-based FoldAdd.

Depends on D116935.

Reviewed By: nikic

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

2 years ago[X86][ABI] Pre-commit test for the f80 ABI alignment change. NFC
Phoebe Wang [Fri, 17 Dec 2021 14:30:44 +0000 (22:30 +0800)]
[X86][ABI] Pre-commit test for the f80 ABI alignment change. NFC

2 years ago[extract_symbols.py] Fix line-splitting of tool output.
Simon Tatham [Wed, 12 Jan 2022 09:06:54 +0000 (09:06 +0000)]
[extract_symbols.py] Fix line-splitting of tool output.

Two functions in the `is_32bit_windows` family were retrieving the
output of a tool via `subprocess.check_output`, and then iterating
over it using `for line in output`. But in Python, that gets you the
output one //character// at a time, not a line at a time. So the
regexes that looked for a platform name were never matching.

(This is a mistake that Python makes uniquely easy, because iterating
over a file and over a string have different default behaviour, and
because the element type of a string is still a string so you don't
even get a type mismatch error to warn you about it!)

Reviewed By: michaelplatings

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

2 years ago[mlir][linalg][bufferize] Support std.select bufferization
Matthias Springer [Wed, 12 Jan 2022 08:45:27 +0000 (17:45 +0900)]
[mlir][linalg][bufferize] Support std.select bufferization

This op is an example for how to deal with ops who's OpResult may aliasing with one of multiple OpOperands.

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

2 years ago[GlobalOpt] Drop redundant setExternallyInitialized() call (NFC)
Nikita Popov [Wed, 12 Jan 2022 08:42:58 +0000 (09:42 +0100)]
[GlobalOpt] Drop redundant setExternallyInitialized() call (NFC)

This is part of copyAttributesFrom().

2 years ago[GlobalStatus] Remove unused HasNonInstructionUser member (NFC)
Nikita Popov [Wed, 12 Jan 2022 08:40:54 +0000 (09:40 +0100)]
[GlobalStatus] Remove unused HasNonInstructionUser member (NFC)

This hasn't been used in a long time.

2 years ago[GlobalOpt] Support "stored once" optimization for different types
Nikita Popov [Tue, 11 Jan 2022 17:00:41 +0000 (18:00 +0100)]
[GlobalOpt] Support "stored once" optimization for different types

GlobalOpt can optimize a global with undef initializer and a single
store to put the stored value into the initializer instead. Currently,
this requires the type of the global and the store to match.

This patch extends support to cases with different types (but same
size), in which case we create a new global to replace the old one.

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

2 years ago[clang] Introduce support for disabling warnings in system macros
Carlos Galvez [Fri, 7 Jan 2022 18:45:20 +0000 (18:45 +0000)]
[clang] Introduce support for disabling warnings in system macros

Often we run into situations where we want to ignore
warnings from system headers, but Clang will still
give warnings about the contents of a macro defined
in a system header used in user-code.

Introduce a ShowInSystemMacro option to be able to
specify which warnings we do want to keep raising
warnings for. The current behavior is kept in this patch
(i.e. warnings from system macros are enabled by default).
The decision as to whether this should be an opt-in or opt-out
feature can be made in a separate patch.

To put the feature to test, replace duplicated code for
Wshadow and Wold-style-cast with the SuppressInSystemMacro tag.
Also disable the warning for C++20 designators, fixing #52944.

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

2 years ago[Coroutines] Handle lifetime markers, bitcast and unused instruciton for symmetric...
Chuanqi Xu [Wed, 12 Jan 2022 07:53:49 +0000 (15:53 +0800)]
[Coroutines] Handle lifetime markers, bitcast and unused instruciton for symmetric transfer

This fixes bug49888. The root cause for this is that
simplifyTerminatorLeadingToRet didn't handle lifetime markers well.
Another issue also noted in D116327 is that we deleted some inlined
optimization pass in CoroSplit so that simplifyTerminatorLeadingToRet
need to remove dead instructions by hand.

This patch fixes bug49888 by skipping lifetime markers and bitcast
instruction and removing dead instructions by hand in
simplifyTerminatorLeadingToRet.

Reviewed By: junparser

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

2 years ago[clang][dataflow] Add transfer functions for data members and this pointers
Stanislav Gatev [Tue, 11 Jan 2022 12:15:53 +0000 (12:15 +0000)]
[clang][dataflow] Add transfer functions for data members and this pointers

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D117012

2 years agoAdd inliner interface for GPU dialect
Uday Bondhugula [Mon, 27 Dec 2021 10:13:25 +0000 (15:43 +0530)]
Add inliner interface for GPU dialect

Add inliner interface for GPU dialect. The interface marks all GPU
dialect ops legal to inline anywhere.

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

2 years ago[llvm-readobj][XCOFF] dump auxiliary symbols.
Esme-Yi [Wed, 12 Jan 2022 07:18:21 +0000 (07:18 +0000)]
[llvm-readobj][XCOFF] dump auxiliary symbols.

Summary: The patch adds support for dumping auxiliary symbols
in llvm-readobj for XCOFF.

Reviewed By: jhenderson, Higuoxing

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

2 years ago[JITLink][AArch64] Use R-X permissions for the GOT.
Lang Hames [Wed, 12 Jan 2022 06:53:13 +0000 (17:53 +1100)]
[JITLink][AArch64] Use R-X permissions for the GOT.

This consistent with ld64's treatment of the GOT, but the main aim here is a
short-term workaround for a bad interaction between stub code sequences and
memory layout: Stubs use LDRLiteral19 relocations to reference the GOT, but
BasicLayout currently puts RW- segments between R-- and R-X segments -- a large
RW- segment (or a large R-- for that matter) can cause the relocation to fail
with an out-of-range error.

Putting the GOT in R-X fixes this efficiently in practice. A more robust fix
will be to use a longer code sequence to materialize the GOT pointer and then
rewrite the stub to use a shorter sequence where possible.

2 years ago[ORC] Add an ostream operator for ExecutorAddrRange.
Lang Hames [Wed, 12 Jan 2022 04:42:10 +0000 (15:42 +1100)]
[ORC] Add an ostream operator for ExecutorAddrRange.

This makes it easier to print addr ranges in debugging output.

2 years ago[JITLink] Use Section + Offset format for anon symbols in out-of-range errors.
Lang Hames [Wed, 12 Jan 2022 04:41:11 +0000 (15:41 +1100)]
[JITLink] Use Section + Offset format for anon symbols in out-of-range errors.

The previous error message only provided the address of the anonymous symbol.
Knowing the containing section makes the error easier to diagnose at a glance.

2 years ago[lld-macho] Try and fix map-file.s' flakiness
Jez Ng [Wed, 12 Jan 2022 07:00:56 +0000 (23:00 -0800)]
[lld-macho] Try and fix map-file.s' flakiness

After {D117069}, map-file.s seems flaky. It seems that the "Total Write
map file" section always exists, but the "Write map file" sub-section
may or may not be emitted. So we check for the former.

2 years agoRevert "[MLIR][Math] Enable constant folding of ops"
William S. Moses [Wed, 12 Jan 2022 07:00:53 +0000 (02:00 -0500)]
Revert "[MLIR][Math] Enable constant folding of ops"

This reverts commit 2f8b956ab6e63e57fbaa60749c9ba7752b071993.

There is a linker error for mlir-nvidia as seen on
https://lab.llvm.org/buildbot/#/builders/61/builds/19939.

As it's late for me here, I'm oing to rever this for now to be
investigated later.

2 years ago[MLIR][Math] Enable constant folding of ops
William S. Moses [Wed, 12 Jan 2022 05:26:41 +0000 (00:26 -0500)]
[MLIR][Math] Enable constant folding of ops

Enable constant folding of ops within the math dialect, and introduce constant folders for ceil and log2

Reviewed By: mehdi_amini

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

2 years ago[MLIR][LLVM] Add memoryeffect for alloca
William S. Moses [Wed, 12 Jan 2022 05:44:05 +0000 (00:44 -0500)]
[MLIR][LLVM] Add memoryeffect for alloca

Add memory effect for llvm.alloca op

Reviewed By: mehdi_amini

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

2 years ago[DAGCombiner][AArch64] precommit some tests for D116915 NFC
zhongyunde [Wed, 12 Jan 2022 06:40:41 +0000 (14:40 +0800)]
[DAGCombiner][AArch64] precommit some tests for D116915 NFC

In working on D116915 I found that a few tests were needed. I've been
asked to pre-push the tests for that ticket. This should complete the tests
needed for now.

2 years ago[AMDGPU] Do not reserve any VGPR for SGPR spills
Austin Kerbow [Wed, 12 Jan 2022 06:11:17 +0000 (22:11 -0800)]
[AMDGPU] Do not reserve any VGPR for SGPR spills

After the split register allocation changes in eebe841a47cb it is no
longer necessary to reserve a VGPR before RA. This can also create bugs
when IPRA is enabled since we cannot predict that a called function may
not reserve any register if it does not have any SGPR spills. If that
happens those functions may override reserved registers that are
normally callee saved. Added a test to show this.

Fixes: SWDEV-309900

Reviewed By: arsenm

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

2 years ago[NFC] Remove invisible character in comments
Chuanqi Xu [Wed, 12 Jan 2022 06:10:07 +0000 (14:10 +0800)]
[NFC] Remove invisible character in comments

2 years agoRevert "[llvm-libtool-darwin] Print a warning if object file names are repeated"
Shoaib Meenai [Wed, 12 Jan 2022 06:02:59 +0000 (22:02 -0800)]
Revert "[llvm-libtool-darwin] Print a warning if object file names are repeated"

This reverts commit 4993eff3e253a1c04e1a1a2fa5d68f6b33423419.

Tests are failing on Windows: http://45.33.8.238/win/52360/step_11.txt.
We'll need to account for forward slashes vs. backslashes.

2 years ago[BOLT] Update README build instructions
Amir Ayupov [Wed, 12 Jan 2022 05:26:01 +0000 (21:26 -0800)]
[BOLT] Update README build instructions

Mehdi spotted that our build instructions don't make sense in a monorepo:
https://github.com/facebookincubator/BOLT/pull/269.

Reviewed By: maksfb

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

2 years ago[OpenMP][Clang] Allow passing target features in ISA trait for metadirective clause
Saiyedul Islam [Tue, 11 Jan 2022 11:43:31 +0000 (11:43 +0000)]
[OpenMP][Clang] Allow passing target features in ISA trait for metadirective clause

Passing any feature in the device-isa trait which is not supported by the host
was causing a compilation failure.

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

2 years ago[BOLT] README: address @apinski-cavium comment
Amir Aupov [Wed, 12 Jan 2022 05:23:26 +0000 (21:23 -0800)]
[BOLT] README: address @apinski-cavium comment

Address the comment at:
https://github.com/llvm/llvm-project/commit/4c106cfdf7cf7eec861ad3983a3dd9a9e8f3a8ae#r63658159

Reviewed By: maksfb

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

2 years agoUpdate LLVM CMakeFiles to include BOLT
Amir Ayupov [Wed, 12 Jan 2022 04:18:58 +0000 (20:18 -0800)]
Update LLVM CMakeFiles to include BOLT

Add BOLT to the project list enabling its build.

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

2 years ago[M68k][NFC] Rename header guard of M68kSubtarget.h
Jim Lin [Wed, 12 Jan 2022 03:11:54 +0000 (11:11 +0800)]
[M68k][NFC] Rename header guard of M68kSubtarget.h

LLVM_LIB_TARGET_CPU0_M68KSUBTARGET_H -> LLVM_LIB_TARGET_M68K_M68KSUBTARGET_H

2 years ago[M68k][NFC] Add missing #endif comment
Jim Lin [Wed, 12 Jan 2022 03:09:38 +0000 (11:09 +0800)]
[M68k][NFC] Add missing #endif comment

2 years ago[RISCV] Add strictfp support for compares.
Craig Topper [Wed, 12 Jan 2022 04:01:40 +0000 (20:01 -0800)]
[RISCV] Add strictfp support for compares.

This adds support for STRICT_FSETCC(quiet) and STRICT_FSETCCS(signaling).

FEQ matches well to STRICT_FSETCC oeq.
FLT/FLE matches well to STRICT_FSETCCS olt/ole.

Others require commuting operands or multiple instructions.

STRICT_FSETCC olt/ole/ogt/oge/ult/ule/ugt/uge uses FLT/FLE,
but we need to save/restore FFLAGS around them to avoid spurious
exceptions. I've implemented pseudo instructions with a
CustomInserter to insert the save/restore CSR instructions.
Unfortunately, this doesn't honor exceptions for signaling NANs
but I'm not sure if signaling nans are really supported by the
constrained intrinsics.

STRICT_FSETCC one and ueq expand to a pair of FLT instructions
with a save/restore of fflags around each. This could be improved
in the future.

There may be some opportunities to generate better code for strict
comparisons mixed with nonans fast math flags. I've left FIXMEs in
the .td files for that.

Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Reviewed By: arcbbb

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

2 years ago[NFC][MLGO] Use LazyCallGraph::Node to track functions.
Mircea Trofin [Mon, 10 Jan 2022 19:18:04 +0000 (11:18 -0800)]
[NFC][MLGO] Use LazyCallGraph::Node to track functions.

This avoids the InlineAdvisor carrying the responsibility of deleting
Function objects. We use LazyCallGraph::Node objects instead, which are
stable in memory for the duration of the Module-wide performance of CGSCC
passes started under the same ModuleToPostOrderCGSCCPassAdaptor (which
is the case here)

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

2 years ago[gn build] minor comment tweaks, no behavior change
Nico Weber [Wed, 12 Jan 2022 03:05:41 +0000 (22:05 -0500)]
[gn build] minor comment tweaks, no behavior change

2 years ago[lldb] Specify LLVM target requirements in TestLaunchProcessPosixSpawn
Dave Lee [Wed, 12 Jan 2022 02:58:25 +0000 (18:58 -0800)]
[lldb] Specify LLVM target requirements in TestLaunchProcessPosixSpawn

2 years ago[gn build] (manually) port 85e6e748d426 (llvm/lib/Target/X86/MCA)
Nico Weber [Wed, 12 Jan 2022 02:44:19 +0000 (21:44 -0500)]
[gn build] (manually) port 85e6e748d426 (llvm/lib/Target/X86/MCA)

2 years ago[lld-link] Change config and driver to unique_ptr
Fangrui Song [Wed, 12 Jan 2022 02:31:25 +0000 (18:31 -0800)]
[lld-link] Change config and driver to unique_ptr

Similar to D116143. My x86-64 `lld` is ~5KiB smaller.

Reviewed By: mstorsjo

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

2 years ago[Coroutines] Enhance symmetric transfer for constant CmpInst
Chuanqi Xu [Wed, 12 Jan 2022 02:14:37 +0000 (10:14 +0800)]
[Coroutines] Enhance symmetric transfer for constant CmpInst

This fixes bug52896.

Simply, some symmetric transfer optimization chances get invalided due
to we delete some inlined optimization passes in 822b92a. This would
cause stack-overflow in some situations which should be avoided by the
design of coroutine. This patch tries to fix this by transforming the
constant CmpInst instruction which was done in the deleted passes.

Reviewed By: rjmccall, junparser

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

2 years agoSupport: Extract sys::fs::readNativeFileToEOF() from MemoryBuffer
Duncan P. N. Exon Smith [Tue, 7 Dec 2021 20:42:13 +0000 (12:42 -0800)]
Support: Extract sys::fs::readNativeFileToEOF() from MemoryBuffer

Extract the `readNativeFile()` loop from
`MemoryBuffer::getMemoryBufferForStream()` into `readNativeFileToEOF()`
to allow reuse. The chunk size is configurable; the default of `4*4096`
is exposed as `sys::fs::DefaultReadChunkSize` to allow sizing of
SmallVectors.

There's somewhere I'd like to read a usually-small file without overhead
of a MemoryBuffer; extracting existing logic rather than duplicating it.

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

2 years agoSupport: Avoid SmallVector::set_size() in Unix code
Duncan P. N. Exon Smith [Wed, 8 Dec 2021 01:22:41 +0000 (17:22 -0800)]
Support: Avoid SmallVector::set_size() in Unix code

Replace a `reserve()`/`set_size()` pair with `resize_for_overwrite()`
and `truncate()`. The out parameter also needs a `clear()` call on the
error path.

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

2 years agoSupport: Avoid SmallVector::set_size() in Windows code
Duncan P. N. Exon Smith [Wed, 8 Dec 2021 01:22:42 +0000 (17:22 -0800)]
Support: Avoid SmallVector::set_size() in Windows code

Replace a few `reserve()` / `set_size()` pairs with
`resize_for_overwrite()` / `truncate()` in the platform-specific
code for Windows.

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

2 years agoAST: Avoid using SmallVector::set_size() in UnresolvedSet
Duncan P. N. Exon Smith [Wed, 8 Dec 2021 01:22:36 +0000 (17:22 -0800)]
AST: Avoid using SmallVector::set_size() in UnresolvedSet

Update UnresolvedSet to use (and expose) `SmallVector::truncate()` instead
of `SmallVector::set_size()`. The latter is going to made private in a
future commit to avoid misuse.

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

2 years ago[lld-macho] Initialize separate time trace profiler for mapfile worker
Jez Ng [Wed, 12 Jan 2022 01:45:07 +0000 (17:45 -0800)]
[lld-macho] Initialize separate time trace profiler for mapfile worker

After {D115416}, the "Write map file" event no longer shows up
in the time trace. Each time trace profiler instance is thread-local,
but we had neglected to initialize a separate instance for the mapfile
worker thread.

Reviewed By: keith

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

2 years agoADT: Avoid using SmallVector::set_size() in SmallString
Duncan P. N. Exon Smith [Wed, 8 Dec 2021 01:22:29 +0000 (17:22 -0800)]
ADT: Avoid using SmallVector::set_size() in SmallString

Update `SmallString::append()` to use `resize_for_overwrite()` instead
of `reserve()` followed by `set_size()`.

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

2 years ago[MLIR][SCF] Remove unused arguments to whileop
William S. Moses [Tue, 11 Jan 2022 23:45:17 +0000 (18:45 -0500)]
[MLIR][SCF] Remove unused arguments to whileop

Canonicalize away unused arguments to the before region of a whileOp

Reviewed By: mehdi_amini

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

2 years agoASTMatchers: Avoid using SmallVector::set_size()
Duncan P. N. Exon Smith [Wed, 8 Dec 2021 01:22:34 +0000 (17:22 -0800)]
ASTMatchers: Avoid using SmallVector::set_size()

Update `variadicMatcherDescriptor` to assert on reserved capacity and
to call `emplace_back()` instead of calling `set_size()` and constructing
the element in-place.

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

2 years ago[libc++][test] Move iter_swap into iterator.cust.swap. NFC.
Joe Loser [Tue, 11 Jan 2022 05:43:25 +0000 (00:43 -0500)]
[libc++][test] Move iter_swap into iterator.cust.swap. NFC.

Move `iter_swap.pass.cpp` into a new subdirectory: `iterator.cust.swap`
for symmetry with the neighboring subdirectory `iterator.cust.move`.

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

2 years ago[lld-macho] Rename LazySymbol to LazyArchive. NFC
Fangrui Song [Wed, 12 Jan 2022 00:49:06 +0000 (16:49 -0800)]
[lld-macho] Rename LazySymbol to LazyArchive. NFC

D116913 will add LazyObject. Rename LazySymbol to LazyArchive to avoid confusion
and mirror ELF.

Reviewed By: #lld-macho, Jez Ng

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

2 years ago[MLGO] Add support for multiple training traces per module
Mircea Trofin [Tue, 11 Jan 2022 02:16:04 +0000 (18:16 -0800)]
[MLGO] Add support for multiple training traces per module

This happens in e.g. regalloc, where we trace decisions per function,
but wouldn't want to spew N log files (i.e. one per function). So we
output a key-value association, where the key is an ID for the
sub-module object, and the value is the tensorflow::SequenceExample.

The current relation with protobuf is tenuous, so we're avoiding a
custom message type in favor of using the `Struct` message, but that
requires the values be wire-able strings, hence base64 encoding.

We plan on resolving the protobuf situation shortly, and improve the
encoding of such logs, but this is sufficient for now for setting up
regalloc training.

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

2 years ago[clang][CodeGen][UBSan] VLA size checking for unsigned integer parameter
Adam Magier [Thu, 16 Dec 2021 23:56:43 +0000 (00:56 +0100)]
[clang][CodeGen][UBSan] VLA size checking for unsigned integer parameter

The code generation for the UBSan VLA size check was qualified by a con-
dition that the parameter must be a signed integer, however the C spec
does not make any distinction that only signed integer parameters can be
used to declare a VLA, only qualifying that it must be greater than zero
if it is not a constant.

Reviewed By: rjmccall

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

2 years ago[NFC][MLGO] Use ASSERT_TRUE in TFUtilsTest, where appropriate.
Mircea Trofin [Wed, 12 Jan 2022 00:10:02 +0000 (16:10 -0800)]
[NFC][MLGO] Use ASSERT_TRUE in TFUtilsTest, where appropriate.

2 years ago[LLDB][NativePDB] Add support for inlined functions
Zequan Wu [Sat, 8 Jan 2022 00:32:14 +0000 (16:32 -0800)]
[LLDB][NativePDB] Add support for inlined functions

This adds inline function support to NativePDB by parsing S_INLINESITE records
to retrieve inlinee line info and add them into line table at `ParseLineTable`.

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

2 years ago[NFC] Fixup for comment
Julian Lettner [Tue, 11 Jan 2022 23:34:46 +0000 (15:34 -0800)]
[NFC] Fixup for comment

2 years ago[MLIR][SCF] Canonicalize while statement whose cmp condition is recomputed in the...
William S. Moses [Tue, 11 Jan 2022 20:39:18 +0000 (15:39 -0500)]
[MLIR][SCF] Canonicalize while statement whose cmp condition is recomputed in the after region

Given a while loop whose condition is given by a cmp, don't recomputed the comparison (or its inverse) in the after region, instead use a constant since  the original condition must be true if we branched to the after region.

Reviewed By: mehdi_amini

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

2 years ago[TSan][Darwin] Enable Trace/TraceAlloc unit tests
Julian Lettner [Tue, 11 Jan 2022 23:30:17 +0000 (15:30 -0800)]
[TSan][Darwin] Enable Trace/TraceAlloc unit tests

These tests are now green:
```
  Trace.MultiPart
  Trace.RestoreAccess
  Trace.RestoreMutexLock
  TraceAlloc.FinishedThreadReuse
  TraceAlloc.FinishedThreadReuse2
  TraceAlloc.SingleThread
```

rdar://82107856

2 years ago[libc++] Temporarily disable the in_out_result test on Fuchsia.
Konstantin Varlamov [Tue, 11 Jan 2022 23:04:53 +0000 (15:04 -0800)]
[libc++] Temporarily disable the in_out_result test on Fuchsia.

2 years ago[TSan][Darwin] Mark test UNSUPPORTED for iOS simulator
Julian Lettner [Tue, 11 Jan 2022 22:59:52 +0000 (14:59 -0800)]
[TSan][Darwin] Mark test UNSUPPORTED for iOS simulator

2 years ago[sanitizer_common] Only use NT_GNU_BUILD_ID in sanitizer_linux_libcdep.cpp if supported
Rainer Orth [Tue, 11 Jan 2022 22:50:37 +0000 (23:50 +0100)]
[sanitizer_common] Only use NT_GNU_BUILD_ID in sanitizer_linux_libcdep.cpp if supported

D114294 <https://reviews.llvm.org/D114294> broke the Solaris buildbots:

  /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp:613:29: error: use of undeclared identifier 'NT_GNU_BUILD_ID'
          if (nhdr->n_type == NT_GNU_BUILD_ID && nhdr->n_namesz == kGnuNamesz) {
                              ^

Like D107556 <https://reviews.llvm.org/D107556>, it forgot that
`NT_GNU_BUILD_ID` is an unportable GNU extension.

Fixed by making the code conditional on the definition of the macro.

Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`.

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

2 years ago[llvm-libtool-darwin] Print a warning if object file names are repeated
Roger Kim [Tue, 11 Jan 2022 22:38:25 +0000 (14:38 -0800)]
[llvm-libtool-darwin] Print a warning if object file names are repeated

Print a warning if `llvm-libtool-darwin` if any of the object
files provided by the user have the same file name.

The tool will now print a warning if there is a name collision across:

* Two object files
* An object file and an object file from within a static library
* Two object files from different static libraries

Here is an example of the error:

```
$ llvm-libtool-darwin -static -o archive.a out.o out.o
error: file 'out.o' was specified multiple times.
in: out.o
in: out.o

$ llvm-libtool-darwin -static -o archive.a out.o
$ llvm-libtool-darwin -static -o combined.a archive.a out.o
error: file 'out.o' was specified multiple times.
in: archive.a
in: out.o
```

This change mimics apple's cctools libtool's behavior which always shows a warning in such cases.

Reviewed By: smeenai

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

2 years ago[NFC][llvm-libtool-darwin] Encapsulate the process of adding a new member in a class
Roger Kim [Tue, 11 Jan 2022 22:37:33 +0000 (14:37 -0800)]
[NFC][llvm-libtool-darwin] Encapsulate the process of adding a new member in a class

Here we are refactoring the code to encapsulate data into classes. This allows
us to avoid passing the same objects through many functions that don't directly
use them. Now, functions that need to access data can do so from the class
state.

Reviewed By: jhenderson, smeenai

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

2 years agoAdd 'eager-checks' as a module parameter to MSAN.
Kevin Athey [Tue, 11 Jan 2022 21:20:12 +0000 (13:20 -0800)]
Add 'eager-checks' as a module parameter to MSAN.

This creates a way to configure MSAN to for eager checks that will be leveraged
by the introduction of a clang flag (-fsanitize-memory-param-retval).

This is redundant with the existing flag: -mllvm -msan-eager-checks.

Reviewed By: vitalybuka

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

2 years ago[libc++] Introduce __fits_in_sso()
Nikolas Klauser [Tue, 4 Jan 2022 16:24:03 +0000 (17:24 +0100)]
[libc++] Introduce __fits_in_sso()

Introduce `__fits_in_sso()` to put the constexpr tests into a central place.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[libc++] Add Status page for P2321R2 (Zip)
Nikolas Klauser [Thu, 6 Jan 2022 22:12:55 +0000 (23:12 +0100)]
[libc++] Add Status page for P2321R2 (Zip)

Add a status page for P2321R2

Reviewed By: ldionne, Mordante, #libc

Spies: jloser, libcxx-commits, arphaman

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

2 years ago[libc++] Introduce __debug_db_insert_c()
Nikolas Klauser [Mon, 10 Jan 2022 23:33:35 +0000 (00:33 +0100)]
[libc++] Introduce __debug_db_insert_c()

There are a lot of
```
#if _LIBCPP_DEBUG_LEVEL == 2
    __get_db()->__insert_c(this);
#endif
```

This patch introduces `__debug_db_insert_c()` to put the `#if` in one central place.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[clang][#47272] Avoid suggesting deprecated version of a declaration over another...
Markus Böck [Mon, 10 Jan 2022 07:42:45 +0000 (08:42 +0100)]
[clang][#47272] Avoid suggesting deprecated version of a declaration over another in typo correction

Prior to this patch, clang might suggest a deprecated name of a declaration over another name as the only mechanism for resolving two typo corrections referring to the same underlying declaration has previously been an alphabetical sort.

This patch adjusts this resolve by also taking into account whether one of two declarations are deprecated. If the new one is deprecated it may not replace a previous correction with a non-deprecated correction and a previous deprecated correction always gets replaced by a non-deprecated new correction.

Fixes https://github.com/llvm/llvm-project/issues/47272

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

2 years ago[MCA] Switching from conservatively guessing which instructions are
Patrick Holland [Mon, 3 Jan 2022 00:37:14 +0000 (16:37 -0800)]
[MCA] Switching from conservatively guessing which instructions are
memory-barrier instructions to providing targets and developers a convenient
way to explicitly declare which instructions are memory-barriers.

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

2 years ago[mlir][Linalg] Pattern to fuse pad operation with elementwise operations.
MaheshRavishankar [Tue, 11 Jan 2022 21:35:37 +0000 (13:35 -0800)]
[mlir][Linalg] Pattern to fuse pad operation with elementwise operations.

Most convolution operations need explicit padding of the input to
ensure all accesses are inbounds. In such cases, having a pad
operation can be a significant overhead. One way to reduce that
overhead is to try to fuse the pad operation with the producer of its
source.

A sequence

```
linalg.generic -> linalg.pad_tensor
```

can be replaced with

```
linalg.fill -> tensor.extract_slice -> linalg.generic ->
tensor.insert_slice.
```

if the `linalg.generic` has all parallel iterator types.

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

2 years ago[AIX] add the xcoff symbol size for the llvm-nm.
zhijian [Tue, 11 Jan 2022 21:24:43 +0000 (16:24 -0500)]
[AIX] add the xcoff symbol size for the llvm-nm.

Summary:

add the xcoff symbol size for the llvm-nm.

Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D113104

2 years agoRevert D109159 : Revert "[amdgpu] Enable selection of `s_cselect_b64`."
David Salinas [Wed, 5 Jan 2022 18:47:32 +0000 (18:47 +0000)]
Revert D109159 : Revert "[amdgpu] Enable selection of `s_cselect_b64`."

This reverts commit 640beb38e7710b939b3cfb3f4c54accc694b1d30.

That commit caused performance degradtion in Quicksilver test QS:sGPU and a functional test failure in (rocPRIM rocprim.device_segmented_radix_sort).
Reverting until we have a better solution to s_cselect_b64 codegen cleanup

Change-Id: Ifc167b3c2dae7a65920676f22a97ba76485f3456

Reviewed By: kzhuravl

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

Change-Id: I1abf49b74a7e2ba0e0205f747a4154a468b9d7f2

2 years agoGlobalISel: Use cloneVirtualRegister in localizer
Matt Arsenault [Tue, 11 Jan 2022 17:56:24 +0000 (12:56 -0500)]
GlobalISel: Use cloneVirtualRegister in localizer

2 years agoAMDGPU/GlobalISel: Regenerate baseline checks to include -NEXT
Matt Arsenault [Tue, 11 Jan 2022 20:28:44 +0000 (15:28 -0500)]
AMDGPU/GlobalISel: Regenerate baseline checks to include -NEXT

2 years ago[InstCombine] Pull out a helper function to simplify upcoming patch [NFC]
Philip Reames [Tue, 11 Jan 2022 21:05:25 +0000 (13:05 -0800)]
[InstCombine] Pull out a helper function to simplify upcoming patch [NFC]

2 years ago[DSE] Seperate malloc+memset -> calloc transform from noop store dedection [NFC]
Philip Reames [Tue, 11 Jan 2022 20:33:44 +0000 (12:33 -0800)]
[DSE] Seperate malloc+memset -> calloc transform from noop store dedection [NFC]

This transformation has nothing to do with whether the store is a noop.  The memset becomes a noop, but only after we replace the malloc with a calloc.

2 years ago[AIX] support xcoff for llvm-nm
zhijian [Tue, 11 Jan 2022 20:53:25 +0000 (15:53 -0500)]
[AIX] support xcoff for llvm-nm

Summary:

add the xcoff symbol type functionality for llvm-nm.

Reviewers: James Henderson
Differential Revision: https://reviews.llvm.org/D112450

2 years ago[NFC][MLGO] Remove the word "inliner" in a generic error message.
Mircea Trofin [Tue, 11 Jan 2022 20:36:16 +0000 (12:36 -0800)]
[NFC][MLGO] Remove the word "inliner" in a generic error message.

2 years agoMerge BOLT into LLVM monorepo
Maksim Panchenko [Tue, 11 Jan 2022 20:35:14 +0000 (12:35 -0800)]
Merge BOLT into LLVM monorepo

Details of the merge are available at llvm-dev.

Mailing-list: https://lists.llvm.org/pipermail/llvm-dev/2022-January/154638.html [llvm-dev] Preparing BOLT for LLVM monorepo

Co-authored-by: Rafael Auler <rafaelauler@fb.com>
2 years ago[DSE] Minor style improvements to calloc formation code [NFC]
Philip Reames [Tue, 11 Jan 2022 20:14:28 +0000 (12:14 -0800)]
[DSE] Minor style improvements to calloc formation code [NFC]

2 years ago[clang] number labels in asm goto strings after tied inputs
Nick Desaulniers [Tue, 11 Jan 2022 19:51:22 +0000 (11:51 -0800)]
[clang] number labels in asm goto strings after tied inputs

I noticed that the following case would compile in Clang but not GCC:
    void *x(void) {
      void *p = &&foo;
      asm goto ("# %0\n\t# %l1":"+r"(p):::foo);
      foo:;
      return p;
    }

Changing the output template above from %l2 would compile in GCC but not
Clang.

This demonstrates that when using tied outputs (say via the "+r" output
constraint), the hidden inputs occur or are numbered BEFORE the labels,
at least with GCC.

In fact, GCC does denote this in its documentation:
https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Extended-Asm.html#Goto-Labels

> Output operand with constraint modifier ‘+’ is counted as two operands
> because it is considered as one output and one input operand.

For the sake of compatibility, I think it's worthwhile to just make this
change.

It's better to use symbolic names for compatibility (especially now
between released version of Clang that support asm goto with outputs).
ie. %l1 from the above would be %l[foo]. The GCC docs also make this
recommendation.

Also, I cleaned up some cruft in GCCAsmStmt::getNamedOperand. AFAICT,
NumPlusOperands was no longer used, though I couldn't find which commit
didn't clean that up correctly.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98096
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103640
Link: https://gcc.gnu.org/onlinedocs/gcc-11.2.0/gcc/Extended-Asm.html#Goto-Labels
Reviewed By: void

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