platform/upstream/llvm.git
2 years ago[clang][NFC] refactor GlobalMethodPool to encapsulate its map
Richard Howell [Thu, 16 Sep 2021 21:01:30 +0000 (14:01 -0700)]
[clang][NFC] refactor GlobalMethodPool to encapsulate its map

This refactor changes the GlobalMethodPool to a class that contains
the DenseMap of methods. This is to allow for the addition of a
separate DenseSet in a follow-up diff that will handle method
de-duplication when inserting methods into the global method pool.

Changes:
  - the `GlobalMethods` pair becomes `GlobalMethodPool::Lists`
  - the `GlobalMethodPool` becomes a class containing the `DenseMap` of methods
  - pass through methods are added to maintain most of the existing code without changing `MethodPool` -> `MethodPool.Methods` everywhere

Reviewed By: dexonsmith

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

2 years ago[Bazel] Use posix definitions for FreeBSD
William Muir [Thu, 16 Sep 2021 20:53:39 +0000 (13:53 -0700)]
[Bazel] Use posix definitions for FreeBSD

Presently, definitions default to those for Linux which are not defined for FreeBSD (HAVE_LSEEK64, HAVE_MALLINFO, etc.).  Patch sets os_defines to posix definitions under FreeBSD.

Reviewed By: GMNGeoffrey

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

2 years agoRevert "[lldb] Skip TestAppleSimulatorOSType if json parsing fails"
Augusto Noronha [Thu, 16 Sep 2021 20:47:34 +0000 (17:47 -0300)]
Revert "[lldb] Skip TestAppleSimulatorOSType if json parsing fails"

This reverts commit 47dd1f642846d476e3d789f4aa941699dc0ed3fe.
After discussing with Jim Ingham, we agreed to leave the test as-is
so we can catch any CI problems instead of silently skipping the test.

2 years agoRevert "[MachCore] Report arm64 thread exception state"
Vedant Kumar [Thu, 16 Sep 2021 20:43:35 +0000 (13:43 -0700)]
Revert "[MachCore] Report arm64 thread exception state"

This reverts commit 7eb67748f9d7186419d678e807c01fc2a3811a80. It causes
TestMachCore.MachCoreTestCase to fail.

2 years ago[MachCore] Report arm64 thread exception state
Vedant Kumar [Tue, 14 Sep 2021 23:58:40 +0000 (16:58 -0700)]
[MachCore] Report arm64 thread exception state

A MachO userspace corefile may contain LC_THREAD commands which specify
thread exception state.

For arm64* only (for now), report a human-readable version of this state
as the thread stop reason, instead of 'SIGSTOP'.

As a follow-up, similar functionality can be implemented for x86 cores
by translating the trapno/err exception registers.

rdar://82898146

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

2 years ago[lldb] Refactor and rename CPlusPlusLanguage::FindAlternateFunctionManglings
Alex Langford [Tue, 14 Sep 2021 20:31:35 +0000 (13:31 -0700)]
[lldb] Refactor and rename CPlusPlusLanguage::FindAlternateFunctionManglings

I have 2 goals with this change:
1. Disambiguate between CPlusPlus::FindAlternateFunctionManglings and
   IRExecutionUnit::FindBestAlternateMangledName. These are named very
   similar things, they try to do very similar things, but their
   approaches are different. This change should make it clear that one
   is generating possible alternate manglings (through some
   heuristics-based approach) and the other is finding alternate
   manglings (through searching the SymbolFile for potential matches).
2. Change GenerateAlternateFunctionManglings from a static method in
   CPlusPlusLanguage to a virtual method in Language. This will allow us
   to remove a direct use of CPlusPlusLanguage in IRExecutionUnit,
   further pushing it to be more general. This change doesn't meet this
   goal completely but allows for it to happen later.

Though this doesn't remove IRExecutionUnit's dependency on
CPlusPlusLanguage, it does bring us closer to that goal.

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

2 years ago[AMDGPU] NFC: Fixing small spelling errors in AMDGPU header files
Jacob Lambert [Tue, 14 Sep 2021 02:14:52 +0000 (19:14 -0700)]
[AMDGPU] NFC: Fixing small spelling errors in AMDGPU header files

Nonfunctional commit fixing several minor spelling errors in llvm/lib/Target/AMDGPU header files.
Testing workflow as a new contributor.

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

2 years agoprecommit tests for D109457
Philip Reames [Thu, 16 Sep 2021 19:23:18 +0000 (12:23 -0700)]
precommit tests for D109457

2 years ago[lldb] Skip TestAppleSimulatorOSType if json parsing fails
Augusto Noronha [Mon, 6 Sep 2021 20:03:47 +0000 (17:03 -0300)]
[lldb] Skip TestAppleSimulatorOSType if json parsing fails

xcodebuild, which is invoked by the apple_simulator_test decorator, may
may return a successful status even if it was unable to run due to the
authorization agent denying it. This causes the TestAppleSimulatorOSType
to run when it shouldn't, and throw an excpection when parsing the JSON
that lists the simulators available. Wrap the json parsing in a
try/except block and if it fails, skip the ttest.

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

