OSDN Git Service

android-x86/external-llvm-project.git
2 years agoDO NOT MERGE: android: translate soong build rules for libLLVM12 pie-x86 q-x86 r-x86
Mauro Rossi [Tue, 25 May 2021 21:11:10 +0000 (23:11 +0200)]
DO NOT MERGE: android: translate soong build rules for libLLVM12

Changes to side build external/llvm-project project (llvm 12 version)
and avoid conflicts with external/llvm project targets and variables
Changes in mesa main Android.mk are required for libLLVM12
shared library dependency and cflag -DMESA_LLVM_VERSION_STRING=\"12.0\"

The changelog is described by means of modules and variables
which needed to be renamed in external/llvm-project/llvm/ path:

 #rename the target shared library and all static libraries
find . -type f -name "*.bp" -exec sed -i 's/libLLVM/libLLVM12/g' {} +

 #rename the boostrap and contextual build paths
find . -type f -name "*.bp" -exec sed -i 's/soong\-llvm/\soong-llvm12/g' {} +
find . -type f -name "*.go" -exec sed -i 's/android\/soong\/llvm/android\/soong\/llvm12/g' {} +

 #rename force_build_llvm_components type and module name
find . -type f -name '*.bp' -exec sed -i 's/force_build_llvm_components/force_build_llvm12_components/g' {} +
find . -type f -name '*.go' -exec sed -i 's/force_build_llvm_components/force_build_llvm12_components/g' {} +

 #rename all module that gave 'already defined' error
find . -type f -name '*.bp' -exec sed -i 's/llvm-aarch64-defaults/llvm12-aarch64-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-aarch64-headers/llvm12-aarch64-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-amdgpu-defaults/llvm12-amdgpu-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-amdgpu-headers/llvm12-amdgpu-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-arm-defaults/llvm12-arm-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-arm-headers/llvm12-arm-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-defaults/llvm12-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-defaults-no-generated-headers/llvm12-defaults-no-generated-headers/g' {} +
 #note the following line replaced all llvm-gen-* entries of the previous versions
find . -type f -name '*.bp' -exec sed -i 's/llvm-gen-/llvm12-gen-/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-headers/llvm12-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-headers-no-generated-headers/llvm12-headers-no-generated-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-lib-defaults/llvm12-lib-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-mips-defaults/llvm12-mips-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-mips-headers/llvm12-mips-headers/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-tblgen/llvm12-tblgen/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-x86-defaults/llvm12-x86-defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm-x86-headers/llvm12-x86-headers/g' {} +

 #rename llvm-gen-instcombine module
find . -type f -name '*.bp' -exec sed -i 's/llvm-gen-instcombine/llvm12-gen-instcombine/g' {} +

 #rename the binaries
find . -type f -name '*.bp' -exec sed -i 's/LLVMHello/LLVM12Hello/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/LLVMgold/LLVM12gold/g' {} +

 #rename the TableGen binary module and variable in different files
find . -type f -name '*.go' -exec sed -i 's/LLVM TableGen/LLVM12 TableGen/g' {} +
find . -type f -name '*.go' -exec sed -i 's/llvm-tblgen/llvm12-tblgen/g' {} +
find . -type f -name '*.go' -exec sed -i 's/llvmTblgen/llvm12Tblgen/g' {} +
find . -type f -name '*.go' -exec sed -i 's/tblgenRule/tblgenRule12/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/llvm_tblgen/llvm12_tblgen/g' {} +
find . -type f -name '*.go' -exec sed -i 's/llvm_tblgen/llvm12_tblgen/g' {} +
find . -type f -name 'tdtags' -exec sed -i 's/llvm-tblgen/llvm12-tblgen/g' {} +

 #COMMENTED AS NOT NEEDED in external/llvm-project (was: rename the include paths)
 #find . -type f -name '*.bp' -exec sed -i 's/external\/llvm/external\/llvm12/g' {} +
 #find . -type f -name '*.go' -exec sed -i 's/external\/llvm/external\/llvm12/g' {} +

 #rename package, registered types and llvm-config
