[llvm-branch-commits] [openmp] f09f58d - [OpenMP] [OMPD] Fix CMake install command
Author: Yuanfang Chen Date: 2023-10-26T03:02:53Z New Revision: f09f58d0f2a981d8d578c66fbd1f27709ee6dfda URL: https://github.com/llvm/llvm-project/commit/f09f58d0f2a981d8d578c66fbd1f27709ee6dfda DIFF: https://github.com/llvm/llvm-project/commit/f09f58d0f2a981d8d578c66fbd1f27709ee6dfda.diff LOG: [OpenMP] [OMPD] Fix CMake install command https://cmake.org/cmake/help/latest/command/install.html "If a relative path is given it is interpreted relative to the value of the CMAKE_INSTALL_PREFIX variable." Added: Modified: openmp/libompd/gdb-plugin/CMakeLists.txt Removed: diff --git a/openmp/libompd/gdb-plugin/CMakeLists.txt b/openmp/libompd/gdb-plugin/CMakeLists.txt index a60f9419db19151..20cb4680e4cbfa2 100644 --- a/openmp/libompd/gdb-plugin/CMakeLists.txt +++ b/openmp/libompd/gdb-plugin/CMakeLists.txt @@ -36,5 +36,5 @@ target_link_libraries (ompdModule ${CMAKE_DL_LIBS}) set_target_properties (ompdModule PROPERTIES PREFIX "") set_target_properties (ompdModule PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/python-module/ompd/") -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python-module/ompd DESTINATION ${CMAKE_INSTALL_PREFIX}/share/gdb/python/ PATTERN ompdModule.so PERMISSIONS OWNER_READ WORLD_READ GROUP_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python-module/ompd DESTINATION share/gdb/python/ PATTERN ompdModule.so PERMISSIONS OWNER_READ WORLD_READ GROUP_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 5c7dcd7 - [Coroutine] Update promise object's final layout index
Author: Yuanfang Chen Date: 2021-01-12T17:44:02-08:00 New Revision: 5c7dcd7aead7b33ba065b98ab3573278feb42228 URL: https://github.com/llvm/llvm-project/commit/5c7dcd7aead7b33ba065b98ab3573278feb42228 DIFF: https://github.com/llvm/llvm-project/commit/5c7dcd7aead7b33ba065b98ab3573278feb42228.diff LOG: [Coroutine] Update promise object's final layout index promise is a header field but it is not guaranteed that it would be the third field of the frame due to `performOptimizedStructLayout`. Reviewed By: lxfind Differential Revision: https://reviews.llvm.org/D94137 Added: llvm/test/Transforms/Coroutines/coro-spill-promise.ll Modified: llvm/lib/Transforms/Coroutines/CoroFrame.cpp Removed: diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index 9c3c10660bd0..4823eea4154f 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -758,6 +758,15 @@ static StructType *buildFrameType(Function &F, coro::Shape &Shape, // Because multiple allocas may own the same field slot, // we add allocas to field here. B.addFieldForAllocas(F, FrameData, Shape); + // Add PromiseAlloca to Allocas list so that + // 1. updateLayoutIndex could update its index after + // `performOptimizedStructLayout` + // 2. it is processed in insertSpills. + if (Shape.ABI == coro::ABI::Switch && PromiseAlloca) +// We assume that the promise alloca won't be modified before +// CoroBegin and no alias will be create before CoroBegin. +FrameData.Allocas.emplace_back( +PromiseAlloca, DenseMap>{}, false); // Create an entry for every spilled value. for (auto &S : FrameData.Spills) { FieldIDType Id = B.addField(S.first->getType(), None); @@ -2288,13 +2297,6 @@ void coro::buildCoroutineFrame(Function &F, Shape &Shape) { Shape.ABI == coro::ABI::Async) sinkSpillUsesAfterCoroBegin(F, FrameData, Shape.CoroBegin); Shape.FrameTy = buildFrameType(F, Shape, FrameData); - // Add PromiseAlloca to Allocas list so that it is processed in insertSpills. - if (Shape.ABI == coro::ABI::Switch && Shape.SwitchLowering.PromiseAlloca) -// We assume that the promise alloca won't be modified before -// CoroBegin and no alias will be create before CoroBegin. -FrameData.Allocas.emplace_back( -Shape.SwitchLowering.PromiseAlloca, -DenseMap>{}, false); Shape.FramePtr = insertSpills(FrameData, Shape); lowerLocalAllocas(LocalAllocas, DeadInstructions); diff --git a/llvm/test/Transforms/Coroutines/coro-spill-promise.ll b/llvm/test/Transforms/Coroutines/coro-spill-promise.ll new file mode 100644 index ..6a7cf47c55d8 --- /dev/null +++ b/llvm/test/Transforms/Coroutines/coro-spill-promise.ll @@ -0,0 +1,57 @@ +; Check that promise object is reloaded from the correct index of the coro frame. +; RUN: opt < %s -coro-split -S | FileCheck %s +; RUN: opt < %s -passes=coro-split -S | FileCheck %s + +%"class.task::promise_type" = type { [64 x i8] } + +declare void @consume(i32*) +declare void @consume2(%"class.task::promise_type"*) + +define i8* @f() "coroutine.presplit"="1" { +entry: + %data = alloca i32, align 4 + %__promise = alloca %"class.task::promise_type", align 64 + %pv = bitcast %"class.task::promise_type"* %__promise to i8* + %id = call token @llvm.coro.id(i32 0, i8* %pv, i8* null, i8* null) + %size = call i32 @llvm.coro.size.i32() + %alloc = call i8* @malloc(i32 %size) + %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc) + call void @consume(i32* %data) + %0 = call i8 @llvm.coro.suspend(token none, i1 false) + switch i8 %0, label %suspend [i8 0, label %resume +i8 1, label %cleanup] +resume: + call void @consume(i32* %data) + call void @consume2(%"class.task::promise_type"* %__promise) + br label %cleanup + +cleanup: + %mem = call i8* @llvm.coro.free(token %id, i8* %hdl) + call void @free(i8* %mem) + br label %suspend +suspend: + call i1 @llvm.coro.end(i8* %hdl, i1 0) + ret i8* %hdl +} + +; CHECK-LABEL: %f.Frame = type { void (%f.Frame*)*, void (%f.Frame*)*, i32, i1, [43 x i8], %"class.task::promise_type" } + +; CHECK-LABEL: @f.resume( +; CHECK: %[[DATA:.+]] = getelementptr inbounds %f.Frame, %f.Frame* %FramePtr, i32 0, i32 5 +; CHECK: call void @consume2(%"class.task::promise_type"* %[[DATA]]) +; CHECK: ret void + +declare i8* @llvm.coro.free(token, i8*) +declare i32 @llvm.coro.size.i32() +declare i8 @llvm.coro.suspend(token, i1) +declare void @llvm.coro.resume(i8*) +declare void @llvm.coro.destroy(i8*) + +declare token @llvm.coro.id(i32, i8*, i8*, i8*) +declare i1 @llvm.coro.alloc(token) +declare i8* @llvm.coro.begin(token, i8*) +declare i1 @llvm.coro.end(i8*, i1) + +declare noalias i8* @malloc(i32) +declare double @print(double) +declare void @free(i8*) __
[llvm-branch-commits] [llvm] 4646de5 - [NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline
Author: Yuanfang Chen Date: 2020-12-28T17:36:36-08:00 New Revision: 4646de5d75cfce3da4ddeffb6eb8e66e38238800 URL: https://github.com/llvm/llvm-project/commit/4646de5d75cfce3da4ddeffb6eb8e66e38238800 DIFF: https://github.com/llvm/llvm-project/commit/4646de5d75cfce3da4ddeffb6eb8e66e38238800.diff LOG: [NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline Following up on D67687. Please refer to the RFC here http://lists.llvm.org/pipermail/llvm-dev/2020-July/143309.html `CodeGenPassBuilder` is the NPM counterpart of `TargetPassConfig` with below differences. - Debugging features (MIR print/verify, disable pass, start/stop-before/after, etc.) living in `TargetPassConfig` are moved to use PassInstrument as much as possible. (Implementation also lives in `TargetPassConfig.cpp`) - `TargetPassConfig` is a polymorphic base (virtual inheritance) to build the target-dependent pipeline whereas `CodeGenPassBuilder` is the CRTP base/helper to implement the target-dependent pipeline. The motivation is flexibility for targets to customize the pipeline, inlining opportunity, and fits the overall NPM value semantics design. - `TargetPassConfig` is a legacy immutable pass to declare hooks for targets to customize some target-independent codegen layer behavior. This is partially ported to TargetMachine::options. The rest, such as `createMachineScheduler/createPostMachineScheduler`, are left out for now. They should be implemented in LLVMTargetMachine in the future. Reviewed By: arsenm, aeubanks Differential Revision: https://reviews.llvm.org/D83608 Added: llvm/include/llvm/CodeGen/CodeGenPassBuilder.h llvm/include/llvm/CodeGen/MachinePassRegistry.def llvm/include/llvm/Target/CGPassBuilderOption.h llvm/lib/CodeGen/CodeGenPassBuilder.cpp Modified: llvm/include/llvm/CodeGen/TargetPassConfig.h llvm/include/llvm/Target/TargetMachine.h llvm/lib/CodeGen/CMakeLists.txt llvm/lib/CodeGen/LLVMTargetMachine.cpp llvm/lib/CodeGen/TargetPassConfig.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h new file mode 100644 index ..12c93a0c4cf2 --- /dev/null +++ b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h @@ -0,0 +1,1143 @@ +//===- Construction of codegen pass pipelines --*- C++ -*--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +/// \file +/// +/// Interfaces for registering analysis passes, producing common pass manager +/// configurations, and parsing of pass pipelines. +/// +//===--===// + +#ifndef LLVM_CODEGEN_CODEGENPASSBUILDER_H +#define LLVM_CODEGEN_CODEGENPASSBUILDER_H + +#include "llvm/ADT/FunctionExtras.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/BasicAliasAnalysis.h" +#include "llvm/Analysis/CFLAndersAliasAnalysis.h" +#include "llvm/Analysis/CFLSteensAliasAnalysis.h" +#include "llvm/Analysis/ScopedNoAliasAA.h" +#include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/Analysis/TypeBasedAliasAnalysis.h" +#include "llvm/CodeGen/ExpandReductions.h" +#include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/CodeGen/MachinePassManager.h" +#include "llvm/CodeGen/PreISelIntrinsicLowering.h" +#include "llvm/CodeGen/UnreachableBlockElim.h" +#include "llvm/IR/IRPrintingPasses.h" +#include "llvm/IR/PassManager.h" +#include "llvm/IR/Verifier.h" +#include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCTargetOptions.h" +#include "llvm/Support/CodeGen.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Target/CGPassBuilderOption.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Transforms/Scalar/ConstantHoisting.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopStrengthReduce.h" +#include "llvm/Transforms/Scalar/LowerConstantIntrinsics.h" +#include "llvm/Transforms/Scalar/MergeICmps.h" +#include "llvm/Transforms/Scalar/PartiallyInlineLibCalls.h" +#include "llvm/Transforms/Utils.h" +#include "llvm/Transforms/Utils/EntryExitInstrumenter.h" +#include "llvm/Transforms/Utils/LowerInvoke.h" +#include +#include +#include +#include +#include + +namespace llvm { + +// FIXME: Dummy target independent passes definitions that have not yet been +// ported to new pass manager. Once they do, remove these. +#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR)
[llvm-branch-commits] [llvm] 94427af - Revert "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline"
Author: Yuanfang Chen Date: 2020-12-28T17:44:22-08:00 New Revision: 94427af60c66ffea655a3084825c6c3a9deec1ad URL: https://github.com/llvm/llvm-project/commit/94427af60c66ffea655a3084825c6c3a9deec1ad DIFF: https://github.com/llvm/llvm-project/commit/94427af60c66ffea655a3084825c6c3a9deec1ad.diff LOG: Revert "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline" This reverts commit 4646de5d75cfce3da4ddeffb6eb8e66e38238800. Some bots have build failure. Added: Modified: llvm/include/llvm/CodeGen/TargetPassConfig.h llvm/include/llvm/Target/TargetMachine.h llvm/lib/CodeGen/CMakeLists.txt llvm/lib/CodeGen/LLVMTargetMachine.cpp llvm/lib/CodeGen/TargetPassConfig.cpp Removed: llvm/include/llvm/CodeGen/CodeGenPassBuilder.h llvm/include/llvm/CodeGen/MachinePassRegistry.def llvm/include/llvm/Target/CGPassBuilderOption.h llvm/lib/CodeGen/CodeGenPassBuilder.cpp diff --git a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h deleted file mode 100644 index 12c93a0c4cf2.. --- a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h +++ /dev/null @@ -1,1143 +0,0 @@ -//===- Construction of codegen pass pipelines --*- C++ -*--===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===--===// -/// \file -/// -/// Interfaces for registering analysis passes, producing common pass manager -/// configurations, and parsing of pass pipelines. -/// -//===--===// - -#ifndef LLVM_CODEGEN_CODEGENPASSBUILDER_H -#define LLVM_CODEGEN_CODEGENPASSBUILDER_H - -#include "llvm/ADT/FunctionExtras.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/BasicAliasAnalysis.h" -#include "llvm/Analysis/CFLAndersAliasAnalysis.h" -#include "llvm/Analysis/CFLSteensAliasAnalysis.h" -#include "llvm/Analysis/ScopedNoAliasAA.h" -#include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/Analysis/TypeBasedAliasAnalysis.h" -#include "llvm/CodeGen/ExpandReductions.h" -#include "llvm/CodeGen/MachineModuleInfo.h" -#include "llvm/CodeGen/MachinePassManager.h" -#include "llvm/CodeGen/PreISelIntrinsicLowering.h" -#include "llvm/CodeGen/UnreachableBlockElim.h" -#include "llvm/IR/IRPrintingPasses.h" -#include "llvm/IR/PassManager.h" -#include "llvm/IR/Verifier.h" -#include "llvm/MC/MCAsmInfo.h" -#include "llvm/MC/MCStreamer.h" -#include "llvm/MC/MCTargetOptions.h" -#include "llvm/Support/CodeGen.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/Error.h" -#include "llvm/Support/ErrorHandling.h" -#include "llvm/Target/CGPassBuilderOption.h" -#include "llvm/Target/TargetMachine.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Transforms/Scalar/ConstantHoisting.h" -#include "llvm/Transforms/Scalar/LoopPassManager.h" -#include "llvm/Transforms/Scalar/LoopStrengthReduce.h" -#include "llvm/Transforms/Scalar/LowerConstantIntrinsics.h" -#include "llvm/Transforms/Scalar/MergeICmps.h" -#include "llvm/Transforms/Scalar/PartiallyInlineLibCalls.h" -#include "llvm/Transforms/Utils.h" -#include "llvm/Transforms/Utils/EntryExitInstrumenter.h" -#include "llvm/Transforms/Utils/LowerInvoke.h" -#include -#include -#include -#include -#include - -namespace llvm { - -// FIXME: Dummy target independent passes definitions that have not yet been -// ported to new pass manager. Once they do, remove these. -#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - struct PASS_NAME : public PassInfoMixin { \ -template PASS_NAME(Ts &&...) {} \ -PreservedAnalyses run(Function &, FunctionAnalysisManager &) { \ - return PreservedAnalyses::all(); \ -} \ - }; -#define DUMMY_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - struct PASS_NAME : public PassInfoMixin { \ -template PASS_NAME(Ts &&...) {} \ -PreservedAnalyses run(Module &, ModuleAnalysisManager &) { \ - return PreservedAnalyses::all(); \ -} \ - }; -#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - struct PASS_NAME : public PassInfoMixin { \ -template PASS_NAME(Ts &&...) {} \ -Err
[llvm-branch-commits] [llvm] 2131494 - Reland "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline"
Author: Yuanfang Chen Date: 2020-12-29T15:17:23-08:00 New Revision: 21314940c4856e0cb81b664fd2d2117d1b7dc3e3 URL: https://github.com/llvm/llvm-project/commit/21314940c4856e0cb81b664fd2d2117d1b7dc3e3 DIFF: https://github.com/llvm/llvm-project/commit/21314940c4856e0cb81b664fd2d2117d1b7dc3e3.diff LOG: Reland "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline" This reverts commit 94427af60c66ffea655a3084825c6c3a9deec1ad (relands 4646de5d75cfce3da4ddeffb6eb8e66e38238800 with fix). Use "return std::move(AsmStreamer);" instead of "return AsmStreamer;" in LVMTargetMachine::createMCStreamer. Unlike Clang, GCC seems having trouble inserting a implicit lvalue->rvalue conversion. Added: llvm/include/llvm/CodeGen/CodeGenPassBuilder.h llvm/include/llvm/CodeGen/MachinePassRegistry.def llvm/include/llvm/Target/CGPassBuilderOption.h llvm/lib/CodeGen/CodeGenPassBuilder.cpp Modified: llvm/include/llvm/CodeGen/TargetPassConfig.h llvm/include/llvm/Target/TargetMachine.h llvm/lib/CodeGen/CMakeLists.txt llvm/lib/CodeGen/LLVMTargetMachine.cpp llvm/lib/CodeGen/TargetPassConfig.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h new file mode 100644 index ..12c93a0c4cf2 --- /dev/null +++ b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h @@ -0,0 +1,1143 @@ +//===- Construction of codegen pass pipelines --*- C++ -*--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +/// \file +/// +/// Interfaces for registering analysis passes, producing common pass manager +/// configurations, and parsing of pass pipelines. +/// +//===--===// + +#ifndef LLVM_CODEGEN_CODEGENPASSBUILDER_H +#define LLVM_CODEGEN_CODEGENPASSBUILDER_H + +#include "llvm/ADT/FunctionExtras.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/BasicAliasAnalysis.h" +#include "llvm/Analysis/CFLAndersAliasAnalysis.h" +#include "llvm/Analysis/CFLSteensAliasAnalysis.h" +#include "llvm/Analysis/ScopedNoAliasAA.h" +#include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/Analysis/TypeBasedAliasAnalysis.h" +#include "llvm/CodeGen/ExpandReductions.h" +#include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/CodeGen/MachinePassManager.h" +#include "llvm/CodeGen/PreISelIntrinsicLowering.h" +#include "llvm/CodeGen/UnreachableBlockElim.h" +#include "llvm/IR/IRPrintingPasses.h" +#include "llvm/IR/PassManager.h" +#include "llvm/IR/Verifier.h" +#include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCTargetOptions.h" +#include "llvm/Support/CodeGen.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Target/CGPassBuilderOption.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Transforms/Scalar/ConstantHoisting.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopStrengthReduce.h" +#include "llvm/Transforms/Scalar/LowerConstantIntrinsics.h" +#include "llvm/Transforms/Scalar/MergeICmps.h" +#include "llvm/Transforms/Scalar/PartiallyInlineLibCalls.h" +#include "llvm/Transforms/Utils.h" +#include "llvm/Transforms/Utils/EntryExitInstrumenter.h" +#include "llvm/Transforms/Utils/LowerInvoke.h" +#include +#include +#include +#include +#include + +namespace llvm { + +// FIXME: Dummy target independent passes definitions that have not yet been +// ported to new pass manager. Once they do, remove these. +#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ + struct PASS_NAME : public PassInfoMixin { \ +template PASS_NAME(Ts &&...) {} \ +PreservedAnalyses run(Function &, FunctionAnalysisManager &) { \ + return PreservedAnalyses::all(); \ +} \ + }; +#define DUMMY_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ + struct PASS_NAME : public PassInfoMixin { \ +template PASS_NAME(Ts &&...) {} \ +PreservedAnalyses run(Module &, ModuleAnalysisManager &) { \ + return PreservedAnalyses::all(); \ +} \ + }; +#define
[llvm-branch-commits] [llvm] 16c8f6e - Revert "Reland "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline""
Author: Yuanfang Chen Date: 2020-12-29T16:29:07-08:00 New Revision: 16c8f6e91344ec9840d6aa9ec6b8d0c87a104ca3 URL: https://github.com/llvm/llvm-project/commit/16c8f6e91344ec9840d6aa9ec6b8d0c87a104ca3 DIFF: https://github.com/llvm/llvm-project/commit/16c8f6e91344ec9840d6aa9ec6b8d0c87a104ca3.diff LOG: Revert "Reland "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline"" This reverts commit 21314940c4856e0cb81b664fd2d2117d1b7dc3e3. Build failure in some bots. Added: Modified: llvm/include/llvm/CodeGen/TargetPassConfig.h llvm/include/llvm/Target/TargetMachine.h llvm/lib/CodeGen/CMakeLists.txt llvm/lib/CodeGen/LLVMTargetMachine.cpp llvm/lib/CodeGen/TargetPassConfig.cpp Removed: llvm/include/llvm/CodeGen/CodeGenPassBuilder.h llvm/include/llvm/CodeGen/MachinePassRegistry.def llvm/include/llvm/Target/CGPassBuilderOption.h llvm/lib/CodeGen/CodeGenPassBuilder.cpp diff --git a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h deleted file mode 100644 index 12c93a0c4cf2.. --- a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h +++ /dev/null @@ -1,1143 +0,0 @@ -//===- Construction of codegen pass pipelines --*- C++ -*--===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===--===// -/// \file -/// -/// Interfaces for registering analysis passes, producing common pass manager -/// configurations, and parsing of pass pipelines. -/// -//===--===// - -#ifndef LLVM_CODEGEN_CODEGENPASSBUILDER_H -#define LLVM_CODEGEN_CODEGENPASSBUILDER_H - -#include "llvm/ADT/FunctionExtras.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/BasicAliasAnalysis.h" -#include "llvm/Analysis/CFLAndersAliasAnalysis.h" -#include "llvm/Analysis/CFLSteensAliasAnalysis.h" -#include "llvm/Analysis/ScopedNoAliasAA.h" -#include "llvm/Analysis/TargetTransformInfo.h" -#include "llvm/Analysis/TypeBasedAliasAnalysis.h" -#include "llvm/CodeGen/ExpandReductions.h" -#include "llvm/CodeGen/MachineModuleInfo.h" -#include "llvm/CodeGen/MachinePassManager.h" -#include "llvm/CodeGen/PreISelIntrinsicLowering.h" -#include "llvm/CodeGen/UnreachableBlockElim.h" -#include "llvm/IR/IRPrintingPasses.h" -#include "llvm/IR/PassManager.h" -#include "llvm/IR/Verifier.h" -#include "llvm/MC/MCAsmInfo.h" -#include "llvm/MC/MCStreamer.h" -#include "llvm/MC/MCTargetOptions.h" -#include "llvm/Support/CodeGen.h" -#include "llvm/Support/Debug.h" -#include "llvm/Support/Error.h" -#include "llvm/Support/ErrorHandling.h" -#include "llvm/Target/CGPassBuilderOption.h" -#include "llvm/Target/TargetMachine.h" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Transforms/Scalar/ConstantHoisting.h" -#include "llvm/Transforms/Scalar/LoopPassManager.h" -#include "llvm/Transforms/Scalar/LoopStrengthReduce.h" -#include "llvm/Transforms/Scalar/LowerConstantIntrinsics.h" -#include "llvm/Transforms/Scalar/MergeICmps.h" -#include "llvm/Transforms/Scalar/PartiallyInlineLibCalls.h" -#include "llvm/Transforms/Utils.h" -#include "llvm/Transforms/Utils/EntryExitInstrumenter.h" -#include "llvm/Transforms/Utils/LowerInvoke.h" -#include -#include -#include -#include -#include - -namespace llvm { - -// FIXME: Dummy target independent passes definitions that have not yet been -// ported to new pass manager. Once they do, remove these. -#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - struct PASS_NAME : public PassInfoMixin { \ -template PASS_NAME(Ts &&...) {} \ -PreservedAnalyses run(Function &, FunctionAnalysisManager &) { \ - return PreservedAnalyses::all(); \ -} \ - }; -#define DUMMY_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - struct PASS_NAME : public PassInfoMixin { \ -template PASS_NAME(Ts &&...) {} \ -PreservedAnalyses run(Module &, ModuleAnalysisManager &) { \ - return PreservedAnalyses::all(); \ -} \ - }; -#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ - struct PASS_NAME : public PassInfoMixin { \ -template PASS_NAME(Ts &&...) {} \ -
[llvm-branch-commits] [llvm] 480936e - Reland "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline" (again)
Author: Yuanfang Chen Date: 2020-12-29T16:39:55-08:00 New Revision: 480936e741d588d53b9e2d9c5935b5daa0fdee25 URL: https://github.com/llvm/llvm-project/commit/480936e741d588d53b9e2d9c5935b5daa0fdee25 DIFF: https://github.com/llvm/llvm-project/commit/480936e741d588d53b9e2d9c5935b5daa0fdee25.diff LOG: Reland "[NewPM][CodeGen] Introduce CodeGenPassBuilder to help build codegen pipeline" (again) This reverts commit 16c8f6e91344ec9840d6aa9ec6b8d0c87a104ca3 with fix. -Wswitch catched an unhandled enum value due to recent commits in TargetPassConfig.cpp. Added: llvm/include/llvm/CodeGen/CodeGenPassBuilder.h llvm/include/llvm/CodeGen/MachinePassRegistry.def llvm/include/llvm/Target/CGPassBuilderOption.h llvm/lib/CodeGen/CodeGenPassBuilder.cpp Modified: llvm/include/llvm/CodeGen/TargetPassConfig.h llvm/include/llvm/Target/TargetMachine.h llvm/lib/CodeGen/CMakeLists.txt llvm/lib/CodeGen/LLVMTargetMachine.cpp llvm/lib/CodeGen/TargetPassConfig.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h new file mode 100644 index ..e09cbf95793d --- /dev/null +++ b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h @@ -0,0 +1,1144 @@ +//===- Construction of codegen pass pipelines --*- C++ -*--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +/// \file +/// +/// Interfaces for registering analysis passes, producing common pass manager +/// configurations, and parsing of pass pipelines. +/// +//===--===// + +#ifndef LLVM_CODEGEN_CODEGENPASSBUILDER_H +#define LLVM_CODEGEN_CODEGENPASSBUILDER_H + +#include "llvm/ADT/FunctionExtras.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/BasicAliasAnalysis.h" +#include "llvm/Analysis/CFLAndersAliasAnalysis.h" +#include "llvm/Analysis/CFLSteensAliasAnalysis.h" +#include "llvm/Analysis/ScopedNoAliasAA.h" +#include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/Analysis/TypeBasedAliasAnalysis.h" +#include "llvm/CodeGen/ExpandReductions.h" +#include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/CodeGen/MachinePassManager.h" +#include "llvm/CodeGen/PreISelIntrinsicLowering.h" +#include "llvm/CodeGen/UnreachableBlockElim.h" +#include "llvm/IR/IRPrintingPasses.h" +#include "llvm/IR/PassManager.h" +#include "llvm/IR/Verifier.h" +#include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCTargetOptions.h" +#include "llvm/Support/CodeGen.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/ErrorHandling.h" +#include "llvm/Target/CGPassBuilderOption.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Transforms/Scalar.h" +#include "llvm/Transforms/Scalar/ConstantHoisting.h" +#include "llvm/Transforms/Scalar/LoopPassManager.h" +#include "llvm/Transforms/Scalar/LoopStrengthReduce.h" +#include "llvm/Transforms/Scalar/LowerConstantIntrinsics.h" +#include "llvm/Transforms/Scalar/MergeICmps.h" +#include "llvm/Transforms/Scalar/PartiallyInlineLibCalls.h" +#include "llvm/Transforms/Utils.h" +#include "llvm/Transforms/Utils/EntryExitInstrumenter.h" +#include "llvm/Transforms/Utils/LowerInvoke.h" +#include +#include +#include +#include +#include + +namespace llvm { + +// FIXME: Dummy target independent passes definitions that have not yet been +// ported to new pass manager. Once they do, remove these. +#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ + struct PASS_NAME : public PassInfoMixin { \ +template PASS_NAME(Ts &&...) {} \ +PreservedAnalyses run(Function &, FunctionAnalysisManager &) { \ + return PreservedAnalyses::all(); \ +} \ + }; +#define DUMMY_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ + struct PASS_NAME : public PassInfoMixin { \ +template PASS_NAME(Ts &&...) {} \ +PreservedAnalyses run(Module &, ModuleAnalysisManager &) { \ + return PreservedAnalyses::all(); \ +} \ + }; +#define DUMMY_MACHINE_MODULE_PASS(NAME, PASS_NAME, CONSTRUCTOR) \ + struct PASS_NAME : public PassInfoMixin { \ +
[llvm-branch-commits] [llvm] 277ebe4 - Fix `LLVM_ENABLE_MODULES=On` build
Author: Yuanfang Chen Date: 2020-12-30T10:54:04-08:00 New Revision: 277ebe46c6665a8717c5c6e7d767bbec31becfb8 URL: https://github.com/llvm/llvm-project/commit/277ebe46c6665a8717c5c6e7d767bbec31becfb8 DIFF: https://github.com/llvm/llvm-project/commit/277ebe46c6665a8717c5c6e7d767bbec31becfb8.diff LOG: Fix `LLVM_ENABLE_MODULES=On` build for commit 480936e741d588d53b9e2d9c5935b5daa0fdee25. Added: Modified: llvm/include/llvm/CodeGen/CodeGenPassBuilder.h llvm/include/llvm/CodeGen/MachinePassRegistry.def llvm/include/llvm/module.modulemap llvm/lib/Transforms/IPO/PassManagerBuilder.cpp Removed: diff --git a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h index e09cbf95793d..b47aaa53eb89 100644 --- a/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h +++ b/llvm/include/llvm/CodeGen/CodeGenPassBuilder.h @@ -49,6 +49,7 @@ #include "llvm/Transforms/Scalar/LowerConstantIntrinsics.h" #include "llvm/Transforms/Scalar/MergeICmps.h" #include "llvm/Transforms/Scalar/PartiallyInlineLibCalls.h" +#include "llvm/Transforms/Scalar/ScalarizeMaskedMemIntrin.h" #include "llvm/Transforms/Utils.h" #include "llvm/Transforms/Utils/EntryExitInstrumenter.h" #include "llvm/Transforms/Utils/LowerInvoke.h" diff --git a/llvm/include/llvm/CodeGen/MachinePassRegistry.def b/llvm/include/llvm/CodeGen/MachinePassRegistry.def index b68fcc684b76..e9eaa5f77000 100644 --- a/llvm/include/llvm/CodeGen/MachinePassRegistry.def +++ b/llvm/include/llvm/CodeGen/MachinePassRegistry.def @@ -44,6 +44,7 @@ FUNCTION_PASS("ee-instrument", EntryExitInstrumenterPass, (false)) FUNCTION_PASS("post-inline-ee-instrument", EntryExitInstrumenterPass, (true)) FUNCTION_PASS("expand-reductions", ExpandReductionsPass, ()) FUNCTION_PASS("lowerinvoke", LowerInvokePass, ()) +FUNCTION_PASS("scalarize-masked-mem-intrin", ScalarizeMaskedMemIntrinPass, ()) FUNCTION_PASS("verify", VerifierPass, ()) #undef FUNCTION_PASS @@ -103,7 +104,6 @@ MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis, ( DUMMY_FUNCTION_PASS("expandmemcmp", ExpandMemCmpPass, ()) DUMMY_FUNCTION_PASS("gc-lowering", GCLoweringPass, ()) DUMMY_FUNCTION_PASS("shadow-stack-gc-lowering", ShadowStackGCLoweringPass, ()) -DUMMY_FUNCTION_PASS("scalarize-masked-mem-intrin", ScalarizeMaskedMemIntrinPass, ()) DUMMY_FUNCTION_PASS("sjljehprepare", SjLjEHPreparePass, ()) DUMMY_FUNCTION_PASS("dwarfehprepare", DwarfEHPass, ()) DUMMY_FUNCTION_PASS("winehprepare", WinEHPass, ()) diff --git a/llvm/include/llvm/module.modulemap b/llvm/include/llvm/module.modulemap index b1d0a703850b..0fd63b00fd0d 100644 --- a/llvm/include/llvm/module.modulemap +++ b/llvm/include/llvm/module.modulemap @@ -30,6 +30,7 @@ module LLVM_Backend { // These are intended for (repeated) textual inclusion. textual header "CodeGen/DIEValue.def" +textual header "CodeGen/MachinePassRegistry.def" } } diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp index 282ce5132944..e7b5414a3841 100644 --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -73,15 +73,15 @@ cl::opt RunNewGVN("enable-newgvn", cl::init(false), cl::Hidden, // Experimental option to use CFL-AA enum class CFLAAType { None, Steensgaard, Andersen, Both }; -static cl::opt -UseCFLAA("use-cfl-aa", cl::init(CFLAAType::None), cl::Hidden, +static cl::opt<::CFLAAType> +UseCFLAA("use-cfl-aa", cl::init(::CFLAAType::None), cl::Hidden, cl::desc("Enable the new, experimental CFL alias analysis"), - cl::values(clEnumValN(CFLAAType::None, "none", "Disable CFL-AA"), -clEnumValN(CFLAAType::Steensgaard, "steens", + cl::values(clEnumValN(::CFLAAType::None, "none", "Disable CFL-AA"), +clEnumValN(::CFLAAType::Steensgaard, "steens", "Enable unification-based CFL-AA"), -clEnumValN(CFLAAType::Andersen, "anders", +clEnumValN(::CFLAAType::Andersen, "anders", "Enable inclusion-based CFL-AA"), -clEnumValN(CFLAAType::Both, "both", +clEnumValN(::CFLAAType::Both, "both", "Enable both variants of CFL-AA"))); static cl::opt EnableLoopInterchange( @@ -276,13 +276,13 @@ void PassManagerBuilder::addExtensionsToPM(ExtensionPointTy ETy, void PassManagerBuilder::addInitialAliasAnalysisPasses( legacy::PassManagerBase &PM) const { switch (UseCFLAA) { - case CFLAAType::Steensgaard: + case ::CFLAAType::Steensgaard: PM.add(createCFLSteensAAWrapperPass()); break; - case CFLAAType::Andersen: + case ::CFLAAType::Andersen: PM.add(createCFLAndersAAWrapperPass()); brea
[llvm-branch-commits] [llvm] 1821265 - [Time-report] Add a flag -ftime-report={per-pass, per-pass-run} to control the pass timing aggregation
Author: Yuanfang Chen Date: 2020-12-08T10:13:19-08:00 New Revision: 1821265db681cd2289fce9331e3aed26bdf814e3 URL: https://github.com/llvm/llvm-project/commit/1821265db681cd2289fce9331e3aed26bdf814e3 DIFF: https://github.com/llvm/llvm-project/commit/1821265db681cd2289fce9331e3aed26bdf814e3.diff LOG: [Time-report] Add a flag -ftime-report={per-pass,per-pass-run} to control the pass timing aggregation Currently, -ftime-report + new pass manager emits one line of report for each pass run. This potentially causes huge output text especially with regular LTO or large single file (Obeserved in private tests and was reported in D51276). The behaviour of -ftime-report + legacy pass manager is emitting one line of report for each pass object which has relatively reasonable text output size. This patch adds a flag `-ftime-report=` to control time report aggregation for new pass manager. The flag is for new pass manager only. Using it with legacy pass manager gives an error. It is a driver and cc1 flag. `per-pass` is the new default so `-ftime-report` is aliased to `-ftime-report=per-pass`. Before this patch, functionality-wise `-ftime-report` is aliased to `-ftime-report=per-pass-run`. * Adds an boolean variable TimePassesHandler::PerRun to control per-pass vs per-pass-run. * Adds a new clang CodeGen flag CodeGenOptions::TimePassesPerRun to work with the existing CodeGenOptions::TimePasses. * Remove FrontendOptions::ShowTimers, its uses are replaced by the existing CodeGenOptions::TimePasses. * Remove FrontendTimesIsEnabled (It was introduced in D45619 which was largely reverted.) Differential Revision: https://reviews.llvm.org/D92436 Added: clang/test/Driver/time-report.c clang/test/Misc/time-passes.c Modified: clang/include/clang/Basic/CodeGenOptions.def clang/include/clang/Driver/Options.td clang/include/clang/Frontend/FrontendOptions.h clang/include/clang/Frontend/Utils.h clang/lib/CodeGen/BackendUtil.cpp clang/lib/CodeGen/CodeGenAction.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Frontend/CMakeLists.txt clang/lib/Frontend/CompilerInstance.cpp clang/lib/Frontend/CompilerInvocation.cpp llvm/include/llvm/IR/PassTimingInfo.h llvm/include/llvm/Pass.h llvm/lib/IR/PassTimingInfo.cpp llvm/test/Other/time-passes.ll Removed: clang/lib/Frontend/FrontendTiming.cpp diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def index d4bbdbfa13b5..9c3b4f8289f9 100644 --- a/clang/include/clang/Basic/CodeGenOptions.def +++ b/clang/include/clang/Basic/CodeGenOptions.def @@ -252,7 +252,8 @@ CODEGENOPT(SpeculativeLoadHardening, 1, 0) ///< Enable speculative load hardenin CODEGENOPT(FineGrainedBitfieldAccesses, 1, 0) ///< Enable fine-grained bitfield accesses. CODEGENOPT(StrictEnums , 1, 0) ///< Optimize based on strict enum definition. CODEGENOPT(StrictVTablePointers, 1, 0) ///< Optimize based on the strict vtable pointers -CODEGENOPT(TimePasses, 1, 0) ///< Set when -ftime-report is enabled. +CODEGENOPT(TimePasses, 1, 0) ///< Set when -ftime-report or -ftime-report= is enabled. +CODEGENOPT(TimePassesPerRun , 1, 0) ///< Set when -ftime-report=per-pass-run is enabled. CODEGENOPT(TimeTrace , 1, 0) ///< Set when -ftime-trace is enabled. VALUE_CODEGENOPT(TimeTraceGranularity, 32, 500) ///< Minimum time granularity (in microseconds), ///< traced by time profiler diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 794aa24f997d..8cabcd671161 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -2005,7 +2005,12 @@ def Wframe_larger_than_EQ : Joined<["-"], "Wframe-larger-than=">, Group def : Flag<["-"], "fterminated-vtables">, Alias; def fthreadsafe_statics : Flag<["-"], "fthreadsafe-statics">, Group; def ftime_report : Flag<["-"], "ftime-report">, Group, Flags<[CC1Option]>, - MarshallingInfoFlag<"FrontendOpts.ShowTimers">; + MarshallingInfoFlag<"CodeGenOpts.TimePasses">; +def ftime_report_EQ: Joined<["-"], "ftime-report=">, Group, + Flags<[CC1Option]>, Values<"per-pass,per-pass-run">, + MarshallingInfoFlag<"CodeGenOpts.TimePassesPerRun">, + HelpText<"(For new pass manager) \"per-pass\": one report for each pass; " + "\"per-pass-run\": one report for each pass invocation">; def ftime_trace : Flag<["-"], "ftime-trace">, Group, HelpText<"Turn on time profiler. Generates JSON file based on output filename.">, DocBrief<[{ diff --git a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h index b06ad5203e75..223c1e05d053 100644 --- a/clang/include/clang/Frontend/FrontendOptions.h +++ b/clang/include/clang/Frontend/FrontendOptions.h @@ -239,9 +239,6 @@ class FrontendOptions {
[llvm-branch-commits] [clang] 8b23b3a - [NFCI] Add missing triple to several LTO tests
Author: Yuanfang Chen Date: 2020-12-09T13:13:58-08:00 New Revision: 8b23b3ab3aea28b91e5aa48f29fe9eb1828515a3 URL: https://github.com/llvm/llvm-project/commit/8b23b3ab3aea28b91e5aa48f29fe9eb1828515a3 DIFF: https://github.com/llvm/llvm-project/commit/8b23b3ab3aea28b91e5aa48f29fe9eb1828515a3.diff LOG: [NFCI] Add missing triple to several LTO tests Also remove the module triple of clang/test/CodeGenObjC/arc.ll, the commandline tripe is all it needs. Added: Modified: clang/test/CodeGenObjC/arc.ll llvm/test/ThinLTO/X86/Inputs/distributed_import.ll llvm/test/tools/gold/X86/Inputs/comdat.ll llvm/test/tools/gold/X86/Inputs/type-merge2.ll llvm/test/tools/gold/X86/Inputs/visibility.ll Removed: diff --git a/clang/test/CodeGenObjC/arc.ll b/clang/test/CodeGenObjC/arc.ll index 7b903d05cd17..cfc88c3c7eb7 100644 --- a/clang/test/CodeGenObjC/arc.ll +++ b/clang/test/CodeGenObjC/arc.ll @@ -1,7 +1,5 @@ ; RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Os -emit-llvm -fobjc-arc -o - %s | FileCheck %s -target triple = "x86_64-apple-darwin10" - declare i8* @llvm.objc.retain(i8*) declare void @llvm.objc.release(i8*) diff --git a/llvm/test/ThinLTO/X86/Inputs/distributed_import.ll b/llvm/test/ThinLTO/X86/Inputs/distributed_import.ll index 328603d20c46..d7d9bb6789af 100644 --- a/llvm/test/ThinLTO/X86/Inputs/distributed_import.ll +++ b/llvm/test/ThinLTO/X86/Inputs/distributed_import.ll @@ -1,4 +1,5 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" @G = internal global i32 7 define i32 @g() { diff --git a/llvm/test/tools/gold/X86/Inputs/comdat.ll b/llvm/test/tools/gold/X86/Inputs/comdat.ll index e70b71815665..ca4bbb4bf81e 100644 --- a/llvm/test/tools/gold/X86/Inputs/comdat.ll +++ b/llvm/test/tools/gold/X86/Inputs/comdat.ll @@ -1,4 +1,5 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" $c2 = comdat any $c1 = comdat any diff --git a/llvm/test/tools/gold/X86/Inputs/type-merge2.ll b/llvm/test/tools/gold/X86/Inputs/type-merge2.ll index 7cdea6e82f37..7890c47a3004 100644 --- a/llvm/test/tools/gold/X86/Inputs/type-merge2.ll +++ b/llvm/test/tools/gold/X86/Inputs/type-merge2.ll @@ -1,4 +1,5 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" %zed = type { i16 } define void @bar(%zed* %this) { diff --git a/llvm/test/tools/gold/X86/Inputs/visibility.ll b/llvm/test/tools/gold/X86/Inputs/visibility.ll index 42796a97bc87..37442469aa7e 100644 --- a/llvm/test/tools/gold/X86/Inputs/visibility.ll +++ b/llvm/test/tools/gold/X86/Inputs/visibility.ll @@ -1,4 +1,5 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" define void @foo() { ret void ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] fc39425 - [NFCI] Add a missing triple in clang/test/CodeGen/ppc64le-varargs-f128.c
Author: Yuanfang Chen Date: 2020-12-09T18:17:34-08:00 New Revision: fc3942526f5c048759e90d10289ecef75410f728 URL: https://github.com/llvm/llvm-project/commit/fc3942526f5c048759e90d10289ecef75410f728 DIFF: https://github.com/llvm/llvm-project/commit/fc3942526f5c048759e90d10289ecef75410f728.diff LOG: [NFCI] Add a missing triple in clang/test/CodeGen/ppc64le-varargs-f128.c Added: Modified: clang/test/CodeGen/ppc64le-varargs-f128.c Removed: diff --git a/clang/test/CodeGen/ppc64le-varargs-f128.c b/clang/test/CodeGen/ppc64le-varargs-f128.c index 7868fe322ce8..3cc13c259977 100644 --- a/clang/test/CodeGen/ppc64le-varargs-f128.c +++ b/clang/test/CodeGen/ppc64le-varargs-f128.c @@ -12,7 +12,7 @@ // RUN: -target-feature +float128 -fopenmp -fopenmp-is-device -emit-llvm \ // RUN: -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s \ // RUN: -check-prefix=OMP-TARGET -// RUN: %clang_cc1 %t-ppc-host.bc -emit-llvm -o - | FileCheck %s \ +// RUN: %clang_cc1 -triple ppc64le %t-ppc-host.bc -emit-llvm -o - | FileCheck %s \ // RUN: -check-prefix=OMP-HOST #include ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] cef34cb - address reviewers comments
Author: Yuanfang Chen Date: 2019-11-05T12:23:03-08:00 New Revision: cef34cb7eb9c1ab60b5e0c29e13221df8f1dc52d URL: https://github.com/llvm/llvm-project/commit/cef34cb7eb9c1ab60b5e0c29e13221df8f1dc52d DIFF: https://github.com/llvm/llvm-project/commit/cef34cb7eb9c1ab60b5e0c29e13221df8f1dc52d.diff LOG: address reviewers comments Added: Modified: lld/ELF/Driver.cpp llvm/include/llvm/LTO/LTO.h llvm/lib/LTO/LTO.cpp Removed: diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 0f5f63093633..8ac3e80b93ba 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -192,18 +192,15 @@ std::vector> static getArchiveMembers( void LinkerDriver::addFile(StringRef path, bool withLOption) { using namespace sys::fs; - MemoryBufferRef mbref; - MemoryBufferRef *MB = nullptr; + Optional buffer; if (irSymTabCache) -MB = irSymTabCache->getMemBufferForPath(path); - if (MB) { -mbref = *MB; - } else { -Optional buffer = readFile(path); -if (!buffer.hasValue()) - return; -mbref = *buffer; - } +buffer = irSymTabCache->getMemBufferForPath(path); + if (!buffer.hasValue()) +buffer = readFile(path); + if (!buffer.hasValue()) +return; + + MemoryBufferRef mbref = *buffer; if (config->formatBinary) { files.push_back(make(mbref)); diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h index ea86ecb90452..ad7aa737ecc9 100644 --- a/llvm/include/llvm/LTO/LTO.h +++ b/llvm/include/llvm/LTO/LTO.h @@ -118,10 +118,10 @@ class IRSymtabFileCache { public: IRSymtabFileCache() : ThinLTOParallelismLevel(std::thread::hardware_concurrency()), -BackendThreadPool(ThinLTOParallelismLevel) {} +BackendThreadPool(ThinLTOParallelismLevel), Cache(), LoadedFiles() {} void upgrade(const std::vector &Files, AddFileFn AFF); object::IRSymtabFile *get(const MemoryBufferRef &M); - MemoryBufferRef *getMemBufferForPath(StringRef Path); + Optional getMemBufferForPath(StringRef Path); }; /// An input file. This is a symbol table wrapper that only exposes the diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index e2cc99fb94e0..1d75c351fdcc 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -1395,8 +1395,8 @@ void IRSymtabFileCache::upgrade(const std::vector &Files, for (auto &F : Files) AFF(F, LoadedFiles, MBrefs); - // Cache IR SymTab only if it needs upgrade. Also try to balance the amount - // work each thread will do based on aggregate MemoryBufferRef size. + // Cache IR SymTab only if it needs to be upgraded. Also try to balance the + // amount work each thread will do based on aggregate MemoryBufferRef size. std::vector ToCache; unsigned TotalBufSize = 0; for (auto &M : MBrefs) @@ -1406,7 +1406,7 @@ void IRSymtabFileCache::upgrade(const std::vector &Files, Cache.try_emplace(M, nullptr); } - if (!ToCache.size()) + if (ToCache.size() == 0) return; // If too few symtabs to cache, assign one to each thread. @@ -1434,22 +1434,22 @@ void IRSymtabFileCache::upgrade(const std::vector &Files, continue; CurTotal = 0; -auto TI = I; -BackendThreadPool.async(PreLoad, CI, ++TI); -CI = TI; +BackendThreadPool.async(PreLoad, CI, I + 1); +CI = I + 1; if (++NumThread == (ThinLTOParallelismLevel - 1)) { - BackendThreadPool.async(PreLoad, CI, ToCache.end()); + BackendThreadPool.async(PreLoad, CI, E); break; } } BackendThreadPool.wait(); } -MemoryBufferRef *IRSymtabFileCache::getMemBufferForPath(StringRef Path) { +Optional +IRSymtabFileCache::getMemBufferForPath(StringRef Path) { auto I = LoadedFiles.find(Path); if (I != LoadedFiles.end()) -return &I->second; - return nullptr; +return I->second; + return None; } Expected> ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 3ba66b6 - upgrade IR symtab in parallel ahead of time.
Author: Yuanfang Chen Date: 2019-11-05T00:01:43-08:00 New Revision: 3ba66b6229f5400a2637cd3b4529b1dd7987feee URL: https://github.com/llvm/llvm-project/commit/3ba66b6229f5400a2637cd3b4529b1dd7987feee DIFF: https://github.com/llvm/llvm-project/commit/3ba66b6229f5400a2637cd3b4529b1dd7987feee.diff LOG: upgrade IR symtab in parallel ahead of time. Added: Modified: lld/ELF/Driver.cpp lld/ELF/Driver.h lld/ELF/InputFiles.cpp llvm/include/llvm/Bitcode/BitcodeReader.h llvm/include/llvm/LTO/LTO.h llvm/include/llvm/Object/IRObjectFile.h llvm/include/llvm/Object/IRSymtab.h llvm/include/llvm/Support/MemoryBuffer.h llvm/lib/LTO/LTO.cpp llvm/lib/Object/IRObjectFile.cpp llvm/lib/Object/IRSymtab.cpp Removed: diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 1b1a50bf6d1c..0f5f63093633 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -49,6 +49,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/LTO/LTO.h" +#include "llvm/Bitcode/BitcodeReader.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compression.h" #include "llvm/Support/GlobPattern.h" @@ -67,6 +68,8 @@ using namespace llvm::sys; using namespace llvm::support; namespace lld { +llvm::lto::IRSymtabFileCache *irSymTabCache; + namespace elf { Configuration *config; @@ -189,10 +192,18 @@ std::vector> static getArchiveMembers( void LinkerDriver::addFile(StringRef path, bool withLOption) { using namespace sys::fs; - Optional buffer = readFile(path); - if (!buffer.hasValue()) -return; - MemoryBufferRef mbref = *buffer; + MemoryBufferRef mbref; + MemoryBufferRef *MB = nullptr; + if (irSymTabCache) +MB = irSymTabCache->getMemBufferForPath(path); + if (MB) { +mbref = *MB; + } else { +Optional buffer = readFile(path); +if (!buffer.hasValue()) + return; +mbref = *buffer; + } if (config->formatBinary) { files.push_back(make(mbref)); @@ -486,6 +497,8 @@ void LinkerDriver::main(ArrayRef argsArr) { if (args.hasArg(OPT_version)) return; + irSymTabCache = new lto::IRSymtabFileCache(); + initLLVM(); createFiles(args); if (errorCount()) @@ -1161,10 +1174,54 @@ static bool isFormatBinary(StringRef s) { return false; } +void addFileToIrSymTabCache(StringRef path, +llvm::StringMap &LoadedFiles, +std::vector &ToCache) { + using namespace sys::fs; + + Optional buffer = readFile(path); + if (!buffer.hasValue()) +return; + MemoryBufferRef mbref = *buffer; + LoadedFiles.try_emplace(path, mbref); + + switch (identify_magic(mbref.getBuffer())) { + case file_magic::archive: { +for (const std::pair &p : + getArchiveMembers(mbref)) + if (identify_magic(p.first.getBuffer()) == file_magic::bitcode) +ToCache.push_back(p.first); +break; + } + + case file_magic::bitcode: +ToCache.push_back(mbref); +break; + default: +break; + } +} + void LinkerDriver::createFiles(opt::InputArgList &args) { // For --{push,pop}-state. std::vector> stack; + if (irSymTabCache) { +std::vector Files; +for (auto *arg : args) { + switch (arg->getOption().getID()) { + case OPT_library: +if (Optional path = searchLibrary(arg->getValue())) + Files.push_back(*path); +break; + case OPT_INPUT: +Files.push_back(arg->getValue()); +break; + } +} +irSymTabCache->upgrade(Files, addFileToIrSymTabCache); + } + // Iterate over argv to process input files and positional arguments. for (auto *arg : args) { switch (arg->getOption().getID()) { @@ -1755,6 +1812,11 @@ template void LinkerDriver::link(opt::InputArgList &args) { for (size_t i = 0; i < files.size(); ++i) parseFile(files[i]); + if (irSymTabCache) { +delete irSymTabCache; +irSymTabCache = nullptr; + } + // Now that we have every file, we can decide if we will need a // dynamic symbol table. // We need one if we were asked to export dynamic symbols or if we are diff --git a/lld/ELF/Driver.h b/lld/ELF/Driver.h index 3115e28d1669..a7ebf1e49eba 100644 --- a/lld/ELF/Driver.h +++ b/lld/ELF/Driver.h @@ -14,13 +14,25 @@ #include "lld/Common/LLVM.h" #include "lld/Common/Reproduce.h" #include "llvm/ADT/Optional.h" +#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" #include "llvm/Option/ArgList.h" #include "llvm/Support/raw_ostream.h" +namespace llvm { +namespace lto { + class IRSymtabFileCache; +} +} + namespace lld { +extern llvm::lto::IRSymtabFileCache *irSymTabCache; + namespace elf { +void addFileToIrSymTabCache(StringRef path, +llvm::StringMap &LoadedFiles, +std::vector &ToCache); extern class LinkerDriver *driver; diff --git