OSDN Git Service

android-x86/external-llvm-project.git
3 years agoandroid: tblgen: generate AArch64GenGICombiner.inc
Mauro Rossi [Sun, 9 Feb 2020 19:44:13 +0000 (20:44 +0100)]
android: tblgen: generate AArch64GenGICombiner.inc

Fixes the following building error:

external/llvm/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp:31:10:
fatal error: 'AArch64GenGICombiner.inc' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

3 years agoandroid: add support for libLLVMTableGenGlobalISel
Mauro Rossi [Sun, 9 Feb 2020 19:40:44 +0000 (20:40 +0100)]
android: add support for libLLVMTableGenGlobalISel

Fixes the following building error:

external/llvm/utils/TableGen/GlobalISel/CodeExpander.h:50:
error: undefined reference to 'llvm::CodeExpander::emit(llvm::raw_ostream&) const'

3 years agoandroid: build with C++14 support
Mauro Rossi [Sun, 9 Feb 2020 12:46:34 +0000 (13:46 +0100)]
android: build with C++14 support

Fixes the following building errors:

In file included from external/llvm10/lib/Support/AArch64TargetParser.cpp:14:
In file included from external/llvm10/include/llvm/Support/AArch64TargetParser.h:17:
In file included from external/llvm10/include/llvm/ADT/StringRef.h:12:
external/llvm10/include/llvm/ADT/STLExtras.h:555:49: error: no template named 'index_sequence' in namespace 'std'
  template <size_t... Ns> value_type deref(std::index_sequence<Ns...>) const {
                                           ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:560:36: error: no template named 'index_sequence' in namespace 'std'
  decltype(iterators) tup_inc(std::index_sequence<Ns...>) const {
                              ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:565:36: error: no template named 'index_sequence' in namespace 'std'
  decltype(iterators) tup_dec(std::index_sequence<Ns...>) const {
                              ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:572:46: error: no member named 'index_sequence_for' in namespace 'std'
  value_type operator*() { return deref(std::index_sequence_for<Iters...>{}); }
                                        ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:572:65: error: 'Iters' does not refer to a value
  value_type operator*() { return deref(std::index_sequence_for<Iters...>{}); }
                                                                ^
external/llvm10/include/llvm/ADT/STLExtras.h:547:41: note: declared here
template <typename ZipType, typename... Iters>
                                        ^
external/llvm10/include/llvm/ADT/STLExtras.h:575:23: error: no member named 'index_sequence_for' in namespace 'std'
    return deref(std::index_sequence_for<Iters...>{});
                 ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:575:42: error: 'Iters' does not refer to a value
    return deref(std::index_sequence_for<Iters...>{});
                                         ^
external/llvm10/include/llvm/ADT/STLExtras.h:547:41: note: declared here
template <typename ZipType, typename... Iters>
                                        ^
external/llvm10/include/llvm/ADT/STLExtras.h:579:30: error: no member named 'index_sequence_for' in namespace 'std'
    iterators = tup_inc(std::index_sequence_for<Iters...>{});
                        ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:579:49: error: 'Iters' does not refer to a value
    iterators = tup_inc(std::index_sequence_for<Iters...>{});
                                                ^
external/llvm10/include/llvm/ADT/STLExtras.h:547:41: note: declared here
template <typename ZipType, typename... Iters>
                                        ^
external/llvm10/include/llvm/ADT/STLExtras.h:586:30: error: no member named 'index_sequence_for' in namespace 'std'
    iterators = tup_dec(std::index_sequence_for<Iters...>{});
                        ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:586:49: error: 'Iters' does not refer to a value
    iterators = tup_dec(std::index_sequence_for<Iters...>{});
                                                ^
external/llvm10/include/llvm/ADT/STLExtras.h:547:41: note: declared here
template <typename ZipType, typename... Iters>
                                        ^
external/llvm10/include/llvm/ADT/STLExtras.h:606:18: error: no template named 'index_sequence' in namespace 'std'
            std::index_sequence<Ns...>) const {
            ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:618:30: error: no member named 'index_sequence_for' in namespace 'std'
    return !test(other, std::index_sequence_for<Iters...>{});
                        ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:618:49: error: 'Iters' does not refer to a value
    return !test(other, std::index_sequence_for<Iters...>{});
                                                ^
external/llvm10/include/llvm/ADT/STLExtras.h:602:23: note: declared here
template <typename... Iters>
                      ^
external/llvm10/include/llvm/ADT/STLExtras.h:635:28: error: no template named 'index_sequence' in namespace 'std'
  iterator begin_impl(std::index_sequence<Ns...>) const {
                      ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:638:50: error: no template named 'index_sequence' in namespace 'std'
  template <size_t... Ns> iterator end_impl(std::index_sequence<Ns...>) const {
                                            ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:646:28: error: no member named 'index_sequence_for' in namespace 'std'
    return begin_impl(std::index_sequence_for<Args...>{});
                      ~~~~~^
external/llvm10/include/llvm/ADT/STLExtras.h:646:47: error: 'Args' does not refer to a value
    return begin_impl(std::index_sequence_for<Args...>{});
                                              ^
external/llvm10/include/llvm/ADT/STLExtras.h:622:60: note: declared here
template <template <typename...> class ItType, typename... Args> class zippy {
                                                           ^
external/llvm10/include/llvm/ADT/STLExtras.h:648:47: error: no member named 'index_sequence_for' in namespace 'std'
  iterator end() const { return end_impl(std::index_sequence_for<Args...>{}); }
                                         ~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

3 years agoandroid: update version in {config,llvm-config}.h headers
Mauro Rossi [Sun, 3 Feb 2019 07:28:46 +0000 (08:28 +0100)]
android: update version in {config,llvm-config}.h headers

Version information is set to 10.0.0

3 years agoandroid: add 'Restat: true' to tblgenRule definition
Mauro Rossi [Sun, 9 Feb 2020 10:23:43 +0000 (11:23 +0100)]
android: add 'Restat: true' to tblgenRule definition

Based on suggestion by Colin Cross, to avoid unnecessary rebuild of llvm
in case of *.inc generated sources older than llvm-tblgen binary.

When llvm-tblgen binary is compiled and for some reason the build is interrupted,
the generated *.inc files will have a timestamp older than llvm-tblgen binary,
at this point all libLLVM* targets depending on the *.inc files are always rebuilt.

'NINJA_ARGS="-d explain" make iso_img' command revealed the cause of the problem:

ninja explain: output out/soong/.intermediates/external/llvm/llvm-gen-attributes/gen/llvm/IR/Attributes.inc
older than most recent input out/soong/host/linux-x86/bin/llvm-tblgen (1570914978 vs 1575285173)
ninja explain: out/soong/.intermediates/external/llvm/llvm-gen-attributes/gen/llvm/IR/Attributes.inc is dirty

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: update version in {config,llvm-config}.h headers
Mauro Rossi [Sun, 3 Feb 2019 07:28:46 +0000 (08:28 +0100)]
android: update version in {config,llvm-config}.h headers

Version information is set to 9.0.0

3 years agoandroid: Bitstream: add support for libLLVMBitstreamReader
Mauro Rossi [Sat, 5 Oct 2019 06:58:42 +0000 (08:58 +0200)]
android: Bitstream: add support for libLLVMBitstreamReader

To avoid following building errors:

external/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp:570: error: undefined reference to 'llvm::BitstreamCursor::ReadBlockInfoBlock(bool)'
external/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp:747: error: undefined reference to 'llvm::BitstreamCursor::EnterSubBlock(unsigned int, unsigned int*)'
...
external/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp:974: error: undefined reference to 'llvm::BitstreamCursor::skipRecord(unsigned int)'
external/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp:819: error: undefined reference to 'llvm::BitstreamCursor::ReadAbbrevRecord()'
external/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp:831: error: undefined reference to 'llvm::BitstreamCursor::readRecord(unsigned int, llvm::SmallVectorImpl<unsigned long long>&, llvm::StringRef*)'
...
external/llvm/lib/Bitcode/Reader/BitcodeReader.cpp:6402: error: undefined reference to 'llvm::BitstreamCursor::skipRecord(unsigned int)'
external/llvm/lib/Bitcode/Reader/BitcodeReader.cpp:6252: error: undefined reference to 'llvm::BitstreamCursor::EnterSubBlock(unsigned int, unsigned int*)'
external/llvm/lib/Bitcode/Reader/BitcodeReader.cpp:6278: error: undefined reference to 'llvm::BitstreamCursor::readRecord(unsigned int, llvm::SmallVectorImpl<unsigned long long>&, llvm::StringRef*)'
...
external/llvm/lib/Bitcode/Reader/BitcodeReader.cpp:3041: error: undefined reference to 'llvm::BitstreamCursor::ReadBlockInfoBlock(bool)'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)

3 years agoandroid: Coroutines: add support for libLLVMCoroutines
Mauro Rossi [Sun, 22 Sep 2019 17:52:06 +0000 (19:52 +0200)]
android: Coroutines: add support for libLLVMCoroutines

Fixes the following building error with mesa 19.3 branch:

FAILED: out/target/product/x86_64/obj/SHARED_LIBRARIES/gallium_dri_intermediates/LINKED/gallium_dri.so
...
external/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c:137: error: undefined reference to 'LLVMAddCoroEarlyPass'
external/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c:138: error: undefined reference to 'LLVMAddCoroSplitPass'
external/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c:139: error: undefined reference to 'LLVMAddCoroElidePass'
external/mesa/src/gallium/auxiliary/gallivm/lp_bld_init.c:169: error: undefined reference to 'LLVMAddCoroCleanupPass'
clang.real: error: linker command failed with exit code 1 (use -v to see invocation)

3 years agoandroid: AMDGPU: add support for Disassembler target
Mauro Rossi [Fri, 20 Sep 2019 19:54:52 +0000 (21:54 +0200)]
android: AMDGPU: add support for Disassembler target

Necessary for the new Valve ACO compiler in mesa 19.3

LLVMInitializeAMDGPUDisassembler() function exposed conditionally
to FORCE_BUILD_AMDGPU macro definition in mesa src/amd/Android.compiler.mk
as per other AMDGPU targets

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoAndroid: Fix soong building rules for llvm 9.0
Mauro Rossi [Sun, 21 Jul 2019 15:41:25 +0000 (17:41 +0200)]
Android: Fix soong building rules for llvm 9.0

The necessary static dependencies are added for Android blueprint build.

Changelog:
Build libLLVMJITLink static by adding lib/ExecutionEngine/JITLink/Android.bp
Build libLLVMRemarks static by adding lib/Remarks/Android.bp
Add libLLVMMIRParser, libLLVMJITLink and libLLVMRemarks dependencies in ./Android.bp

Fixes the following building errors at linking:

FAILED: out/soong/.intermediates/external/llvm/libLLVM/android_x86_core_shared/libLLVM.so
...
external/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp:1005: error: undefined reference to 'llvm::parseNamedRegisterReference(llvm::PerFunctionMIParsingState&, unsigned int&, llvm::StringRef, llvm::SMDiagnostic&)'
external/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp:1005: error: undefined reference to 'llvm::parseNamedRegisterReference(llvm::PerFunctionMIParsingState&, unsigned int&, llvm::StringRef, llvm::SMDiagnostic&)'
external/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp:1005: error: undefined reference to 'llvm::parseNamedRegisterReference(llvm::PerFunctionMIParsingState&, unsigned int&, llvm::StringRef, llvm::SMDiagnostic&)'
external/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp:1005: error: undefined reference to 'llvm::parseNamedRegisterReference(llvm::PerFunctionMIParsingState&, unsigned int&, llvm::StringRef, llvm::SMDiagnostic&)'
...
external/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1371: error: undefined reference to 'llvm::remarks::StringTable::serialize() const'
external/llvm/lib/IR/DiagnosticInfo.cpp:435: error: undefined reference to 'llvm::remarks::StringTable::add(llvm::StringRef)'
external/llvm/lib/IR/DiagnosticInfo.cpp:436: error: undefined reference to 'llvm::remarks::StringTable::add(llvm::StringRef)'
external/llvm/lib/IR/DiagnosticInfo.cpp:437: error: undefined reference to 'llvm::remarks::StringTable::add(llvm::StringRef)'
external/llvm/lib/IR/DiagnosticInfo.cpp:457: error: undefined reference to 'llvm::remarks::StringTable::add(llvm::StringRef)'
...
external/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp:337: error: undefined reference to 'llvm::jitlink::jitLink(std::__1::unique_ptr<llvm::jitlink::JITLinkContext, std::__1::default_delete<llvm::jitlink::JITLinkContext> >)'
external/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp:422: error: undefined reference to 'llvm::jitlink::createEHFrameRecorderPass(llvm::Triple const&, std::__1::function<void (unsigned long long)>)'
external/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp:444: error: undefined reference to 'llvm::jitlink::registerEHFrameSection(void const*)'
external/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp:457: error: undefined reference to 'llvm::jitlink::deregisterEHFrameSection(void const*)'
external/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp:476: error: undefined reference to 'llvm::jitlink::deregisterEHFrameSection(void const*)'
external/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp:25: error: undefined reference to 'llvm::jitlink::JITLinkContext::~JITLinkContext()'
external/llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp:25: error: undefined reference to 'llvm::jitlink::JITLinkContext::~JITLinkContext()'
out/soong/.intermediates/external/llvm/lib/ExecutionEngine/Orc/libLLVMOrcJIT/android_x86_core_static/libLLVMOrcJIT.a(ObjectLinkingLayer.o):ObjectLinkingLayer.cpp:vtable for llvm::orc::ObjectLinkingLayerJITLinkContext: error: undefined reference to 'llvm::jitlink::JITLinkContext::shouldAddDefaultTargetPasses(llvm::Triple const&) const'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoAdd SourceFileGenerator.GeneratedDeps()
Dan Willemsen [Thu, 22 Feb 2018 02:47:18 +0000 (18:47 -0800)]
Add SourceFileGenerator.GeneratedDeps()

To clean up unnecessary dependencies when using generated headers,
GeneratedDeps() should return a single file from every build entry.
GeneratedSourceFiles() used to be used from this, but now if you create
one build rule with multiple outputs, it's valid to only return a single
output file.

In this case, ModuleBuild is called once per source file, each
outputing a single output file, so all of them still need to be listed.

Bug: 73745773
Test: diff out/soong/build.ninja
Test: diff out/soong/Android-aosp_arm.mk
Test: rm -rf out; m
Change-Id: I073e3be7ecd9545f4002ad94d3da44f1a6652baa

3 years agoandroid: utils: remove redundant Android.bp
Mauro Rossi [Sat, 23 Feb 2019 12:19:34 +0000 (13:19 +0100)]
android: utils: remove redundant Android.bp

To avoid build errors with pie-x86

Implemented via following commands:

rm utils/count/Android.bp
rm utils/FileCheck/Android.bp
rm utils/yaml-bench/Android.bp
rm utils/not/Android.bp

3 years agoandroid: tools: remove redundant Android.bp
Mauro Rossi [Sat, 23 Feb 2019 12:16:35 +0000 (13:16 +0100)]
android: tools: remove redundant Android.bp

To avoid build errors in pie-x86 due to collision with external/llvm ones

Implemented via following commands:

cd tools
find . -type f -name 'Android.bp' -exec rm {} +

3 years agoandroid: config.h: Add option to disable minidumps, default it to off
Mauro Rossi [Sun, 3 Feb 2019 08:16:44 +0000 (09:16 +0100)]
android: config.h: Add option to disable minidumps, default it to off

Porting of commit
7e4b0fae ("Add cmake option to disable minidumps, default it to off")

plus some other options that are to be set on (1) or off (0)

Fixes the following building error:

external/llvm80/lib/Support/Process.cpp:88:35:
error: use of undeclared identifier 'LLVM_ENABLE_CRASH_DUMPS'
static bool coreFilesPrevented = !LLVM_ENABLE_CRASH_DUMPS;
                                  ^
1 error generated.

3 years agoandroid: update version in {config,llvm-config}.h headers
Mauro Rossi [Sun, 3 Feb 2019 07:28:46 +0000 (08:28 +0100)]
android: update version in {config,llvm-config}.h headers

Version information is set to 8.0.0

3 years agoAndroid: fix a possible building error
Chih-Wei Huang [Wed, 12 Sep 2018 11:01:54 +0000 (19:01 +0800)]
Android: fix a possible building error

The .git/logs/HEAD doesn't always exist. In a new created repo, it may
cause the error:

error: external/llvm/Android.bp:157:1: module "llvm-gen-revision": source path external/llvm/.git/logs/HEAD does not exist

Use wildcard to avoid that.

3 years agoandroid: Support: add genrule for VCSRevision.h header
Mauro Rossi [Sat, 8 Sep 2018 16:32:44 +0000 (18:32 +0200)]
android: Support: add genrule for VCSRevision.h header

Cmake build generates the header, in Android blueprint we need to add
a new "llvm-gen-revision" genrule to launch command script that will
generate "llvm/Support/VCSRevision.h" header.
For simplification the new genrule is added to "llvm-headers" library
which is already used to generate attributes and intrinsics headers.
Mesa python script git_sha1_gen.py is added to external/llvm top path,
with the only changes being the relative git_dir path at line 16 that
is changed from '..' to '.' and the content of generated header.

3 years agoandroid: AMDGPU: Make getTgtMemIntrinsic table-driven for resource-based intrinsics
Mauro Rossi [Sat, 1 Sep 2018 16:36:23 +0000 (18:36 +0200)]
android: AMDGPU: Make getTgtMemIntrinsic table-driven for resource-based intrinsics

Reference:
e821893513
("AMDGPU: Make getTgtMemIntrinsic table-driven for resource-based intrinsics")

3 years agoandroid: Add a Microsoft Demangler.
Mauro Rossi [Sat, 1 Sep 2018 15:52:18 +0000 (17:52 +0200)]
android: Add a Microsoft Demangler.

Reference: 42e40ea33e ("Add a Microsoft Demangler.")

3 years agoandroid: [InstCombine] Introducing Aggressive Instruction Combine pass
Mauro Rossi [Sat, 1 Sep 2018 15:43:50 +0000 (17:43 +0200)]
android: [InstCombine] Introducing Aggressive Instruction Combine pass

Reference:
594d89a614
[InstCombine] Introducing Aggressive Instruction Combine pass (-aggressive-instcombine).

3 years agoandroid: InstCombine: add support for InstCombineTable.inc TableGen rules
Mauro Rossi [Sat, 1 Sep 2018 15:24:18 +0000 (17:24 +0200)]
android: InstCombine: add support for InstCombineTable.inc TableGen rules

Reference:
commit 7f7cea5306
("InstCombine/AMDGPU: Add dimension-aware image intrinsics to SimplifyDemanded")

3 years agoandroid: AMDGPU: Separate R600 and GCN TableGen files
Mauro Rossi [Sat, 1 Sep 2018 16:27:47 +0000 (18:27 +0200)]
android: AMDGPU: Separate R600 and GCN TableGen files

Reference:
cba2181e77 ("AMDGPU: Separate R600 and GCN TableGen files")

3 years agoandroid: [IR] Split Intrinsics.inc into enums and implementations
Mauro Rossi [Sat, 1 Sep 2018 14:24:14 +0000 (16:24 +0200)]
android: [IR] Split Intrinsics.inc into enums and implementations

Reference:
af7c445 ("[IR] Split Intrinsics.inc into enums and implementations")

3 years agoandroid: Rename {Attributes,Intrinsics}.gen to {Attributes,Intrinsics}.inc
Mauro Rossi [Sat, 1 Sep 2018 14:10:24 +0000 (16:10 +0200)]
android: Rename {Attributes,Intrinsics}.gen to {Attributes,Intrinsics}.inc

Reference:
ea0775ec4a ("Rename Attributes.gen, Intrinsics.gen to Attributes.inc, Intrinsics.inc")

3 years agoandroid: [ARM] Unify handling of M-Class system registers
Mauro Rossi [Sat, 1 Sep 2018 11:25:45 +0000 (13:25 +0200)]
android: [ARM] Unify handling of M-Class system registers

Reference:
683224ecbd ("[ARM] Unify handling of M-Class system registers")

3 years agoandroid: [mips][rtdyld] Move MIPS relocation resolution to a subclass
Mauro Rossi [Sat, 1 Sep 2018 02:03:27 +0000 (04:03 +0200)]
android: [mips][rtdyld] Move MIPS relocation resolution to a subclass

Reference: 2762dbad70
"[mips][rtdyld] Move MIPS relocation resolution to a subclass and implment N32 relocations"

3 years agoandroid: [PM] Create a separate library for high-level pass management code.
Mauro Rossi [Sat, 1 Sep 2018 01:49:03 +0000 (03:49 +0200)]
android: [PM] Create a separate library for high-level pass management code.

Reference:
2349136630 ("[PM] Create a separate library for high-level pass management code.")

3 years agoandroid: [MSF] add support for libLLVMDebugInfoMSF
Mauro Rossi [Sat, 1 Sep 2018 01:24:26 +0000 (03:24 +0200)]
android: [MSF] add support for libLLVMDebugInfoMSF

Reference:
5e117855c3 ([msf] Resubmit "Rename Msf -> MSF".)

3 years agoandroid: NFC: Rename (PDB) RawSession to NativeSession
Mauro Rossi [Sat, 1 Sep 2018 01:22:37 +0000 (03:22 +0200)]
android: NFC: Rename (PDB) RawSession to NativeSession

Reference:
11e1d83ce5 ("NFC: Rename (PDB) RawSession to NativeSession")

3 years agoandroid: Move Object format code to lib/BinaryFormat.
Mauro Rossi [Sat, 1 Sep 2018 00:36:45 +0000 (02:36 +0200)]
android: Move Object format code to lib/BinaryFormat.

Reference:
19ca2b0f9d ("Move Object format code to lib/BinaryFormat.")

3 years agoandroid: [X86][GlobalISel] Initial implementation , select G_ADD gpr, gpr
Mauro Rossi [Fri, 31 Aug 2018 23:48:08 +0000 (01:48 +0200)]
android: [X86][GlobalISel] Initial implementation , select G_ADD gpr, gpr

Reference:
8ae3570fa804
("[X86][GlobalISel] Initial implementation , select G_ADD gpr, gpr")

3 years agoandroid: [X86][AVX512] Adding new LLVM TableGen for EVEX2VEX tables
Mauro Rossi [Fri, 31 Aug 2018 23:45:32 +0000 (01:45 +0200)]
android: [X86][AVX512] Adding new LLVM TableGen for EVEX2VEX tables

Reference:
b59d8041db [X86][AVX512] Adding new LLVM TableGen backend which
generates the EVEX2VEX compressing tables.

3 years agoandroid: [X86][GlobalISel] Add general-purpose Register Bank
Mauro Rossi [Fri, 31 Aug 2018 23:23:04 +0000 (01:23 +0200)]
android: [X86][GlobalISel] Add general-purpose Register Bank

Reference:
f4df3d44a5 ("[X86][GlobalISel] Add general-purpose Register Bank")

3 years agoandroid: [ARM] GlobalISel: Use TableGen instruction selector
Mauro Rossi [Fri, 31 Aug 2018 23:11:05 +0000 (01:11 +0200)]
android: [ARM] GlobalISel: Use TableGen instruction selector

Reference:
33dd8eaf5d ("[ARM] GlobalISel: Use TableGen instruction selector")

3 years agoandroid: [ARM] Tablegen-erate current Register Bank Information.
Mauro Rossi [Fri, 31 Aug 2018 22:51:14 +0000 (00:51 +0200)]
android: [ARM] Tablegen-erate current Register Bank Information.

Reference:
e0fd89875d
("[globalisel][arm] Tablegen-erate current Register Bank Information.")

3 years agoandroid: AMDGPU: Support using tablegened MC pseudo expansions
Mauro Rossi [Fri, 31 Aug 2018 22:47:29 +0000 (00:47 +0200)]
android: AMDGPU: Support using tablegened MC pseudo expansions

Reference:
5991ecc3e6 ("AMDGPU: Support using tablegened MC pseudo expansions")

3 years agoandroid: IR: Rename the tablegen'd Attributes file to .gen
Mauro Rossi [Fri, 31 Aug 2018 20:55:52 +0000 (22:55 +0200)]
android: IR: Rename the tablegen'd Attributes file to .gen

Reference:
e255157a48 ("IR: Rename the tablegen'd Attributes file to .gen")

3 years agoandroid: Aarch64,AMDGPU: enable GlobalISel
Mauro Rossi [Sat, 25 Aug 2018 21:45:24 +0000 (23:45 +0200)]
android: Aarch64,AMDGPU: enable GlobalISel

Reference commits:
8097fcb40b ("[GlobalISel] Add basic Selector-emitter tblgen backend.")
ca24065b98 ("[globalisel] Tablegen-erate current Register Bank Information")
945c85d877 ("AMDGPU/GlobalISel: Add support for simple shaders")

3 years agoandroid: add llvm/Config/abi-breaking.h header for host and device
Mauro Rossi [Sat, 25 Aug 2018 18:03:29 +0000 (20:03 +0200)]
android: add llvm/Config/abi-breaking.h header for host and device

Fixes the following building error:

external/llvm/include/llvm/Support/Error.h:21:10:
fatal error: 'llvm/Config/abi-breaking.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

3 years agoandroid: add llvm/Config/llvm-platform-config.h header
Mauro Rossi [Sat, 25 Aug 2018 17:59:34 +0000 (19:59 +0200)]
android: add llvm/Config/llvm-platform-config.h header

Fixes the following building error:

In file included from external/llvm70bp/lib/Support/LockFileManager.cpp:10:
In file included from external/llvm/include/llvm/Support/LockFileManager.h:12:
In file included from external/llvm/include/llvm/ADT/Optional.h:20:
In file included from external/llvm/include/llvm/Support/AlignOf.h:17:
In file included from external/llvm/include/llvm/Support/Compiler.h:18:
external/llvm/device/include/llvm/Config/llvm-config.h:98:10:
fatal error: 'llvm/Config/llvm-platform-config.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

3 years agoandroid: Moving libFuzzer from LLVM to compiler-rt.
Mauro Rossi [Sat, 25 Aug 2018 14:50:30 +0000 (16:50 +0200)]
android: Moving libFuzzer from LLVM to compiler-rt.

Reference:
ec925a2578 ("Moving libFuzzer from LLVM to compiler-rt.")

3 years agoandroid: Move lib/LibDriver -> lib/ToolDrivers/llvm-lib. NFCI.
Mauro Rossi [Sat, 25 Aug 2018 17:58:03 +0000 (19:58 +0200)]
android: Move lib/LibDriver -> lib/ToolDrivers/llvm-lib. NFCI.

Reference:
a844915ce0 ("Move lib/LibDriver -> lib/ToolDrivers/llvm-lib. NFCI.")

3 years agoDO NOT MERGE: util: build only TableGen
Mauro Rossi [Sat, 25 Aug 2018 11:23:34 +0000 (13:23 +0200)]
DO NOT MERGE: util: build only TableGen

Necessary to avoid collisions with external/llvm utils

3 years agoDO NOT MERGE: android: avoid re-building tools
Mauro Rossi [Sat, 25 Aug 2018 10:59:12 +0000 (12:59 +0200)]
DO NOT MERGE: android: avoid re-building tools

Necessary to avoid Android Build System targets conflicts with external/llvm

3 years agoandroid: update version in {config,llvm-config}.h headers
Mauro Rossi [Sat, 25 Aug 2018 10:50:12 +0000 (12:50 +0200)]
android: update version in {config,llvm-config}.h headers

Version information is set to 7.0.0

3 years agoandroid: add soong building rules
Mauro Rossi [Sat, 25 Aug 2018 10:44:44 +0000 (12:44 +0200)]
android: add soong building rules

Android.bp and building rules including Android specific .go files
are imported from oreo-x86 llvm 3.9 branch to the release_70 branch

cd ~/oreo-x86_kernel/external
git clone https://github.com/llvm-mirror/llvm llvm70
cd ~/oreo-x86_kernel/external/llvm70
git reset --hard
git fetch llvm-mirror release_70
git checkout FETCH_HEAD
git clean -dxf

cd ~/oreo-x86_kernel/external/llvm
find . -name 'Android.bp' -exec cp -v --parents {} ~/oreo-x86_kernel/external/llvm70 \;
find . -name 'Android.bp' -exec git -C /home/utente/oreo-x86_kernel/external/llvm70 add {} \;

find . -name 'llvm.go' -exec cp -v --parents {} ~/oreo-x86_kernel/external/llvm70 \;
find . -name 'llvm.go' -exec git -C /home/utente/oreo-x86_kernel/external/llvm70 add {} \;

find . -name 'tblgen.go' -exec cp -v --parents {} ~/oreo-x86_kernel/external/llvm70 \;
find . -name 'tblgen.go' -exec git -C /home/utente/oreo-x86_kernel/external/llvm70 add {} \;

find . -name 'android_test.sh' -exec cp -v --parents {} ~/oreo-x86_kernel/external/llvm70 \;
find . -name 'android_test.sh' -exec git -C /home/utente/oreo-x86_kernel/external/llvm70 add {} \;

find . -name 'AsmParsers.def' -exec cp -v --parents {} ~/oreo-x86_kernel/external/llvm70 \;
find . -name 'AsmParsers.def' -exec git -C /home/utente/oreo-x86_kernel/external/llvm70 add {} \;

find . -name 'AsmPrinters.def' -exec cp -v --parents {} ~/oreo-x86_kernel/external/llvm70 \;
find . -name 'AsmPrinters.def' -exec git -C /home/utente/oreo-x86_kernel/external/llvm70 add {} \;

find . -name 'Disassemblers.def' -exec cp -v --parents {} ~/oreo-x86_kernel/external/llvm70 \;
find . -name 'Disassemblers.def' -exec git -C /home/utente/oreo-x86_kernel/external/llvm70 add {} \;

find . -name 'Targets.def' -exec cp -v --parents {} ~/oreo-x86_kernel/external/llvm70 \;
find . -name 'Targets.def' -exec git -C /home/utente/oreo-x86_kernel/external/llvm70 add {} \;

find . -name 'config.h' -exec cp -v --parents {} ~/oreo-x86_kernel/external/llvm70 \;
find . -name 'config.h' -exec git -C /home/utente/oreo-x86_kernel/external/llvm70 add {} \;

find . -name 'llvm-config.h' -exec cp -v --parents {} ~/oreo-x86_kernel/external/llvm70 \;
find . -name 'llvm-config.h' -exec git -C /home/utente/oreo-x86_kernel/external/llvm70 add {} \;

cd ~/oreo-x86_kernel/external/llvm70

3 years agoGlobalISel: check type size before getZExtValue()ing it.
Tim Northover [Mon, 1 Feb 2021 12:43:33 +0000 (12:43 +0000)]
GlobalISel: check type size before getZExtValue()ing it.

Otherwise getZExtValue() asserts.

(cherry picked from commit c2b322fc19e829162ed4c7dcd04d9e9b2cd4e66c)

3 years agoremove -fpch-codegen and -fpch-debuginfo from Clang 12.0 release notes
Luboš Luňák [Tue, 6 Apr 2021 16:38:18 +0000 (18:38 +0200)]
remove -fpch-codegen and -fpch-debuginfo from Clang 12.0 release notes

These were new in 11.0. The commit adding the options landed after
11.x branch had already been branched off from master, and only
then backported to 11.x, so the release notes change stayed for 12.0.

3 years ago[ORC][C-bindings] Fix some ORC C bindings function names and signatures.
Lang Hames [Sun, 28 Mar 2021 23:30:47 +0000 (16:30 -0700)]
[ORC][C-bindings] Fix some ORC C bindings function names and signatures.

LLVMOrcDisposeObjectLayer and LLVMOrcExecutionSessionGetJITDylibByName did not
have matching signatures between the C-API header and binding implementations.
Fixes http://llvm.org/PR49745.

Patch by Mats Larsen. Thanks Mats!

Reviewed by: lhames

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

(cherry picked from commit 666df2e2cbe9fc252d3b2d6cbb214c2c2f6afc65)

3 years ago[LoopVectorize] Refine hasIrregularType predicate
LemonBoy [Wed, 17 Mar 2021 15:59:55 +0000 (16:59 +0100)]
[LoopVectorize] Refine hasIrregularType predicate

The `hasIrregularType` predicate checks whether an array of N values of type Ty is "bitcast-compatible" with a <N x Ty> vector.
The previous check returned invalid results in some cases where there's some padding between the array elements: eg. a 4-element array of u7 values is considered as compatible with <4 x u7>, even though the vector is only loading/storing 28 bits instead of 32.

The problem causes LLVM to generate incorrect code for some targets: for AArch64 the vector loads/stores are lowered in terms of ubfx/bfi, effectively losing the top (N * padding bits).

Reviewed By: lebedev.ri

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

(cherry picked from commit 4f024938e4c932feba4d28573ec4522106f8d879)

3 years ago[RISCV][MC] Fix nf encoding for vector ld/st whole register
ShihPo Hung [Tue, 30 Mar 2021 21:30:15 +0000 (14:30 -0700)]
[RISCV][MC] Fix nf encoding for vector ld/st whole register

The three bit nf is one less than the number of NFIELDS,
so we manually decrement 1 for VS1/2/4/8R & VL1/2/4/8R.

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

(cherry picked from commit rG5cdb2e98608bf57c216ee7067e8a12d070c9e2bd)

3 years ago[InstCombine] avoid creating an extra instruction in zext fold and possible inf-loop
Sanjay Patel [Sat, 13 Mar 2021 13:26:27 +0000 (08:26 -0500)]
[InstCombine] avoid creating an extra instruction in zext fold and possible inf-loop

The structure of this fold is suspect vs. most of instcombine
because it creates instructions and tries to delete them
immediately after.

If we don't have the operand types for the icmps, then we are
not behaving as assumed. And as shown in PR49475, we can inf-loop.

(cherry picked from commit 4224a36957420744756d6a6450eb6502a1bfadc3)

3 years ago[InstCombine] add test for zext-of-icmps; NFC
Sanjay Patel [Fri, 12 Mar 2021 19:15:27 +0000 (14:15 -0500)]
[InstCombine] add test for zext-of-icmps; NFC

PR49475 shows an infinite loop outcome, but this
tries to show the root cause with a minimal test.

(cherry picked from commit 579b8fc2e97c489308f97b01d13d894c03c0a16c)

3 years ago[X86][FastISel] Fix with.overflow eflags clobber (PR49587)
Nikita Popov [Sun, 14 Mar 2021 15:47:41 +0000 (16:47 +0100)]
[X86][FastISel] Fix with.overflow eflags clobber (PR49587)

If the successor block has a phi node, then additional moves may
be inserted into predecessors, which may clobber eflags. Don't try
to fold the with.overflow result into the branch in that case.

This is done by explicitly checking for any phis in successor
blocks, not sure if there's some more principled way to address
this. Other fused compare and branch patterns avoid the issue by
emitting the comparison when handling the branch, so that no
instructions may be inserted in between. In this case, the
with.overflow call is emitted separately (and I don't think this
is avoidable, as it will generally have at least two users).

Fixes https://bugs.llvm.org/show_bug.cgi?id=49587.

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

(cherry picked from commit 7669455df49e6fc8ae7d9f4bd4ee95bb20e7eb6e)

3 years ago[X86] Add test for PR49587 (NFC)
Nikita Popov [Sun, 14 Mar 2021 15:39:03 +0000 (16:39 +0100)]
[X86] Add test for PR49587 (NFC)

Shows a miscompile with FastISel.

(cherry picked from commit 0d814ca0f02733d6581bf209fadbebf3035380e0)

3 years ago[FastISel] Don't trivially kill extractvalues (PR49467)
Nikita Popov [Sun, 7 Mar 2021 16:27:22 +0000 (17:27 +0100)]
[FastISel] Don't trivially kill extractvalues (PR49467)

All extractvalues of the same value at the same index will map to
the same register, so even if one specific extractvalue only has
one use, we should not mark it as a trivial kill, as there may be
more extractvalues later.

Fixes https://bugs.llvm.org/show_bug.cgi?id=49467.

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

(cherry picked from commit 55ae279ba7a5905f39ce3ae79eac7834a4a134cc)

3 years ago[OpenMP] Restore backwards compatibility for libomptarget
Joseph Huber [Wed, 10 Mar 2021 18:25:33 +0000 (13:25 -0500)]
[OpenMP] Restore backwards compatibility for libomptarget

Summary:
The changes introduced in D87946 changed the API for libomptarget
functions. `__kmpc_push_target_tripcount` was a function in Clang 11.x
but was not given a backward-compatible interface. This change will
require people using Clang 13.x or 12.x to recompile their offloading
programs.

Reviewed By: jdoerfert cchen

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

(cherry picked from commit 807466ef28125cf7268c860b09d5563c9c93602a)

3 years ago[PowerPC] Fix infinite loop in peephole CR optimization (PR49509)
Nikita Popov [Wed, 10 Mar 2021 13:37:09 +0000 (14:37 +0100)]
[PowerPC] Fix infinite loop in peephole CR optimization (PR49509)

If we encounter a degenerate select node where both operands are
the same, then we can continue negating the condition while swapping
operands, resulting in an infinite loop. Avoid this by bailing out
if both operands are the same.

Fixes https://bugs.llvm.org/show_bug.cgi?id=49509.

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

(cherry picked from commit 2489cbaa8057c736475fd88990f4f6dbf022873d)

3 years ago[OpenMP] Fixed a crash in hidden helper thread
Shilei Tian [Thu, 18 Mar 2021 22:25:21 +0000 (18:25 -0400)]
[OpenMP] Fixed a crash in hidden helper thread

It is reported that after enabling hidden helper thread, the program
can hit the assertion `new_gtid < __kmp_threads_capacity` sometimes. The root
cause is explained as follows. Let's say the default `__kmp_threads_capacity` is
`N`. If hidden helper thread is enabled, `__kmp_threads_capacity` will be offset
to `N+8` by default. If the number of threads we need exceeds `N+8`, e.g. via
`num_threads` clause, we need to expand `__kmp_threads`. In
`__kmp_expand_threads`, the expansion starts from `__kmp_threads_capacity`, and
repeatedly doubling it until the new capacity meets the requirement. Let's
assume the new requirement is `Y`.  If `Y` happens to meet the constraint
`(N+8)*2^X=Y` where `X` is the number of iterations, the new capacity is not
enough because we have 8 slots for hidden helper threads.

Here is an example.
```
#include <vector>

int main(int argc, char *argv[]) {
  constexpr const size_t N = 1344;
  std::vector<int> data(N);

#pragma omp parallel for
  for (unsigned i = 0; i < N; ++i) {
    data[i] = i;
  }

#pragma omp parallel for num_threads(N)
  for (unsigned i = 0; i < N; ++i) {
    data[i] += i;
  }

  return 0;
}
```
My CPU is 20C40T, then `__kmp_threads_capacity` is 160. After offset,
`__kmp_threads_capacity` becomes 168. `1344 = (160+8)*2^3`, then the assertions
hit.

Reviewed By: protze.joachim

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

(cherry picked from commit 2df65f87c1ea81008768e14522e5d9277234ba70)

3 years ago[SimplifyCFG] avoid sinking insts within an infinite-loop
Sanjay Patel [Fri, 12 Mar 2021 12:56:54 +0000 (07:56 -0500)]
[SimplifyCFG] avoid sinking insts within an infinite-loop

The test is reduced from a C source example in:
https://llvm.org/PR49541

It's possible that the test could be reduced further or
the predicate generalized further, but it seems to require
a few ingredients (including the "late" SimplifyCFG options
on the RUN line) to fall into the infinite-loop trap.

(cherry picked from commit bd197ed0a57a82187ed3c6265ca811d412acfaef)

3 years ago[Support] Fix 'keeping' temporary files on Windows 7
Alexandre Ganea [Wed, 24 Mar 2021 16:28:00 +0000 (12:28 -0400)]
[Support] Fix 'keeping' temporary files on Windows 7

As reported here: https://bugs.llvm.org/show_bug.cgi?id=48378#c0
and here: https://github.com/rust-lang/rust/issues/81051
since 79657e2339b58bc01fe1b85a448bb073d57d90bb, some programs such as llvm-ar
don't work properly on Windows 7.

The issue is shown in the snippet by Oleksandr Prodan:
https://pastebin.com/v51m3uBU

In essence, once the 'DeleteFile' flag has been set on FILE_DISPOSITION_INFO,
the file path can't be queried anymore with GetFinalPathNameByHandleW. This
however works on Windows 10, GetFinalPathNameByHandleW would return sucessfully.

To workaround the issue, we simply reset the 'DeleteFile' flag before even
checking if we're dealing with a network file.

Tested with `llvm-ar r empty.a a.obj` ran on a network mount. At the moment, we
cannot specifically add a test coverage for this, since it requres mounting a
network drive.

(cherry picked from commit 64ab2b6825c5aeae6e4afa7ef0829b89a6828102)

3 years ago[WoA][MSVC] Use default linker setting in MSVC-compatible driver [take 2]
Maxim Kuvyrkov [Fri, 19 Mar 2021 13:37:19 +0000 (13:37 +0000)]
[WoA][MSVC] Use default linker setting in MSVC-compatible driver [take 2]

At the moment "link.exe" is hard-coded as default linker in MSVC.cpp,
so there's no way to use LLD as default linker for MSVC driver.

This patch adds checking of CLANG_DEFAULT_LINKER to MSVC.cpp and
updates unit-tests that expect link.exe linker to explicitly select it
via -fuse-ld=link, so that buildbots and other builds that set
-DCLANG_DEFAULT_LINKER=foobar don't fail these tests.

This is a squash of
- https://reviews.llvm.org/D98493 (MSVC.cpp change) and
- https://reviews.llvm.org/D98862 (unit-tests change)

Fixes https://bugs.llvm.org/show_bug.cgi?id=49624

Reviewed By: maxim-kuvyrkov

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

(cherry-picked from commit 2049fe58903b68f66872a18e608f40e5233b55fb)

3 years ago[aarch64][WOA64][docs] Release note for WoA-hosted LLVM 12 binary
Maxim Kuvyrkov [Thu, 18 Mar 2021 16:08:58 +0000 (16:08 +0000)]
[aarch64][WOA64][docs] Release note for WoA-hosted LLVM 12 binary

Reviewed By: peterwaller-arm

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

3 years ago[OpenCL][Docs] Release notes
Anastasia Stulova [Tue, 16 Mar 2021 12:07:15 +0000 (12:07 +0000)]
[OpenCL][Docs] Release notes

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

3 years ago[release][docs] List all cores Arm has added support for in LLVM 12.
Amilendra Kodithuwakku [Fri, 12 Mar 2021 20:03:23 +0000 (20:03 +0000)]
[release][docs] List all cores Arm has added support for in LLVM 12.

Add new-line before sub-list for proper rendering.

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

3 years ago[release][docs] List all cores Arm has added support for in LLVM 12.
Amilendra Kodithuwakku [Fri, 12 Mar 2021 19:19:29 +0000 (19:19 +0000)]
[release][docs] List all cores Arm has added support for in LLVM 12.

Reviewed By: kristof.beyls

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

3 years ago[CMake][compiler-rt] Use copying instead of symlinking for LSE builtins on non-Unix...
Raul Tambre [Sat, 6 Mar 2021 09:45:57 +0000 (11:45 +0200)]
[CMake][compiler-rt] Use copying instead of symlinking for LSE builtins on non-Unix-likes

As reported in D93278 post-review symlinking requires privilege escalation on Windows.
Copying is functionally same, so fallback to it for systems that aren't Unix-like.
This is similar to the solution in AddLLVM.cmake.

Reviewed By: ikudrin

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

(cherry picked from commit ba860963b156db3b653c67ef044df877f3cea9cc)

3 years ago[TargetLowering] Use HandleSDNodes to prevent nodes from being deleted by recursive...
Craig Topper [Fri, 5 Mar 2021 06:30:38 +0000 (22:30 -0800)]
[TargetLowering] Use HandleSDNodes to prevent nodes from being deleted by recursive calls in getNegatedExpression.

For binary or ternary ops we call getNegatedExpression multiple
times and then compare costs. While we're doing this we need to
hold a node from the first call across the second call, but its
not yet attached to the DAG. Its possible the second call creates
an identical node and then decides it didn't need it so will try
to delete it if it has no uses. This can cause a reference to the
node we're holding further up the call stack to become invalidated.

To prevent this, we can use a HandleSDNode to artifically give
the node a use without connecting it to the DAG.

I've used a std::list of HandleSDNodes so we can create handles
only when we have a node to hold. HandleSDNode does not have
default constructor and cannot be copied or moved.

Fixes PR49393.

Reviewed By: spatel

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

(cherry picked from commit 74e6030bcbcc8e628f9a99a424342a0c656456f9)

3 years ago[LoopVectorize] Fix VPRecipeBuilder::createEdgeMask to correctly generate the mask
Juneyoung Lee [Tue, 9 Feb 2021 05:06:17 +0000 (14:06 +0900)]
[LoopVectorize] Fix VPRecipeBuilder::createEdgeMask to correctly generate the mask

This patch fixes pr48832 by correctly generating the mask when a poison value is involved.

Consider this CFG (which is a part of the input):

```
for.body:                                         ; preds = %for.cond
  br i1 true, label %cond.false, label %land.rhs

land.rhs:                                         ; preds = %for.body
  br i1 poison, label %cond.end, label %cond.false

cond.false:                                       ; preds = %for.body, %land.rhs
  br label %cond.end

cond.end:                                         ; preds = %land.rhs, %cond.false
  %cond = phi i32 [ 0, %cond.false ], [ 1, %land.rhs ]

```

The path for.body -> land.rhs -> cond.end should be taken when 'select i1 false, i1 poison, i1 false' holds (which means it's never taken); but VPRecipeBuilder::createEdgeMask was emitting 'and i1 false, poison' instead.
The former one successfully blocks poison propagation whereas the latter one doesn't, making the condition poison and thus causing the miscompilation.

SimplifyCFG has a similar bug (which didn't expose a real-world bug yet), and a patch for this is also ongoing (see https://reviews.llvm.org/D95026).

Reviewed By: bjope

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

(cherry picked from commit ed253ef77248d91a15b3a1aa36c0b74bed8ec8af)

3 years ago[clang-tidy] Deprecate readability-deleted-default check
Nathan James [Wed, 3 Mar 2021 16:01:12 +0000 (16:01 +0000)]
[clang-tidy] Deprecate readability-deleted-default check

... For removal in next release cycle.
The clang warning that does the same thing is enabled by default and typically emits better diagnostics making this check surplus to requirements.

Reviewed By: aaron.ballman

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

(cherry picked from commit 19aefd2d5dc3a8d3b8e81219973828170b7fcd2c)

3 years ago[AArch64] Legalize horizontal fmax/fmin reductions on f16 vectors
LemonBoy [Fri, 5 Mar 2021 15:01:45 +0000 (16:01 +0100)]
[AArch64] Legalize horizontal fmax/fmin reductions on f16 vectors

Expand the horizontal reduction during the instruction selection phase, but only if the target doesn't support the full fp16 instruction set.

Fixes https://bugs.llvm.org/show_bug.cgi?id=49401

Reviewed By: aemerson

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

(cherry picked from commit 8725b24c6d4abaa97425e704652a13dacb35fe3f)

3 years ago[OpenMP] Fixed a crash when offloading to x86_64 with target nowait
Shilei Tian [Wed, 24 Feb 2021 17:37:22 +0000 (12:37 -0500)]
[OpenMP] Fixed a crash when offloading to x86_64 with target nowait

PR#49334 reports a crash when offloading to x86_64 with `target nowait`,
which is caused by referencing a nullptr. The root cause of the issue is, when
pushing a hidden helper task in `__kmp_push_task`, it also maps the gtid to its
shadow gtid, which is wrong.

Reviewed By: jdoerfert

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

(cherry picked from commit e5da63d5a9ede1fb6d8aa18cfd44533ead128738)

3 years ago[GlobalISel] Bail on G_PHI narrowing of odd types (PR48188)
Nikita Popov [Mon, 1 Mar 2021 20:37:26 +0000 (21:37 +0100)]
[GlobalISel] Bail on G_PHI narrowing of odd types (PR48188)

The current narrowing code for G_PHI can only handle the case
where the size is a multiple of the narrow size. If this is not
the case, fall back to SDAG instead of asserting.

Original patch by shepmaster.

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

(cherry picked from commit c35761db0f078f74550ef56bfc0745c162d76967)

3 years ago[OpenMP] Fix clang-cl build error regarding TSX intrinsics
Peyton, Jonathan L [Tue, 2 Mar 2021 13:44:15 +0000 (07:44 -0600)]
[OpenMP] Fix clang-cl build error regarding TSX intrinsics

Fix for https://bugs.llvm.org/show_bug.cgi?id=49339

The CMake check for the RTM intrinsics needs the -mrtm flag to be set
during the test. This way clang-cl correctly detects it has the
_xbegin() intrinsic. Otherwise, the CMake check fails.

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

(cherry picked from commit e83380fccc2cc9842bdcfd268efddf6fce90544d)

3 years ago[analyzer] Add 12.0.0 release notes
Kirstóf Umann [Fri, 5 Feb 2021 18:57:09 +0000 (19:57 +0100)]
[analyzer] Add 12.0.0 release notes

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

3 years ago[DAGCombiner][X86] Don't peek through ANDs on the shift amount in matchRotateSub...
Craig Topper [Sun, 28 Feb 2021 19:23:46 +0000 (11:23 -0800)]
[DAGCombiner][X86] Don't peek through ANDs on the shift amount in matchRotateSub when called from MatchFunnelPosNeg.

Peeking through AND is only valid if the input to both shifts is
the same. If the inputs are different, then the original pattern
ORs the two values when the masked shift amount is 0. This is ok
if the values are the same since the OR would be a NOP which is
why its ok for rotate.

Fixes PR49365 and reverts PR34641

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

(cherry picked from commit 5de09ef02e24d234d9fc0cd1c6dfe18a1bb784b0)

3 years agoRevert "[c++20] Mark class type NTTPs as done and start defining the feature test...
Richard Smith [Mon, 1 Mar 2021 20:17:10 +0000 (12:17 -0800)]
Revert "[c++20] Mark class type NTTPs as done and start defining the feature test macro."

Some of the parts of this work were reverted; stop defining the feature
test macro for now.

This reverts commit b4c63ef6dd90dba9af26a111c9a78b121c5284b1.

(cherry picked from commit 564f5b0734bd5d265a0046e5ca9d08ae5bc303eb)

3 years ago[SimplifyCFG] avoid illegal phi with both poison and undef
Sanjay Patel [Sat, 27 Feb 2021 14:09:03 +0000 (09:09 -0500)]
[SimplifyCFG] avoid illegal phi with both poison and undef

In the example based on:
https://llvm.org/PR49218
...we are crashing because poison is a subclass of undef, so we merge blocks and create:

PHI node has multiple entries for the same basic block with different incoming values!
  %k3 = phi i64 [ poison, %entry ], [ %k3, %g ], [ undef, %entry ]

If both poison and undef values are incoming, we soften the poison values to undef.

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

(cherry picked from commit 356cdabd3a9e0ff919ea2c1a35c8706ecb915297)

3 years ago[InstCombine] avoid infinite loop in demanded bits for select
Sanjay Patel [Sun, 28 Feb 2021 15:17:10 +0000 (10:17 -0500)]
[InstCombine] avoid infinite loop in demanded bits for select

https://llvm.org/PR49205
(cherry picked from commit 9502061bcc86982641772f45b7e7a0eb7437f054)

3 years ago[OpenMP][NVPTX] Fixed a compilation error in deviceRTLs caused by unsupported feature...
Shilei Tian [Tue, 23 Feb 2021 18:20:13 +0000 (13:20 -0500)]
[OpenMP][NVPTX] Fixed a compilation error in deviceRTLs caused by unsupported feature in release verion of LLVM

`ptx71` is not supported in release version of LLVM yet. As a result,
the support of CUDA 11.2 and CUDA 11.1 caused a compilation error as mentioned
in D97004. Since the support in D97004 is just a WA for releease, and we'll not
use it in the near future, using `ptx70` for CUDA 11 is feasible.

Reviewed By: jdoerfert

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

(cherry picked from commit f6c2984a090e78947f75e096d43b476bf2ae73eb)

3 years ago[AArch64][Docs] Release notes 12.x on outline atomics
Pavel Iliin [Thu, 25 Feb 2021 22:51:09 +0000 (22:51 +0000)]
[AArch64][Docs] Release notes 12.x on outline atomics

Description for AArch64 -moutline-atomics, -mno-outline-atomics
options added to release notes.

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

3 years agoReleaseNotes: add lld/ELF notes
Fangrui Song [Wed, 24 Feb 2021 17:19:23 +0000 (09:19 -0800)]
ReleaseNotes: add lld/ELF notes

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

3 years ago[libc++] Fix extern-templates.sh.cpp test on Linux
Louis Dionne [Thu, 28 Jan 2021 15:46:22 +0000 (10:46 -0500)]
[libc++] Fix extern-templates.sh.cpp test on Linux

(cherry picked from commit bf5941afcda3ac6570ba25165758869287491e0d)

3 years ago[libc++] Fix extern template test failing on Windows
Louis Dionne [Wed, 27 Jan 2021 18:08:24 +0000 (13:08 -0500)]
[libc++] Fix extern template test failing on Windows

See https://reviews.llvm.org/D94718#2521489 for details.

(cherry picked from commit 90407b16b1d3e38f1360b6a24ceab801ab9cefc1)

3 years agoFix test failures after a92ceea91116e7b95d23eff634507fa2cff86ef2
Nikita Popov [Tue, 23 Feb 2021 23:57:13 +0000 (15:57 -0800)]
Fix test failures after a92ceea91116e7b95d23eff634507fa2cff86ef2

3 years agoAdd auto-upgrade support for annotation intrinsics
Andy Kaylor [Thu, 4 Feb 2021 02:16:04 +0000 (18:16 -0800)]
Add auto-upgrade support for annotation intrinsics

The llvm.ptr.annotation and llvm.var.annotation intrinsics were changed
since the 11.0 release to add an additional parameter. This patch
auto-upgrades IR containing the four-parameter versions of these
intrinsics, adding a null pointer as the fifth argument.

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

(cherry picked from commit 9a827906cb95e7c3ae94627558da67b47ffde249)

3 years ago[12.0.0][llvm-symbolizer][test] Fix test broken after cherry-pick
Tom Stellard [Tue, 23 Feb 2021 19:12:50 +0000 (11:12 -0800)]
[12.0.0][llvm-symbolizer][test] Fix test broken after cherry-pick

See bug https://bugs.llvm.org/show_bug.cgi?id=49227. The cherry-pick 0d4f8a3f364f introduced a test failure, as the test included use of a feature that was only recently added to lit and isn't in the release branch. This patch fixes up the test to manage without this lit change.

Reviewed By: tstellar, MaskRay

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

3 years ago[clang][CodeComplete] Ensure there are no crashes when completing with ParenListExprs...
Kadir Cetinkaya [Thu, 18 Feb 2021 12:48:43 +0000 (13:48 +0100)]
[clang][CodeComplete] Ensure there are no crashes when completing with ParenListExprs as LHS

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

3 years ago[clang][CodeComplete] Fix crash on ParenListExprs
Kadir Cetinkaya [Wed, 3 Feb 2021 11:45:46 +0000 (12:45 +0100)]
[clang][CodeComplete] Fix crash on ParenListExprs

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

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

3 years agoRevert "[llvm-cov] reset executation count to 0 after wrapped segment"
Tom Stellard [Tue, 23 Feb 2021 01:35:09 +0000 (17:35 -0800)]
Revert "[llvm-cov] reset executation count to 0 after wrapped segment"

This reverts commit e3df9471750935876bd2bf7da93ccf0eacca8592.

This commit caused regressions in coverage generation for both Rust and
Swift.  We're reverting this in the release/12.x branch until we have
a proper fix in trunk.

http://llvm.org/PR49297

3 years ago[JumpThreading] Clone noalias.scope.decl when threading blocks
Nikita Popov [Sun, 21 Feb 2021 15:24:18 +0000 (16:24 +0100)]
[JumpThreading] Clone noalias.scope.decl when threading blocks

When cloning instructions during jump threading, also clone and
adapt any declared scopes. This is primarily important when
threading loop exits, because we'll end up with two dominating
scope declarations in that case (at least after additional loop
rotation). This addresses a loose thread from
https://reviews.llvm.org/rG2556b413a7b8#975012.

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

(cherry picked from commit 5e7e499b912d2c9ebaa91b5783ca123dbedeabcc)

3 years agoclang-tidy: Disable cppcoreguidlines-prefer-member-initializer check
Tom Stellard [Tue, 23 Feb 2021 00:27:19 +0000 (16:27 -0800)]
clang-tidy: Disable cppcoreguidlines-prefer-member-initializer check

Fixes https://llvm.org/PR49318

3 years ago[clangd] Release notes for 12.x
Sam McCall [Mon, 22 Feb 2021 21:05:26 +0000 (22:05 +0100)]
[clangd] Release notes for 12.x

3 years ago[clangd] Fix windows buildbots after ecea7218fb9b994b26471e9877851cdb51a5f1d4
Kadir Cetinkaya [Tue, 16 Feb 2021 19:57:00 +0000 (20:57 +0100)]
[clangd] Fix windows buildbots after ecea7218fb9b994b26471e9877851cdb51a5f1d4

(cherry picked from commit cdef5a7161767c2c4b3b7cb2542cf1d29b6d4a09)

3 years ago[clangd] Treat paths case-insensitively depending on the platform
Kadir Cetinkaya [Mon, 15 Feb 2021 08:00:49 +0000 (09:00 +0100)]
[clangd] Treat paths case-insensitively depending on the platform

Path{Match,Exclude} and MountPoint were checking paths case-sensitively
on all platforms, as with other features, this was causing problems on
windows. Since users can have capital drive letters on config files, but
editors might lower-case them.

This patch addresses that issue by:
- Creating regexes with case-insensitive matching on those platforms.
- Introducing a new pathIsAncestor helper, which performs checks in a
  case-correct manner where needed.

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

(cherry picked from commit ecea7218fb9b994b26471e9877851cdb51a5f1d4)

3 years ago[clangd] Rename: merge index/AST refs path-insensitively where needed
Sam McCall [Sun, 31 Jan 2021 12:53:22 +0000 (13:53 +0100)]
[clangd] Rename: merge index/AST refs path-insensitively where needed

If you have c:\foo open, and C:\foo indexed (case difference) then these
need to be considered the same file. Otherwise we emit edits to both,
and editors do... something that isn't pretty.

Maybe more centralized normalization is called for, but it's not trivial
to do this while also being case-preserving. see
https://github.com/clangd/clangd/issues/108

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

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

(cherry picked from commit b63cd4db915c08e0cb4cf668a18de24b67f2c44c)

3 years agoclang-extra: fix incorrect use of std::lock_guard by adding variable name (identified...
Conrad Poelman [Tue, 2 Feb 2021 04:59:38 +0000 (05:59 +0100)]
clang-extra: fix incorrect use of std::lock_guard by adding variable name (identified by MSVC [[nodiscard]] error)

`std::lock_guard` is an RAII class that needs a variable name whose scope determines the guard's lifetime. This particular usage lacked a variable name, meaning the guard could be destroyed before the line that it was indented to protect.

This line was identified by building clang with the latest MSVC preview release, which declares the std::lock_guard constructor to be `[[nodiscard]]` to draw attention to such issues.

Reviewed By: kadircet

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

(cherry picked from commit 0b70c86e2007d3f32968f0a7d9efe8eab3bf0f0a)

3 years ago[clang][Driver][OpenBSD] libcxx also requires pthread
Brad Smith [Sun, 21 Feb 2021 01:43:16 +0000 (20:43 -0500)]
[clang][Driver][OpenBSD] libcxx also requires pthread

(cherry picked from commit b42d57a100c5df6ace68f686f5adaabeafe8a0f6)

3 years ago[Analysis][LoopVectorize] do not form reductions of pointers
Sanjay Patel [Fri, 19 Feb 2021 14:06:05 +0000 (09:06 -0500)]
[Analysis][LoopVectorize] do not form reductions of pointers

This is a fix for https://llvm.org/PR49215 either before/after
we make a verifier enhancement for vector reductions with D96904.

I'm not sure what the current thinking is for pointer math/logic
in IR. We allow icmp on pointer values. Therefore, we match min/max
patterns, so without this patch, the vectorizer could form a vector
reduction from that sequence.

But the LangRef definitions for min/max and vector reduction
intrinsics do not allow pointer types:
https://llvm.org/docs/LangRef.html#llvm-smax-intrinsic
https://llvm.org/docs/LangRef.html#llvm-vector-reduce-umax-intrinsic

So we would crash/assert at some point - either in IR verification,
in the cost model, or in codegen. If we do want to allow this kind
of transform, we will need to update the LangRef and all of those
parts of the compiler.

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

(cherry picked from commit 5b250a27ec7822aa0a32abb696cb16c2cc60149c)

3 years agoAvoid use of stack allocations in asynchronous calls
Johannes Doerfert [Sun, 14 Feb 2021 18:25:56 +0000 (12:25 -0600)]
Avoid use of stack allocations in asynchronous calls

NOTE: This is an adaption of the original patch to be applicable to the
      LLVM 12 release branch. Logic is the same though.

As reported by Guilherme Valarini [0], we used to pass stack allocations
to calls that can nowadays be asynchronous. This is arguably a problem
and it will inevitably result in UB. To remedy the situation we allocate
the locations as part of the AsyncInfoTy object. The lifetime of that
object matches what we need for now. If the synchronization is not tied
to the AsyncInfoTy object anymore we might need to have a different
buffer construct in global space.

This should be back-ported to LLVM 12 but needs slight modifications as
it is based on refactoring patches we do not need to backport.

[0] https://lists.llvm.org/pipermail/openmp-dev/2021-February/003867.html

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