2 years ago[OpenMP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build after D109635
Fangrui Song [Thu, 16 Sep 2021 19:36:45 +0000 (12:36 -0700)]
[OpenMP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build after D109635

2 years ago[MemProf] Don't instrument stack accesses unless requested
Teresa Johnson [Thu, 16 Sep 2021 05:06:07 +0000 (22:06 -0700)]
[MemProf] Don't instrument stack accesses unless requested

Skip stack accesses unless requested, as the memory profiler runtime
does not currently look at or report accesses for these addresses.

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

2 years agoautogen a SCEV test for ease of update
Philip Reames [Thu, 16 Sep 2021 19:13:33 +0000 (12:13 -0700)]
autogen a SCEV test for ease of update

2 years ago[IR] Return AAMDNodes from Instruction::getMetadata() (NFC)
Nikita Popov [Wed, 15 Sep 2021 21:01:01 +0000 (23:01 +0200)]
[IR] Return AAMDNodes from Instruction::getMetadata() (NFC)

getMetadata() currently uses a weird API where it populates a
structure passed to it, and optionally merges into it. Instead,
we can return the AAMDNodes and provide a separate merge() API.
This makes usages more compact.

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

2 years agoTemporarily revert "[LLD] Remove global state in lld/COFF" and "[lld] Add test to
Amy Huang [Thu, 16 Sep 2021 18:54:57 +0000 (11:54 -0700)]
Temporarily revert "[LLD] Remove global state in lld/COFF" and "[lld] Add test to
check for timer output"

Seems to be causing a number of asan test failures.

This reverts commit b4fa71eed34d967195514fe9b0a5211fca2bc5bc
and e03c7e367adb8f228332e3c2ef8f45484597b719.

2 years ago[fuzzer][fuchsia] Close exception channel before exiting.
Aaron Green [Thu, 16 Sep 2021 18:52:23 +0000 (11:52 -0700)]
[fuzzer][fuchsia] Close exception channel before exiting.

On Fuchsia, killing or exiting a process that has a thread listening to its own process's debugger exception channel can hang. Zircon may kill all the threads, send a synthetic exceptions to debugger, and wait for the debugger to have received them. This means the thread listening to the debug exception channel may be killed even as Zircon is waiting for that thread to drain the exception channel, and the process can become stuck in a half-dead state.

This situation is "weird" as it only arises when a process is trying to debug itself. Unfortunately, this is exactly the scenario for libFuzzer on Fuchsia: FuzzerUtilFuchsia spawns a crash-handling thread that acts like a debugger in order to be able to rewrite the crashed threads stack and resume them into libFuzzer's usual POSIX signal handlers. In practice, approximately 25% of fuzzers appear to hang on exit, after generating output and artifacts. These processes hang around until the platform is torn done, which is typically a ClusterFuzz VM. Thus, real-world impact has been somewhat mitigated. The issue should still be resolved for local users, though.

This change improves the behavior of exit() in libFuzzer by adding an atexit handler which closes an event shared with the crash handling thread. This signals to the crash handler that it should close the exception channel and be joined before the process actually exits.

Reviewed By: charco

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

2 years ago[mlir][tosa] Relax ranked constraint on quantization builder
Rob Suderman [Thu, 16 Sep 2021 18:43:41 +0000 (11:43 -0700)]
[mlir][tosa] Relax ranked constraint on quantization builder

TosaOp defintion had an artificial constraint that the input/output types
needed to be ranked to invoke the quantization builder. This is correct as an
unranked tensor could still be quantized.

Reviewed By: NatashaKnk

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

2 years ago[lld] Add test to check for timer output
Amy Huang [Wed, 15 Sep 2021 22:14:47 +0000 (15:14 -0700)]
[lld] Add test to check for timer output

This test checks that timers are working and printing as expected.

I also seem to have changed the order of the timers in my globals refactoring
patch, so I fixed it here.

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

2 years ago[CUDA] Pass ExecConfig through BuildCallToMemberFunction
Artem Belevich [Thu, 26 Aug 2021 19:38:33 +0000 (12:38 -0700)]
[CUDA] Pass ExecConfig through BuildCallToMemberFunction

Otherwise, we fail to compile calls to CUDA kernels that are static members.

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

2 years ago[AIX][ZOS] Disable LIT tests on AIX and z/OS due to lack of Objective-C support
Jake Egan [Thu, 16 Sep 2021 18:03:36 +0000 (14:03 -0400)]
[AIX][ZOS] Disable LIT tests on AIX and z/OS due to lack of Objective-C support

AIX and z/OS lack Objective-C support, so mark these tests as unsupported for AIX and z/OS.

Reviewed By: jsji

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

2 years ago[RISCV] Select (srl (sext_inreg X, i32), uimm5) to SRAIW if only lower 32 bits are...
Craig Topper [Thu, 16 Sep 2021 17:37:55 +0000 (10:37 -0700)]
[RISCV] Select (srl (sext_inreg X, i32), uimm5) to SRAIW if only lower 32 bits are used.

SimplifyDemandedBits can turn srl into sra if the bits being shifted
in aren't demanded. This patch can recover the original sra in some cases.

I've renamed the tablegen class for detecting W users since the "overflowing operator"
term I originally borrowed from Operator.h does not include srl.

Reviewed By: luismarques

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

2 years ago[LLD] Remove global state in lld/COFF
Amy Huang [Fri, 3 Sep 2021 22:28:29 +0000 (15:28 -0700)]
[LLD] Remove global state in lld/COFF

This patch removes globals from the lldCOFF library, by moving globals
into a context class (COFFLinkingContext) and passing it around wherever
it's needed.

See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for
context about removing globals from LLD.

I also haven't moved the `driver` or `config` variables yet.

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

2 years ago[lldb] Remove SBExecutionContext::reset (NFC)
Jonas Devlieghere [Thu, 16 Sep 2021 17:27:07 +0000 (10:27 -0700)]
[lldb] Remove SBExecutionContext::reset (NFC)

This is a protected function that's not implemented.

2 years ago[AMDGPU] Inline non-kernel functions using extern lds
Vang Thao [Tue, 14 Sep 2021 17:49:08 +0000 (10:49 -0700)]
[AMDGPU] Inline non-kernel functions using extern lds

In https://reviews.llvm.org/D100481, forceful inline of all non-kernel
functions using lds was disabled since AMDGPULowerModuleLDS pass now handles
static lds. However that pass does not handle extern lds so non-kernel
functions using extern lds must sill be inline.

Reviewed By: hsmhsm, arsenm

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

2 years ago[SimplifyCFG] Add bonus when seeing vector ops to branch fold to common dest
Arthur Eubanks [Mon, 30 Aug 2021 19:14:57 +0000 (12:14 -0700)]
[SimplifyCFG] Add bonus when seeing vector ops to branch fold to common dest

This makes some tests in vector-reductions-logical.ll more stable when
applying D108837.

The cost of branching is higher when vector ops are involved due to
potential SLP transformations.

Reviewed By: spatel

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

2 years agodocs: correct SPHNIX document reference
Saleem Abdulrasool [Thu, 16 Sep 2021 17:42:51 +0000 (17:42 +0000)]
docs: correct SPHNIX document reference

The trailing `>` was missing, which resulted in the reference not being
processed properly.

2 years ago[InstCombine] Added llvm.powi optimizations
Dávid Bolvanský [Thu, 16 Sep 2021 17:18:47 +0000 (19:18 +0200)]
[InstCombine] Added llvm.powi optimizations

If power is even:
powi(-x, p) -> powi(x, p)
powi(fabs(x), p) -> powi(x, p)
powi(copysign(x, y), p) -> powi(x, p)

2 years ago[NFC] Added tests for llvm.powi optimizations
Dávid Bolvanský [Thu, 16 Sep 2021 15:59:38 +0000 (17:59 +0200)]
[NFC] Added tests for llvm.powi optimizations

2 years ago[llvm-profgen] Use context-sensitive byte size cost for preinliner decisions by default
Wenlei He [Thu, 16 Sep 2021 15:33:47 +0000 (08:33 -0700)]
[llvm-profgen] Use context-sensitive byte size cost for preinliner decisions by default

Turn on `use-context-cost-for-preinliner` to use context-sensitive byte size cost for preinliner decisions by default.

This is a more accurate proxy of inline cost than profile size. We tested on our large workload that it delivers measureable CPU improvement.

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

2 years agoSupport Unicode 14 identifiers
Corentin Jabot [Thu, 16 Sep 2021 17:20:35 +0000 (13:20 -0400)]
Support Unicode 14 identifiers

This update the UAX tables to support new Unicode 14 identifiers.

2 years ago[OpenMP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build after D109635
Fangrui Song [Thu, 16 Sep 2021 17:19:35 +0000 (10:19 -0700)]
[OpenMP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build after D109635

2 years agoRemoving some spurious whitespace; NFC
Aaron Ballman [Thu, 16 Sep 2021 16:45:42 +0000 (12:45 -0400)]
Removing some spurious whitespace; NFC

2 years ago[mlir][sparse] add more asserts to sparse support lib
Aart Bik [Wed, 15 Sep 2021 23:08:49 +0000 (16:08 -0700)]
[mlir][sparse] add more asserts to sparse support lib

We are having issues running the integration test of the sparse compiler
on AArch64 (crashing in the lib). This revision adds more assertions.

Reviewed By: jsetoain

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

2 years ago[FuncSpec] Add force flag to test case to trigger the transform. NFC.
Sjoerd Meijer [Thu, 16 Sep 2021 16:34:47 +0000 (17:34 +0100)]
[FuncSpec] Add force flag to test case to trigger the transform. NFC.

2 years ago[mlir][Linalg] Cleanup doc and improve logging and readability in ComprehensiveBuffer...
Nicolas Vasilache [Thu, 16 Sep 2021 16:35:13 +0000 (16:35 +0000)]
[mlir][Linalg] Cleanup doc and improve logging and readability in ComprehensiveBufferize.cpp - NFC

2 years ago[OpenMP] Support construct trait set for Clang
cchen [Thu, 16 Sep 2021 16:28:31 +0000 (11:28 -0500)]
[OpenMP] Support construct trait set for Clang

This patch supports construct trait set selector by using the existed
declare variant infrastructure inside `OMPContext` and simd selector is
currently not supported. The goal of this patch is to pass the declare variant
test inside sollve test suite.

Reviewed By: jdoerfert

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

2 years ago[LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout...
Alfonso Gregory [Thu, 16 Sep 2021 16:27:53 +0000 (18:27 +0200)]
[LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project

This way, we do not need to set LLVM_CMAKE_PATH to LLVM_CMAKE_DIR when (NOT LLVM_CONFIG_FOUND)

Reviewed By: #libc, ldionne

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

2 years ago[libcxx][libcxxabi] CMAKE_REQUIRED_FLAGS is a string, not a list
Nehal J Wani [Thu, 16 Sep 2021 16:23:53 +0000 (18:23 +0200)]
[libcxx][libcxxabi] CMAKE_REQUIRED_FLAGS is a string, not a list

When `libcxx` or `libcxxabi` is built with `-DLLVM_USE_SANITIZER=MemoryWithOrigins`
**and** `-DLIBCXX[ABI]_USE_COMPILER_RT=ON`, all of the `LIBCXX[ABI]_SUPPORTS_*_FLAG`
checks fail, since the value of `CMAKE_REQUIRED_FLAGS` is not set correctly.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=51774

Reviewed By: #libc, #libc_abi, compnerd, ldionne

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

2 years ago[test] Fix test failure in Clang :: Lexer/char-escapes-delimited.c
Matthew Voss [Wed, 15 Sep 2021 21:09:20 +0000 (14:09 -0700)]
[test] Fix test failure in Clang :: Lexer/char-escapes-delimited.c

Specify the C and C++ standards explicitly for this test. This avoids
failures for drivers that default to older standards.

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

2 years agoAdd a new frontend flag `-fswift-async-fp={auto|always|never}`
Arnold Schwaighofer [Wed, 8 Sep 2021 14:26:08 +0000 (07:26 -0700)]
Add a new frontend flag `-fswift-async-fp={auto|always|never}`

Summary:
Introduce a new frontend flag `-fswift-async-fp={auto|always|never}`
that controls how code generation sets the Swift extended async frame
info bit. There are three possibilities:

* `auto`: which determines how to set the bit based on deployment target, either
statically or dynamically via `swift_async_extendedFramePointerFlags`.
* `always`: default, always set the bit statically, regardless of deployment
target.
* `never`: never set the bit, regardless of deployment target.

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

2 years ago[llvm] Use drop_begin (NFC)
Kazu Hirata [Thu, 16 Sep 2021 15:46:26 +0000 (08:46 -0700)]
[llvm] Use drop_begin (NFC)

2 years agoFix warning on `llvm-else-after-return`. NFC.
Michael Liao [Thu, 16 Sep 2021 01:22:43 +0000 (21:22 -0400)]
Fix warning on `llvm-else-after-return`. NFC.

2 years agoRemove trailing whitespace in ASTReaderDecl.cpp
Erich Keane [Thu, 16 Sep 2021 15:23:28 +0000 (08:23 -0700)]
Remove trailing whitespace in ASTReaderDecl.cpp

2 years ago[clangd] PreamblePatch should be no-op if includes arent patched
Kadir Cetinkaya [Thu, 16 Sep 2021 09:30:55 +0000 (11:30 +0200)]
[clangd] PreamblePatch should be no-op if includes arent patched

Don't create a useless functional patch with only filename in it when
there is only include directives to be patched but they're not
requested.

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

2 years agoFix vtbl field addr space
Yaxun (Sam) Liu [Wed, 15 Sep 2021 18:21:50 +0000 (14:21 -0400)]
Fix vtbl field addr space

Storing the vtable field of an object should use the same address space as
the this pointer. Currently it is assumed to be addr space 0 but this may not
be true.

This assumption (added in 054cc3b1b469de4b0cb25d1dc3af43c679c5dc44) caused
issues for the out-of-tree CHERI targets.

Reviewed by: John McCall, Alexander Richardson

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

2 years ago[clangd] Dont work on diags if we are not going to emit
Kadir Cetinkaya [Thu, 16 Sep 2021 09:07:10 +0000 (11:07 +0200)]
[clangd] Dont work on diags if we are not going to emit

Don't install clang-tidy checks and IncludeFixer or process clang diags
when they're going to be dropped. Also disables analysis for some
warnings completely.

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

2 years agoIncrease expected line number for ExtDebugInfo.cpp
Jake Egan [Thu, 16 Sep 2021 13:59:49 +0000 (09:59 -0400)]
Increase expected line number for ExtDebugInfo.cpp

This patch increases the expected line number for one of the checks so that it doesn't have to be updated for any added/removed lines in the RUN section.

This change is in preparation for the following patch: https://reviews.llvm.org/D109060

Reviewed By: jsji

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

2 years agoAdd a command-line flag to control the Swift extended async frame info.
Doug Gregor [Wed, 15 Sep 2021 20:35:08 +0000 (13:35 -0700)]
Add a command-line flag to control the Swift extended async  frame info.

Introduce a new command-line flag `-swift-async-fp={auto|always|never}`
that controls how code generation sets the Swift extended async frame
info bit. There are three possibilities:

* `auto`: which determines how to set the bit based on deployment target, either
statically or dynamically via `swift_async_extendedFramePointerFlags`.
* `always`: the default, always set the bit statically, regardless of deployment
target.
* `never`: never set the bit, regardless of deployment target.

Patch by Doug Gregor <dgregor@apple.com>

Reviewed By: doug.gregor

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

2 years agoAdd a new API seek for the Cursor class in the DataExtractor.cpp
zhijian [Thu, 16 Sep 2021 13:39:49 +0000 (09:39 -0400)]
Add a new API seek for the Cursor class in the DataExtractor.cpp

Summary:

add a new API seek for the Cursor class in the DataExtractor.cpp

Reviewers: James Henderson, Fangrui Song

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

2 years ago[PowerPC][AIX] Add support for varargs for complex types on AIX
Zarko Todorovski [Thu, 16 Sep 2021 12:26:06 +0000 (08:26 -0400)]
[PowerPC][AIX] Add support for varargs for complex types on AIX

Remove the previous error and add support for special handling of small
complex types as in PPC64 ELF ABI. As in, generate code to load from
varargs location and pack it in a temp variable, then return a pointer to
the struct.

Reviewed By: sfertile

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

2 years ago[NewPM] Replace 'kasan-module' by 'asan-module<kernel>'
Bjorn Pettersson [Wed, 15 Sep 2021 20:56:20 +0000 (22:56 +0200)]
[NewPM] Replace 'kasan-module' by 'asan-module<kernel>'

Change the asan-module pass into a MODULE_PASS_WITH_PARAMS in the
pass registry, and add a single parameter called 'kernel' that
can be set instead of having a special pass name 'kasan-module'
to trigger that special pass config.

Main reason is to make sure that we have a unique mapping from
ClassName to PassName in the new passmanager framework, making it
possible to correctly identify the passes when dealing with options
such as -print-after and -print-pipeline-passes.

This is a follow-up to D105006 and D105007.

2 years ago[NewPM] Use a separate struct for ModuleThreadSanitizerPass
Bjorn Pettersson [Wed, 15 Sep 2021 20:26:22 +0000 (22:26 +0200)]
[NewPM] Use a separate struct for ModuleThreadSanitizerPass

Split ThreadSanitizerPass into ThreadSanitizerPass (as a function
pass) and ModuleThreadSanitizerPass (as a module pass).
Main reason is to make sure that we have a unique mapping from
ClassName to PassName in the new passmanager framework, making it
possible to correctly identify the passes when dealing with options
such as -print-after and -print-pipeline-passes.

This is a follow-up to D105006 and D105007.

2 years ago[NewPM] Use a separate struct for ModuleMemorySanitizerPass
Bjorn Pettersson [Wed, 15 Sep 2021 19:23:51 +0000 (21:23 +0200)]
[NewPM] Use a separate struct for ModuleMemorySanitizerPass

Split MemorySanitizerPass into MemorySanitizerPass (as a function
pass) and ModuleMemorySanitizerPass (as a module pass).
Main reason is to make sure that we have a unique mapping from
ClassName to PassName in the new passmanager framework, making it
possible to correctly identify the passes when dealing with options
such as -print-after and -print-pipeline-passes.

This is a follow-up to D105006 and D105007.

2 years ago[clang-cl] Fix test after 951f362e256 on systems where default target isn't x86_64
Nico Weber [Thu, 16 Sep 2021 12:43:58 +0000 (08:43 -0400)]
[clang-cl] Fix test after 951f362e256 on systems where default target isn't x86_64

2 years ago[SLP] Add additional memory versioning tests.
Florian Hahn [Thu, 16 Sep 2021 12:28:32 +0000 (13:28 +0100)]
[SLP] Add additional memory versioning tests.

2 years ago[hwasan] print globals in symbolizer-friendly format.
Florian Mayer [Mon, 13 Sep 2021 15:37:44 +0000 (16:37 +0100)]
[hwasan] print globals in symbolizer-friendly format.

Reviewed By: eugenis

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

2 years ago[ARM] Mitigate the cve-2021-35465 security vulnurability.
Alexandros Lamprineas [Thu, 2 Sep 2021 14:01:18 +0000 (15:01 +0100)]
[ARM] Mitigate the cve-2021-35465 security vulnurability.

Recently a vulnerability issue is found in the implementation of VLLDM
instruction in the Arm Cortex-M33, Cortex-M35P and Cortex-M55. If the
VLLDM instruction is abandoned due to an exception when it is partially
completed, it is possible for subsequent non-secure handler to access
and modify the partial restored register values. This vulnerability is
identified as CVE-2021-35465.

The mitigation sequence varies between v8-m and v8.1-m as follows:

v8-m.main
---------
mrs        r5, control
tst        r5, #8       /* CONTROL_S.SFPA */
it         ne
.inst.w    0xeeb00a40   /* vmovne s0, s0 */
1:
vlldm      sp           /* Lazy restore of d0-d16 and FPSCR. */

v8.1-m.main
-----------
vscclrm    {vpr}        /* Clear VPR. */
vlldm      sp           /* Lazy restore of d0-d16 and FPSCR. */

More details on
developer.arm.com/support/arm-security-updates/vlldm-instruction-security-vulnerability

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

2 years ago[ARM][CMSE] Clear the secure fp-registers when using softfp abi.
Alexandros Lamprineas [Thu, 2 Sep 2021 11:48:07 +0000 (12:48 +0100)]
[ARM][CMSE] Clear the secure fp-registers when using softfp abi.

When expanding the non-secure call instruction we are emiting code
to clear the secure floating-point registers only if the targeted
architecture has floating-point support. The potential problem is
when the source code containing non-secure calls are built with
-mfloat-abi=soft but some other part of the system has been built
with -mfloat-abi=softfp (soft and softfp are compatible as they use
the same procedure calling standard). In this case floating-point
registers could leak to non-secure state as the non-secure won't
have cleared them assuming no floating point has been used.

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

2 years ago[OpenCL] Supports optional program scope global variables in C++ for OpenCL 2021
Justas Janickas [Wed, 1 Sep 2021 16:14:22 +0000 (17:14 +0100)]
[OpenCL] Supports optional program scope global variables in C++ for OpenCL 2021

Adds support for macro `__opencl_c_program_scope_global_variables`
in C++ for OpenCL 2021 enabling a respective optional core feature
from OpenCL 3.0.

This change aims to achieve compatibility between C++ for OpenCL
2021 and OpenCL 3.0.

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

2 years ago[clang-cl] Add a /diasdkdir flag and make /winsysroot imply it
Nico Weber [Thu, 16 Sep 2021 11:42:32 +0000 (07:42 -0400)]
[clang-cl] Add a /diasdkdir flag and make /winsysroot imply it

D109708 added "DIA SDK" to our win sysroot for hermetic builds
that use LLVM_ENABLE_DIA_SDK. But the build system still has to
manually pass flags pointing to it.

Since we have a /winsysroot flag, make it look at DIA SDK in
the sysroot.

With this, the following is enough to compile the DIA2Dump example:

out\gn\bin\clang-cl ^
  "sysroot\DIA SDK\Samples\DIA2Dump\DIA2Dump.cpp" ^
  "sysroot\DIA SDK\Samples\DIA2Dump\PrintSymbol.cpp" ^
  "sysroot\DIA SDK\Samples\DIA2Dump\regs.cpp" ^
  /diasdkdir "sysroot\DIA SDK" ^
  ole32.lib oleaut32.lib diaguids.lib

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

2 years ago[lldb/win] Fix TestIRMemoryMapWindows.test when running tests in git bash
Nico Weber [Thu, 16 Sep 2021 11:40:54 +0000 (07:40 -0400)]
[lldb/win] Fix TestIRMemoryMapWindows.test when running tests in git bash

lit.util.which('link') picks up the wrong link.exe in git bash, leading
to this error:

  # command stderr:
  /usr/bin/link: extra operand '/LIBPATH:C:\\Progra....'
  Try '/usr/bin/link --help' for more information.

Instead, assume that link.exe is next to cl.exe.

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

2 years ago[AArch64][SVE] NFC: Remove unnecessary if
Cullen Rhodes [Thu, 16 Sep 2021 11:15:15 +0000 (11:15 +0000)]
[AArch64][SVE] NFC: Remove unnecessary if

2 years ago[lldb] [Process/gdb-remote] Alias sp to x31 on AArch64 for gdbserver
Michał Górny [Thu, 16 Sep 2021 09:03:00 +0000 (11:03 +0200)]
[lldb] [Process/gdb-remote] Alias sp to x31 on AArch64 for gdbserver

Alias the "sp" register to "x31" on AArch64 if one is present and does
not have the alt_name.  This is the case when connecting to gdbserver.

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

2 years ago[X86] SimplifyDemandedVectorEltsForTargetNode - add PSADBW handling
Simon Pilgrim [Thu, 16 Sep 2021 10:28:17 +0000 (11:28 +0100)]
[X86] SimplifyDemandedVectorEltsForTargetNode - add PSADBW handling

Peek through PSADBW operands to handle non demanded elements.

2 years ago[PGO] Change ThinLTO test for targets with loop unrolling disabled
Sherwin da Cruz [Thu, 16 Sep 2021 10:07:21 +0000 (11:07 +0100)]
[PGO] Change ThinLTO test for targets with loop unrolling disabled

I am working on a target in a downstream LLVM repo, and it seems that if a target backend chooses to disable loop unrolling this test would fail. A solution would be to modify the test to search for a different string instead.

The specific test checks for `if.true.direct_targ` which appears in the output when thinlto is not used (ie samplepgo). The same is true for `if.false.orig_indirect`.

However, if a target disables loop unrolling in the backend, the test fails as  `if.true.direct_targ` no longer appears, though `if.false.orig_indirect` still does. This can be seen by using a clang pragma to disable loop unrolling in the `unroll()` function.

For reference, the following files are the outputs of the last 2 test functions being compiled as the test case does, with and without thinlto, and with and without loop unrolling on the latest x86 clang build. The loop unrolling pragma was used to simulate the loop unrolling being disabled in a backend.
```
// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o out.ll
// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o out.ll
```

Reviewed By: tejohnson

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

2 years ago[lldb] [DynamicRegisterInfo] Pass name/alt_name via RegisterInfo
Michał Górny [Thu, 16 Sep 2021 09:43:56 +0000 (11:43 +0200)]
[lldb] [DynamicRegisterInfo] Pass name/alt_name via RegisterInfo

Remove the name and alt_name parameters from AddRegister() and instead
pass them via RegisterInfo.name and .alt_name fields.  This makes
the API simpler and removes some duplication.

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

2 years ago[Analyzer] ConversionChecker: track back the cast expression
Gabor Marton [Wed, 15 Sep 2021 16:32:19 +0000 (18:32 +0200)]
[Analyzer] ConversionChecker: track back the cast expression

Adding trackExpressionValue to the checker so it tracks the value of the
implicit cast's DeclRefExpression up to initialization/assignment. This
way the report becomes cleaner.

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

2 years ago[lldb] Make Platform::DebugProcess take a Target reference
Pavel Labath [Thu, 16 Sep 2021 09:14:16 +0000 (11:14 +0200)]
[lldb] Make Platform::DebugProcess take a Target reference

instead of a pointer. There are just two callers of this function, and
both of them have a valid target pointer, so there's no need for all
implementations to concern themselves with whether the pointer is null.

2 years agoBe more flexible on the storage type allowed for llvm::Any::TypeId::Id
serge-sans-paille [Thu, 16 Sep 2021 08:59:58 +0000 (10:59 +0200)]
Be more flexible on the storage type allowed for llvm::Any::TypeId::Id

This is a follow-up to 2c42a73d6c39af3833e697c0b306cb8cf8de5143.

2 years ago[GlobalISel] Add a combine for and(load , mask) -> zextload
Konstantin Schwarz [Mon, 6 Sep 2021 14:17:44 +0000 (16:17 +0200)]
[GlobalISel] Add a combine for and(load , mask) -> zextload

This only handles simple masks, not shifted masks, for now.

Reviewed By: aemerson

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

2 years ago[Test] Add test showing missing opportunity in range inference for SCEV
Max Kazantsev [Thu, 16 Sep 2021 08:08:24 +0000 (15:08 +0700)]
[Test] Add test showing missing opportunity in range inference for SCEV

2 years agoDon't set executable file in ObjectFileMachO::LoadCoreFileImages
Jason Molenda [Thu, 16 Sep 2021 08:36:56 +0000 (01:36 -0700)]
Don't set executable file in ObjectFileMachO::LoadCoreFileImages

When the corefile reader is adding binaries from the "all image
infos" LC_NOTE in a Mach-O corefile, it would detect if the binary
being added was an executable binary and set it as the Target's
executable binary.  This has the side effect of clearing the Target's
image list, so if the executable was in the middle of the all image
infos, the initial images would be dropped.  There's no need to set
the executable binary in the Target for these corefile processes,
so instead of doing multiple passes over the list to find the
executable, I'm dropping that.

2 years ago[clangd] Fix clangd crash when including a header
Queen Dela Cruz [Thu, 16 Sep 2021 08:17:37 +0000 (10:17 +0200)]
[clangd] Fix clangd crash when including a header

Fixes https://github.com/clangd/clangd/issues/819

SourceLocation of macros change when a header file is included above it. This is not checked when creating a PreamblePatch, resulting in reusing previously built preamble with an incorrect source location for the macro in the example test case.
This patch stores the SourceLocation in the struct TextualPPDirective so that it gets checked when comparing old vs new preambles.

Also creates a preamble patch for code completion parsing so that clangd does not crash when following the example test case with a large file.

Reviewed By: kadircet

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

2 years ago[AggressiveInstCombine] Add `{insert/extract}element` to `TruncInstCombine` DAG
Anton Afanasyev [Sun, 5 Sep 2021 14:29:22 +0000 (17:29 +0300)]
[AggressiveInstCombine] Add `{insert/extract}element` to `TruncInstCombine` DAG

Alive2 for `{insert/extract}element`: https://alive2.llvm.org/ce/z/hwy_E-

Actually, no one file of test suite is touched by this change,
which means that is rare pattern not generated by frontend. But
it's worth being in place.

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

2 years ago[Test][AggressiveInstCombine] Add test for truncation of vector instructions
Anton Afanasyev [Fri, 3 Sep 2021 16:44:23 +0000 (19:44 +0300)]
[Test][AggressiveInstCombine] Add test for truncation of vector instructions

Precommit test for D109236

2 years ago[lldb] [ABI/AArch64] Recognize special regs by their xN names too
Michał Górny [Mon, 13 Sep 2021 14:49:16 +0000 (16:49 +0200)]
[lldb] [ABI/AArch64] Recognize special regs by their xN names too

Recognize lr/sp/fp by their numeric register names in the ABI plugin.
This is necessary to mark them appropriately when interfacing with
gdbserver.

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

2 years ago[lldb] [gdb-remote] Try using <architecture/> for remote arch unconditionally
Michał Górny [Sat, 4 Sep 2021 13:19:39 +0000 (15:19 +0200)]
[lldb] [gdb-remote] Try using <architecture/> for remote arch unconditionally

Try determining the process architecture from <architecture/> tag
unconditionally, rather than for very specific cases.  Generic gdbserver
implementations do not support LLDB-specific packets used to determine
the process architecture, therefore this fallback is necessary to
support architecture-specific behavior on these targets.  Rather than
maintaining a mapping of all known architectures, just try mapping
the GDB values into triplets, as that is going to work most of the time.

This change is confirmed to fix LLDB against gdbserver when debugging
i386 and aarch64 executables.

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

2 years ago[FuncSpec] Add a test for specialising on a non-constant global argument. NFC.
Sjoerd Meijer [Tue, 14 Sep 2021 19:13:18 +0000 (20:13 +0100)]
[FuncSpec] Add a test for specialising on a non-constant global argument. NFC.

2 years ago[AMDGPU] Fix upcoming TableGen warnings on unused template arguments. NFC.
Jay Foad [Wed, 15 Sep 2021 13:30:18 +0000 (14:30 +0100)]
[AMDGPU] Fix upcoming TableGen warnings on unused template arguments. NFC.

The warning is implemented by D109359 which is still in review.

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

2 years ago[HardwareLoops] Loop guard intrinsic to recognise zext
Sam Parker [Thu, 16 Sep 2021 07:08:31 +0000 (08:08 +0100)]
[HardwareLoops] Loop guard intrinsic to recognise zext

If a loop count was initially represented by a 32b unsigned int in C
then the hardware-loop pass can recognise the loop guard and insert
the llvm.test.set.loop.iterations intrinsic. If this was instead a
unsigned short/char then clang inserts a zext instruction to expand
the loop count to an i32. This patch adds the necessary pattern
matching to enable the use of lvm.test.set.loop.iterations in those
cases.

Patch by: sherwin-dc

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

2 years ago[AArch64] Regenerate some test checks. NFC
David Green [Thu, 16 Sep 2021 07:30:08 +0000 (08:30 +0100)]
[AArch64] Regenerate some test checks. NFC

This regenerates some of the tests that had very-close-to-updated check
line already, in order to make them more maintainable.

2 years ago[flang][driver] Add documentation for Plugins
Stuart Ellis [Thu, 16 Sep 2021 06:47:00 +0000 (06:47 +0000)]
[flang][driver] Add documentation for Plugins

Adding documentation covering the Frontend Driver Plugins

Reviewed By: awarzynski, kiranchandramohan

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

2 years ago[mlir][OpDSL] Update op definitions to make shapes more concise (NFC).
Tobias Gysi [Thu, 16 Sep 2021 06:01:38 +0000 (06:01 +0000)]
[mlir][OpDSL] Update op definitions to make shapes more concise (NFC).

Express the input shape definitions of convolution and pooling operations in terms of the output shapes, filter shapes, strides, and dilations.

Reviewed By: shabalin, rsuderman, stellaraccident

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

2 years ago[DebugInfo] Enhance DIImportedEntity to accept children entities
Alok Kumar Sharma [Tue, 7 Sep 2021 05:55:44 +0000 (11:25 +0530)]
[DebugInfo] Enhance DIImportedEntity to accept children entities

New field `elements` is added to '!DIImportedEntity', representing
list of aliased entities.
This is needed to dump optimized debugging information where all names
in a module are imported, but a few names are imported with overriding
aliases.

Reviewed By: dblaikie

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

2 years ago[ORC] Add MethodWrapperHandler utility for WrapperFunction.
Lang Hames [Wed, 15 Sep 2021 00:45:19 +0000 (10:45 +1000)]
[ORC] Add MethodWrapperHandler utility for WrapperFunction.

MethodWrapperHandler removes some of the boilerplate when writing wrapper
functions to wrap method calls. It can be used as a handler for wrapper
functions whose first argument is an ExecutorAddress: the address is cast to a
pointer of the given class type, then the given method function pointer is
called on that object pointer (passing the rest of the arguments).

E.g.

class MyClass {
public:
  void myMethod(uint32_t, bool) { ... }
};

// SPS Method signature for myMethod -- note MyClass object address as first
// argument.
using SPSMyMethodWrapperSignature =
  SPSTuple<SPSExecutorAddress, uint32_t, bool>;

// Wrapper function for myMethod.
WrapperFunctionResult
myMethodCallWrapper(const char *ArgData, size_t ArgSize) {
  return WrapperFunction<SPSMyMethodWrapperSignature>::handle(
     ArgData, ArgSize, makeMethodWrapperHandler(&MyClass::myMethod));
}

2 years agoDelete unused GlobalIndirectSymbol::getBaseObject overloads
Fangrui Song [Thu, 16 Sep 2021 03:44:24 +0000 (20:44 -0700)]
Delete unused GlobalIndirectSymbol::getBaseObject overloads

2 years ago[mlir][sparse] add affine subscripts to sparse compilation pass
Aart Bik [Wed, 15 Sep 2021 22:18:19 +0000 (15:18 -0700)]
[mlir][sparse] add affine subscripts to sparse compilation pass

This enables the sparsification of more kernels, such as convolutions
where there is a x(i+j) subscript. It also enables more tensor invariants
such as x(1) or other affine subscripts such as x(i+1). Currently, we
reject sparsity altogether for such tensors. Despite this restriction,
however, we can already handle a lot more kernels with compound subscripts
for dense access (viz. convolution with dense input and sparse filter).
Some unit tests and an integration test demonstrate new capability.

Reviewed By: bixia

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

2 years ago[Transforms] Use make_early_inc_range (NFC)
Kazu Hirata [Thu, 16 Sep 2021 02:55:24 +0000 (19:55 -0700)]
[Transforms] Use make_early_inc_range (NFC)

2 years ago[AArch64][GlobalISel] Ensure atomic loads always get assigned GPR destinations
Jessica Paquette [Tue, 14 Sep 2021 17:03:42 +0000 (10:03 -0700)]
[AArch64][GlobalISel] Ensure atomic loads always get assigned GPR destinations

The default register bank selection code for G_LOAD assumes that we ought to
use a FPR when the load is casted to a float/double.

For atomics, this isn't true; we should always use GPRs.

Without this patch, we crash in the following example:

https://godbolt.org/z/MThjas441

Also make the code a little more stylistically consistent while we're here.

Also test some other weird cast combinations as well.

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

2 years ago[AArch64][GlobalISel] Use MI::getIntrinsicID in more spots. NFC.
Ahmed Bougacha [Wed, 15 Sep 2021 20:52:32 +0000 (13:52 -0700)]
[AArch64][GlobalISel] Use MI::getIntrinsicID in more spots. NFC.

There's technically a difference in the logic used by these
findIntrinsicID and MachineInstr::getIntrinsicID, but it shouldn't
be a meaningful difference here, with G_INTRINSIC instructions.
getIntrinsicID's "first non-def" logic should be correct for those.

2 years ago[GlobalISel] Fix CombinerHelper::isPredecessor for same def/use MI.
Ahmed Bougacha [Wed, 15 Sep 2021 20:52:01 +0000 (13:52 -0700)]
[GlobalISel] Fix CombinerHelper::isPredecessor for same def/use MI.

The doc comment for isPredecessor says:
  Returns true if \p DefMI precedes \p UseMI or they are the same
  instruction.
And dominates relies on that behavior for its own:
  Returns true if \p DefMI dominates \p UseMI. By definition an
  instruction dominates itself.

Make both statements correct by fixing isPredecessor.
Found by inspection.

2 years ago[MemProf] Fix format warnings
Teresa Johnson [Wed, 15 Sep 2021 23:27:21 +0000 (16:27 -0700)]
[MemProf] Fix format warnings

Fix the warnings that show up with -Wformat in this file.

2 years ago[lldb-vscode] Fix focus thread when previous thread exits
Ted Woodward [Wed, 15 Sep 2021 23:03:42 +0000 (18:03 -0500)]
[lldb-vscode] Fix focus thread when previous thread exits

The thread that Visual Studio Code displays on a stop is called the focus thread. When the previous focus thread exits and we stop in a new thread, lldb-vscode does not tell vscode to set the new thread as the focus thread, so it selects the first thread in the thread list.

This patch changes lldb-vscode to tell vscode that the new thread is the focus thread. It also includes a test that verifies the DAP stop message for this case contains the correct values.

Reviewed By: clayborg, wallace

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

2 years ago[MemProf] Avoid global lock when updating MIB cache
Teresa Johnson [Wed, 15 Sep 2021 21:04:51 +0000 (14:04 -0700)]
[MemProf] Avoid global lock when updating MIB cache

Previously we used a global Allocator-scope mutex to lock when adding a
deallocation to the MIB cache. This resulted in a lot of contention.
Instead add and use per-set mutexes.

Along with this, we now need to remove the global miss and access count
variables and instead utilize the per-set statistics to report the
overall miss rate.

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

2 years agoPR51874: Fix diagnostics for defaulted, implicitly deleted 'operator!='.
Richard Smith [Wed, 15 Sep 2021 22:40:27 +0000 (15:40 -0700)]
PR51874: Fix diagnostics for defaulted, implicitly deleted 'operator!='.

Don't say we couldn't find an 'operator<=>' when we were actually
looking for an 'operator=='. Also fix a crash when attempting to
diagnose if we select a built-in 'operator!=' in this lookup.

2 years ago[test] Move some llvm-extract tests into the proper directory
Arthur Eubanks [Wed, 15 Sep 2021 22:42:04 +0000 (15:42 -0700)]
[test] Move some llvm-extract tests into the proper directory

2 years ago[NFC] Split up PassBuilder.cpp
Arthur Eubanks [Tue, 14 Sep 2021 23:44:29 +0000 (16:44 -0700)]
[NFC] Split up PassBuilder.cpp

PassBuilder.cpp is the slowest file to compile in LLVM.
When trying to test changes to pipelines, it takes a long time to recompile.

This doesn't actually speedup building PassBuilder.cpp itself since most
of the time is spent in other large/duplicated functions caused by
PassRegistry.def.

Reviewed By: asbirlea

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

2 years ago[gn build] Port d249200fa7d5
LLVM GN Syncbot [Wed, 15 Sep 2021 22:14:18 +0000 (22:14 +0000)]
[gn build] Port d249200fa7d5

2 years ago[Polly] Remove autotools build systems from Externals. NFC.
Michael Kruse [Wed, 15 Sep 2021 21:37:29 +0000 (16:37 -0500)]
[Polly] Remove autotools build systems from Externals. NFC.

Building a source distribution using autotools adds GPL-licenced
files into the the sources. Although redistribution of theses files is
explicitly allowed with an exception, these are not used by Polly
which uses a CMake replacement. Use the direct source checkout
instead (replacing the output of 'make dist').

Some m4 scripts with the same licence are also included in isl/ppcg
repository. Removing them renders the autotools-based build scipts
inoperable, so remove the autotools build system altogether.

2 years agoTeach SimplifyCFG to fold switches into lookup tables in more cases.
Owen Anderson [Fri, 10 Sep 2021 04:59:23 +0000 (04:59 +0000)]
Teach SimplifyCFG to fold switches into lookup tables in more cases.

In particular, it couldn't handle cases where lookup table constant
expressions involved bitcasts. This does not seem to come up
frequently in C++, but comes up reasonably often in Rust via
`#[derive(Debug)]`.

Originally reported by pcwalton.

Reviewed By: nikic

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

2 years agoRevert "[InstCombine] Improve TryToSinkInstruction with multiple uses"
Anna Thomas [Wed, 15 Sep 2021 21:58:25 +0000 (17:58 -0400)]
Revert "[InstCombine] Improve TryToSinkInstruction with multiple uses"

This reverts commit 4ac4e52189aa6d80c3d59dc2c8f7dcc0cb7f9d58.
There are couple of test failures, which needs update of the test cases.

Doing a clean revert and will recommit the change along with fixed
testcases.