find . -type f -name '*.go' -exec sed -i 's/package llvm/package llvm12/g' {} +
find . -type f -name '*.go' -exec sed -i 's/llvm_tblgen/llvm12_tblgen/g' {} +
find . -type f -name '*.go' -exec sed -i 's/llvm_defaults/llvm12_defaults/g' {} +
find . -type f -name '*.bp' -exec sed -i 's/ llvm-config / llvm12-config /g' {} +
find . -type f -name '*.bp' -exec sed -i 's/"llvm-config"/"llvm12-config"/g' {} +
find . -type f -name '*.go' -exec sed -i 's/"llvm-config"/"llvm12-config"/g' {} +

2 years agoandroid: fix build errors in Android S
Michael Goffioul [Wed, 28 Apr 2021 20:16:47 +0000 (16:16 -0400)]
android: fix build errors in Android S

Changelog:
- android_mips/android_mips64 variants do no exist anymore
- use -Wno-error=unreachable-code-loop-increment, required to compile
  llvm/lib/Target/AMDGPU/SIFormMemoryClauses.cpp

2 years agoandroid: VNDK support for libLLVM and llvm-amdgpu-headers
Mauro Rossi [Sun, 23 May 2021 09:48:12 +0000 (05:48 -0400)]
android: VNDK support for libLLVM and llvm-amdgpu-headers

As required for VNDK support
https://source.android.com/devices/architecture/vndk/enabling

3 years agoandroid: [ORC] Break up OrcJIT library, add Orc-RPC based remote TargetProcessControl
Mauro Rossi [Sat, 30 Jan 2021 21:35:27 +0000 (22:35 +0100)]
android: [ORC] Break up OrcJIT library, add Orc-RPC based remote TargetProcessControl

Porting of commit
1d0676b54c4e ("[ORC] Break up OrcJIT library, add Orc-RPC based remote TargetProcessControl")

Fixes the following building errors:

ld.lld: error: undefined symbol: llvm::orc::runAsMain(int (*)(int, char**), llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, llvm::Optional<llvm::StringRef>)
>>> referenced by TargetProcessControl.cpp:102 (external/llvm-project/llvm/lib/ExecutionEngine/Orc/TargetProcessControl.cpp:102)
>>>               TargetProcessControl.o:(llvm::orc::SelfTargetProcessControl::runAsMain(unsigned long, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/ExecutionEngine/Orc/libLLVM12OrcJIT/android_x86_64_core_static/libLLVM12OrcJIT.a

ld.lld: error: undefined symbol: llvm::orc::registerEHFrameSection(void const*, unsigned long)
>>> referenced by EHFrameSupport.cpp:737 (external/llvm-project/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp:737)
>>>               EHFrameSupport.o:(llvm::jitlink::InProcessEHFrameRegistrar::registerEHFrames(unsigned long, unsigned long)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/ExecutionEngine/JITLink/libLLVM12JITLink/android_x86_64_core_static/libLLVM12JITLink.a

ld.lld: error: undefined symbol: llvm::orc::deregisterEHFrameSection(void const*, unsigned long)
>>> referenced by EHFrameSupport.cpp:744 (external/llvm-project/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp:744)
>>>               EHFrameSupport.o:(llvm::jitlink::InProcessEHFrameRegistrar::deregisterEHFrames(unsigned long, unsigned long)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/ExecutionEngine/JITLink/libLLVM12JITLink/android_x86_64_core_static/libLLVM12JITLink.a

3 years agoandroid: [ORC] Move OrcError.h to include/llvm/ExecutionEngine/Orc/Shared.
Mauro Rossi [Sat, 30 Jan 2021 21:32:41 +0000 (22:32 +0100)]
android: [ORC] Move OrcError.h to include/llvm/ExecutionEngine/Orc/Shared.

Porting of commit
24672ddea3c9 ("[ORC] Move OrcError.h to include/llvm/ExecutionEngine/Orc/Shared.")

Fixes the following building errors:

ld.lld: error: undefined symbol: llvm::orc::orcError(llvm::orc::OrcErrorCode)
>>> referenced by Core.cpp:70 (external/llvm-project/llvm/lib/ExecutionEngine/Orc/Core.cpp:70)
>>>               Core.o:(llvm::orc::ResourceTrackerDefunct::convertToErrorCode() const) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/ExecutionEngine/Orc/libLLVM12OrcJIT/android_x86_64_core_static/libLLVM12OrcJIT.a
...
ld.lld: error: undefined symbol: llvm::orc::DuplicateDefinition::DuplicateDefinition(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)
>>> referenced by memory:3132 (external/libcxx/include/memory:3132)
>>>               Core.o:(llvm::orc::JITDylib::defineMaterializing(llvm::DenseMap<llvm::orc::SymbolStringPtr, llvm::JITSymbolFlags, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr>, llvm::detail::DenseMapPair<llvm::orc::SymbolStringPtr, llvm::JITSymbolFlags> >)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/ExecutionEngine/Orc/libLLVM12OrcJIT/android_x86_64_core_static/libLLVM12OrcJIT.a

3 years agoandroid: [docs][NewPM] Add docs for writing NPM passes
Mauro Rossi [Sat, 30 Jan 2021 21:23:35 +0000 (22:23 +0100)]
android: [docs][NewPM] Add docs for writing NPM passes

Porting of commit
c2590de30df2 ("[docs][NewPM] Add docs for writing NPM passes")

Fixes the following building error:

ld.lld: error: undefined symbol: llvm::HelloWorldPass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)
>>> referenced by PassManagerInternal.h:85 (external/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:85)
>>>               PassBuilder.o:(llvm::detail::PassModel<llvm::Function, llvm::HelloWorldPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Function> >::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/Passes/libLLVM12Passes/android_x86_64_core_static/libLLVM12Passes.a

3 years agoandroid: [LiveDebugValues][NFC] Move LiveDebugValues source for refactor
Mauro Rossi [Sat, 30 Jan 2021 20:57:39 +0000 (21:57 +0100)]
android: [LiveDebugValues][NFC] Move LiveDebugValues source for refactor

Fixes the following building errors:

ld.lld: error: undefined symbol: llvm::initializeLiveDebugValuesPass(llvm::PassRegistry&)
>>> referenced by CodeGen.cpp:53 (external/llvm-project/llvm/lib/CodeGen/CodeGen.cpp:53)
>>>               CodeGen.o:(llvm::initializeCodeGen(llvm::PassRegistry&)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/CodeGen/libLLVM12CodeGen/android_x86_64_core_static/libLLVM12CodeGen.a

ld.lld: error: undefined symbol: llvm::LiveDebugValuesID
>>> referenced by TargetPassConfig.cpp:1177 (external/llvm-project/llvm/lib/CodeGen/TargetPassConfig.cpp:1177)
>>>               TargetPassConfig.o:(llvm::TargetPassConfig::addMachinePasses()) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/CodeGen/libLLVM12CodeGen/android_x86_64_core_static/libLLVM12CodeGen.a

3 years agoandroid: [NFC] Move ImportedFunctionsInliningStatistics to Analysis
Mauro Rossi [Sat, 30 Jan 2021 18:43:33 +0000 (19:43 +0100)]
android: [NFC] Move ImportedFunctionsInliningStatistics to Analysis

Porting of commit
95ce32c7878d ("[NFC] Move ImportedFunctionsInliningStatistics to Analysis")

Fixes the following building error:

ld.lld: error: undefined symbol: llvm::ImportedFunctionsInliningStatistics::dump(bool)
>>> referenced by Inliner.cpp:553 (external/llvm-project/llvm/lib/Transforms/IPO/Inliner.cpp:553)
>>>               Inliner.o:(llvm::LegacyInlinerBase::doFinalization(llvm::CallGraph&)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/Transforms/IPO/libLLVM12ipo/android_x86_x86_64_core_static/libLLVM12ipo.a

3 years agoandroid: [IRSim] Adding IR Instruction Mapper
Mauro Rossi [Sat, 30 Jan 2021 18:11:49 +0000 (19:11 +0100)]
android: [IRSim] Adding IR Instruction Mapper

Porting of commit
7e4c6fb85466 ("[IRSim] Adding IR Instruction Mapper")

Fixes the following building errors:

ld.lld: error: undefined symbol: llvm::IRSimilarityIdentifierWrapperPass::ID
>>> referenced by STLExtras.h:184 (external/llvm-project/llvm/include/llvm/ADT/STLExtras.h:184)
>>>               IROutliner.o:(llvm::IRSimilarity::IRSimilarityIdentifier& llvm::function_ref<llvm::IRSimilarity::IRSimilarityIdentifier& (llvm::Module&)>::callback_fn<IROutlinerLegacyPass::runOnModule(llvm::Module&)::$_7>(int, llvm::Module&)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/Transforms/IPO/libLLVM12ipo/android_x86_x86_64_core_static/libLLVM12ipo.a

ld.lld: error: undefined symbol: llvm::IRSimilarityAnalysis::Key
>>> referenced by PassManager.h:789 (external/llvm-project/llvm/include/llvm/IR/PassManager.h:789)
>>>               IROutliner.o:(std::__1::__function::__func<llvm::IROutlinerPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&)::$_10, std::__1::allocator<llvm::IROutlinerPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&)::$_10>, llvm::IRSimilarity::IRSimilarityIdentifier& (llvm::Module&)>::operator()(llvm::Module&)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/Transforms/IPO/libLLVM12ipo/android_x86_x86_64_core_static/libLLVM12ipo.a

3 years agoandroid: [InlineAdvisor] New inliner advisor to replay inlining
Mauro Rossi [Sat, 30 Jan 2021 18:09:05 +0000 (19:09 +0100)]
android: [InlineAdvisor] New inliner advisor to replay inlining

Porting of commit
577e58bcc754 ("[InlineAdvisor] New inliner advisor to replay inlining from optimization remarks")

Fixes the following building errors:

ld.lld: error: undefined symbol: llvm::ReplayInlineAdvisor::ReplayInlineAdvisor(llvm::Module&, llvm::AnalysisManager<llvm::Function>&, llvm::LLVMContext&, std::__1::unique_ptr<llvm::InlineAdvisor, std::__1::default_delete<llvm::InlineAdvisor> >, llvm::StringRef, bool)
>>> referenced by memory:3132 (external/libcxx/include/memory:3132)
>>>               Inliner.o:(llvm::InlinerPass::getAdvisor(llvm::OuterAnalysisManagerProxy<llvm::AnalysisManager<llvm::Module>, llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>::Result const&, llvm::AnalysisManager<llvm::Function>&, llvm::Module&)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/Transforms/IPO/libLLVM12ipo/android_x86_x86_64_core_static/libLLVM12ipo.a

ld.lld: error: undefined symbol: llvm::ReplayInlineAdvisor::ReplayInlineAdvisor(llvm::Module&, llvm::AnalysisManager<llvm::Function>&, llvm::LLVMContext&, std::__1::unique_ptr<llvm::InlineAdvisor, std::__1::default_delete<llvm::InlineAdvisor> >, llvm::StringRef, bool)
>>> referenced by memory:3132 (external/libcxx/include/memory:3132)
>>>               SampleProfile.o:((anonymous namespace)::SampleProfileLoader::doInitialization(llvm::Module&, llvm::AnalysisManager<llvm::Function>*)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/Transforms/IPO/libLLVM12ipo/android_x86_x86_64_core_static/libLLVM12ipo.a

3 years agoandroid: [Analysis] build DDGPrinter.cpp source
Mauro Rossi [Sat, 30 Jan 2021 20:49:52 +0000 (21:49 +0100)]
android: [Analysis] build DDGPrinter.cpp source

Fixes the following building error:

ld.lld: error: undefined symbol: llvm::DDGDotPrinterPass::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&)
>>> referenced by PassManagerInternal.h:85 (external/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:85)
>>>               PassBuilder.o:(llvm::detail::PassModel<llvm::Loop, llvm::DDGDotPrinterPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/Passes/libLLVM12Passes/android_x86_64_core_static/libLLVM12Passes.a

3 years agoandroid: [Analysis] build ConstraintSystem.cpp source
Mauro Rossi [Sat, 30 Jan 2021 20:48:40 +0000 (21:48 +0100)]
android: [Analysis] build ConstraintSystem.cpp source

Fixes the following building errors:

ld.lld: error: undefined symbol: llvm::ConstraintSystem::isConditionImplied(llvm::SmallVector<long, 8u>)
>>> referenced by ConstraintElimination.cpp:305 (external/llvm-project/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp:305)
>>>               ConstraintElimination.o:(eliminateConstraints(llvm::Function&, llvm::DominatorTree&)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/Transforms/Scalar/libLLVM12ScalarOpts/android_x86_64_core_static/libLLVM12ScalarOpts.a

ld.lld: error: undefined symbol: llvm::ConstraintSystem::isConditionImplied(llvm::SmallVector<long, 8u>)
>>> referenced by ConstraintElimination.cpp:320 (external/llvm-project/llvm/lib/Transforms/Scalar/ConstraintElimination.cpp:320)
>>>               ConstraintElimination.o:(eliminateConstraints(llvm::Function&, llvm::DominatorTree&)) in archive out/soong/.intermediates/external/llvm-project/llvm/lib/Transforms/Scalar/libLLVM12ScalarOpts/android_x86_64_core_static/libLLVM12ScalarOpts.a

3 years agoandroid: [Analysis] build ReleaseModeModelRunner.cpp source
Mauro Rossi [Sat, 30 Jan 2021 18:07:22 +0000 (19:07 +0100)]
android: [Analysis] build ReleaseModeModelRunner.cpp source

3 years agoandroid: [NewPM] Move ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER into llvm/
Mauro Rossi [Sat, 30 Jan 2021 13:57:50 +0000 (14:57 +0100)]
android: [NewPM] Move ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER into llvm/

Porting of commit
a36bd4c90dcc ("[CMake][NewPM] Move ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER into llvm/")

Fixes the following building error:

In file included from external/llvm-project/llvm/lib/LTO/LTOBackend.cpp:16:
In file included from external/llvm-project/llvm/include/llvm/LTO/LTOBackend.h:22:
In file included from external/llvm-project/llvm/include/llvm/LTO/LTO.h:22:
external/llvm-project/llvm/include/llvm/LTO/Config.h:57:19: error: use of undeclared identifier 'LLVM_ENABLE_NEW_PASS_MANAGER'
  bool UseNewPM = LLVM_ENABLE_NEW_PASS_MANAGER;
                  ^
1 error generated.

3 years agoandroid: [VE] Support vld intrinsics
Mauro Rossi [Sat, 30 Jan 2021 13:39:23 +0000 (14:39 +0100)]
android: [VE] Support vld intrinsics

Porting of commit
410626c9b56a ("[VE] Support vld intrinsics")

Fixes the following building error:

external/llvm-project/llvm/lib/IR/Function.cpp:46:10: fatal error: 'llvm/IR/IntrinsicsVE.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

3 years agoandroid: [AArch64][GlobalISel] Split post-legalizer combiner
Mauro Rossi [Sat, 30 Jan 2021 10:25:11 +0000 (11:25 +0100)]
android: [AArch64][GlobalISel] Split post-legalizer combiner

Porting of commit
147b9497e79a ("[AArch64][GlobalISel] Split post-legalizer combiner to allow for lowering at -O0")

Fixes the following building error:

external/llvm-project/llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp:614:10: fatal error: 'AArch64GenPostLegalizeGILowering.inc' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

3 years agoandroid: Fix out-of-tree clang build due to sysexits change
Mauro Rossi [Sat, 30 Jan 2021 10:23:14 +0000 (11:23 +0100)]
android: Fix out-of-tree clang build due to sysexits change

Porting of commit
5e4409f30817 ("Fix out-of-tree clang build due to sysexits change")

Fixes the following building errors:

In file included from external/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:12:
external/llvm-project/llvm/include/llvm/Support/ExitCodes.h:30:2: error: Exit code EX_IOERR not available
 ^
external/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:385:15: error: use of undeclared identifier 'EX_IOERR'
    RetCode = EX_IOERR;
              ^
2 errors generated.

3 years agoandroid: Rename InlineFeatureAnalysis to FunctionPropertiesAnalysis
Mauro Rossi [Fri, 29 Jan 2021 22:18:47 +0000 (23:18 +0100)]
android: Rename InlineFeatureAnalysis to FunctionPropertiesAnalysis

Porting of commit
44a6bda19b40 ("Rename InlineFeatureAnalysis to FunctionPropertiesAnalysis")

Fixes the following building error:

module source path "external/llvm-project/llvm/lib/Analysis/InlineFeaturesAnalysis.cpp" does not exist

3 years agoandroid: [InstCombine] Move target-specific inst combining
Mauro Rossi [Fri, 29 Jan 2021 22:12:57 +0000 (23:12 +0100)]
android: [InstCombine] Move target-specific inst combining

Porting of commit
2a6c871596ce ("[InstCombine] Move target-specific inst combining")

Fixes the following building error:

module source path "external/llvm-project/llvm/lib/Transforms/InstCombine/InstCombineTables.td" does not exist

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 12.0.0

3 years agoandroid: add support for libLLVMFrontendOpenMP
Mauro Rossi [Sat, 25 Jul 2020 12:03:41 +0000 (14:03 +0200)]
android: add support for libLLVMFrontendOpenMP

Fixes the following building errors:

FAILED: out/soong/.intermediates/external/llvm-project/llvm/libLLVM10/android_x86_64_core_shared/unstripped/libLLVM10.so
ld.lld: error: undefined symbol: llvm::OpenMPIRBuilder::initialize()
...
ld.lld: error: undefined symbol: llvm::OpenMPIRBuilder::addAttributes(llvm::omp::RuntimeFunction, llvm::Function&)
...
ld.lld: error: undefined symbol: llvm::OpenMPIRBuilder::getOrCreateDefaultSrcLocStr()
...
ld.lld: error: undefined symbol: llvm::OpenMPIRBuilder::getOrCreateIdent(llvm::Constant*, llvm::omp::IdentFlag)
...
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: AMDGPU/GlobalISel: Add stub reg-bank aware combiner pass
Mauro Rossi [Fri, 24 Jul 2020 23:23:08 +0000 (01:23 +0200)]
android: AMDGPU/GlobalISel: Add stub reg-bank aware combiner pass

Port to Android.bp of commit
a8ca0ec2670 ("AMDGPU/GlobalISel: Add stub reg-bank aware combiner pass")

android: [InstCombine] Move target-specific inst combining

Port to Android.bp of commit
2a6c871596c ("[InstCombine] Move target-specific inst combining")

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: AMDGPU/GlobalISel: Introduce post-legalize combiner
Mauro Rossi [Fri, 24 Jul 2020 23:02:49 +0000 (01:02 +0200)]
android: AMDGPU/GlobalISel: Introduce post-legalize combiner

android: AMDGPU/GlobalISel: Introduce post-legalize combiner

Port to Android.bp of commit
fee41517fe0 ("AMDGPU/GlobalISel: Introduce post-legalize combiner")

Fixes the following build error:

external/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp:229:10:
fatal error: 'AMDGPUGenPostLegalizeGICombiner.inc' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: AMDGPU/GlobalISel: Add pre-legalize combiner pass
Mauro Rossi [Fri, 24 Jul 2020 22:23:10 +0000 (00:23 +0200)]
android: AMDGPU/GlobalISel: Add pre-legalize combiner pass

Port to Android.bp of commit
a174f0da62f ("AMDGPU/GlobalISel: Add pre-legalize combiner pass")

Fixes the following build error:

external/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUPreLegalizerCombiner.cpp:32:10:
fatal error: 'AMDGPUGenPreLegalizeGICombiner.inc' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: [AArch64][GlobalISel] Move GlobalISel source files to a dedicated subdir.
Mauro Rossi [Sat, 25 Jul 2020 11:57:22 +0000 (13:57 +0200)]
android: [AArch64][GlobalISel] Move GlobalISel source files to a dedicated subdir.

Port to Android.bp of commit
e53f5580578 ("[AArch64][GlobalISel] Move GlobalISel source files to a dedicated subdir.")

Fixes the following building errors:

FAILED: out/soong/.intermediates/external/llvm-project/llvm/libLLVM10/android_x86_64_core_shared/unstripped/libLLVM10.so
ld.lld: error: undefined symbol: llvm::AArch64CallLowering::AArch64CallLowering(llvm::AArch64TargetLowering const&)
...
ld.lld: error: undefined symbol: llvm::AArch64LegalizerInfo::AArch64LegalizerInfo(llvm::AArch64Subtarget const&)
...
ld.lld: error: undefined symbol: llvm::AArch64RegisterBankInfo::AArch64RegisterBankInfo(llvm::TargetRegisterInfo const&)
...
ld.lld: error: undefined symbol: llvm::createAArch64InstructionSelector(llvm::AArch64TargetMachine const&, llvm::AArch64Subtarget&, llvm::AArch64RegisterBankInfo&)
...
ld.lld: error: undefined symbol: llvm::initializeAArch64PreLegalizerCombinerPass(llvm::PassRegistry&)
...
ld.lld: error: undefined symbol: llvm::initializeAArch64PostLegalizerCombinerPass(llvm::PassRegistry&)
...
ld.lld: error: undefined symbol: llvm::createAArch64PreLegalizeCombiner(bool)
...
ld.lld: error: undefined symbol: llvm::createAArch64PostLegalizeCombiner(bool)
...
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: [AArch64][GlobalISel] Add a post-legalizer combiner with a very simple combine.
Mauro Rossi [Fri, 24 Jul 2020 22:20:20 +0000 (00:20 +0200)]
android: [AArch64][GlobalISel] Add a post-legalizer combiner with a very simple combine.

Port to Android.bp of commit 49a4f3f7d88f61a81279de3d4e1c734ab0363228
"[AArch64][GlobalISel] Add a post-legalizer combiner with a very simple combine."

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: [openmp] add support for tablegen generated sources
Mauro Rossi [Fri, 24 Jul 2020 19:37:07 +0000 (21:37 +0200)]
android: [openmp] add support for tablegen generated sources

Porting to Android.bp of the following commits:

d90443b1d93 "[openmp] Base of tablegen generated OpenMP common declaration"
1a70077b5a6 "[openmp] Move Directive and Clause helper function to tablegen"
943660fd15f "[openmp] Remove OMPConstants.cpp and replace it by OMP.cpp generated by tablegen"

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: add genrule "llvm-gen-extension" for llvm/Support/Extension.def
Mauro Rossi [Fri, 24 Jul 2020 00:30:35 +0000 (02:30 +0200)]
android: add genrule "llvm-gen-extension" for llvm/Support/Extension.def

Based on llvm/utils/gn/secondary/llvm/include/llvm/Support/BUILD.gn rules

Fixes the following building error:

external/llvm-project/llvm/lib/LTO/LTOBackend.cpp:134:10:
fatal error: 'llvm/Support/Extension.def' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: lib/Analysis: add explicit list of sources
Mauro Rossi [Thu, 23 Jul 2020 23:28:05 +0000 (01:28 +0200)]
android: lib/Analysis: add explicit list of sources

After commit bdceefe95ba ("[llvm] Release-mode ML InlineAdvisor")
some sources are built conditionally based on LLVM_HAVE_TF_AOT

To make it simple the explict list of source is expanded
and Release-mode ML InlineAdvisor is kept disable (i.e. not built)
to avoid the following building error:

external/llvm-project/llvm/lib/Analysis/ReleaseModeModelRunner.cpp:18:10:
fatal error: 'InlinerSizeModel.h' file not found
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: [NFC] Refactor TableGen for attributes
Mauro Rossi [Thu, 23 Jul 2020 22:18:48 +0000 (00:18 +0200)]
android: [NFC] Refactor TableGen for attributes

Changes due to commit cfe87a4a16b ("[NFC] Refactor TableGen for attributes")

Fixes the following buiding error:

error: external/llvm-project/llvm/lib/IR/Android.bp:10:1: module "llvm-gen-core":
module source path "external/llvm-project/llvm/lib/IR/AttributesCompatFunc.td" does not exist

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 11.0.0

3 years agoandroid: AMDGPU/GlobalISel: fix tablegen rules
Mauro Rossi [Fri, 24 Jul 2020 23:06:37 +0000 (01:06 +0200)]
android: AMDGPU/GlobalISel: fix tablegen rules

AMDGPU/GlobalISel requires separated "llvm-gen-amdgpuisel" llvm_tblgen rules
and the file "AMDGPUGISel.td" is used to generate "AMDGPUGenGlobalISel.inc"

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
3 years agoandroid: llvm/soong: update pkgPath
Mauro Rossi [Fri, 13 Mar 2020 20:00:52 +0000 (21:00 +0100)]
android: llvm/soong: update pkgPath

With llvm-project monorepo 'external/llvm-project/llvm' replaces 'external/llvm'
pkgPath is updated to "android/soong/external/llvm-project/llvm"

3 years agoandroid: add support for libLLVMOrcError
Mauro Rossi [Fri, 21 Feb 2020 23:52:42 +0000 (00:52 +0100)]
android: add support for libLLVMOrcError

Fixes the following building errors:

ld.lld: error: undefined symbol: llvm::orc::orcError(llvm::orc::OrcErrorCode)
...
ld.lld: error: undefined symbol: llvm::orc::DuplicateDefinition::DuplicateDefinition(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)

3 years agoandroid: add support for libLLVMCFGuard
Mauro Rossi [Fri, 21 Feb 2020 23:50:29 +0000 (00:50 +0100)]
android: add support for libLLVMCFGuard

Fixes the following building error:

ld.lld: error: undefined symbol: llvm::createCFGuardDispatchPass()

3 years agoandroid: [IR] Split out target specific intrinsic enums into separate headers
Mauro Rossi [Fri, 21 Feb 2020 23:46:54 +0000 (00:46 +0100)]
android: [IR] Split out target specific intrinsic enums into separate headers

Changes due to commit 5d986953c8b9
("[IR] Split out target specific intrinsic enums into separate headers")

3 years agoandroid: [TableGen] Remove unused target intrinsic generation logic
Mauro Rossi [Wed, 21 Feb 2018 17:53:12 +0000 (19:53 +0200)]
android: [TableGen] Remove unused target intrinsic generation logic

Changes due to commit 72c68f1352ba
("[TableGen] Remove unused target intrinsic generation logic")

3 years agoandroid: llvm/tblgen: update include paths for llvm-project
Mauro Rossi [Wed, 21 Feb 2018 17:50:12 +0000 (19:50 +0200)]
android: llvm/tblgen: update include paths for llvm-project

With llvm-project monorepo 'external/llvm-project/llvm' replaces 'external/llvm'

3 years agoandroid: add Android.bp for llvm-project
Mauro Rossi [Fri, 21 Feb 2020 23:37:30 +0000 (00:37 +0100)]
android: add Android.bp for llvm-project

A root Android.bp file is needed to build llvm sub-project

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

Fixes the following building errors:

external/llvm/include/llvm/TextAPI/MachO/Symbol.h:66: error: undefined reference to
'llvm::MachO::mapToArchitectureSet(llvm::ArrayRef<llvm::MachO::Target>)'
external/llvm/include/llvm/TextAPI/MachO/InterfaceFile.h:191: error: undefined reference to
'llvm::MachO::mapToPlatformSet(llvm::ArrayRef<llvm::MachO::Target>)'
external/llvm/lib/Object/TapiUniversal.cpp:25: error: undefined reference to
'llvm::MachO::TextAPIReader::get(llvm::MemoryBufferRef)'
external/llvm/include/llvm/TextAPI/MachO/InterfaceFile.h:185: error: undefined reference to
'llvm::MachO::mapToArchitectureSet(llvm::ArrayRef<llvm::MachO::Target>)'

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)