From 53001f2ad96bb65423345a5674123328be675f1c Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Thu, 27 Jun 2024 17:16:38 -0700 Subject: [PATCH 1/2] [NFC] Move FPBuiltinFnSelection pass to Transforms This moves the FPBuiltinFnSelection pass to the llvm/lib/Transforms/Scalar directory. This is needed to enable future changes that will run this pass as part of the main pipeline for device compilation. With this pass in CodeGen, the slibs build would fail. --- llvm/include/llvm/Passes/CodeGenPassBuilder.h | 2 +- .../{CodeGen => Transforms/Scalar}/FPBuiltinFnSelection.h | 8 ++++---- llvm/lib/CodeGen/CMakeLists.txt | 1 - llvm/lib/Transforms/Scalar/CMakeLists.txt | 1 + .../Scalar}/FPBuiltinFnSelection.cpp | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) rename llvm/include/llvm/{CodeGen => Transforms/Scalar}/FPBuiltinFnSelection.h (74%) rename llvm/lib/{CodeGen => Transforms/Scalar}/FPBuiltinFnSelection.cpp (98%) diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h index 12f99f4d5a2ae..f140359f729ab 100644 --- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h +++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h @@ -29,7 +29,6 @@ #include "llvm/CodeGen/DwarfEHPrepare.h" #include "llvm/CodeGen/ExpandMemCmp.h" #include "llvm/CodeGen/ExpandReductions.h" -#include "llvm/CodeGen/FPBuiltinFnSelection.h" #include "llvm/CodeGen/GCMetadata.h" #include "llvm/CodeGen/GlobalMerge.h" #include "llvm/CodeGen/IndirectBrExpand.h" @@ -65,6 +64,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Transforms/CFGuard.h" #include "llvm/Transforms/Scalar/ConstantHoisting.h" +#include "llvm/Transforms/Scalar/FPBuiltinFnSelection.h" #include "llvm/Transforms/Scalar/LoopPassManager.h" #include "llvm/Transforms/Scalar/LoopStrengthReduce.h" #include "llvm/Transforms/Scalar/LowerConstantIntrinsics.h" diff --git a/llvm/include/llvm/CodeGen/FPBuiltinFnSelection.h b/llvm/include/llvm/Transforms/Scalar/FPBuiltinFnSelection.h similarity index 74% rename from llvm/include/llvm/CodeGen/FPBuiltinFnSelection.h rename to llvm/include/llvm/Transforms/Scalar/FPBuiltinFnSelection.h index 9a27dbe3da38f..228137cb38a75 100644 --- a/llvm/include/llvm/CodeGen/FPBuiltinFnSelection.h +++ b/llvm/include/llvm/Transforms/Scalar/FPBuiltinFnSelection.h @@ -1,4 +1,4 @@ -//===- FPBuiltinFnSelection.h - Pre-ISel intrinsic lowering pass ----------===// +//===- FPBuiltinFnSelection.h - fpbuiltin intrinsic lowering pass ---------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,8 +10,8 @@ // llvm.fpbuiltin.* intrinsics. // //===----------------------------------------------------------------------===// -#ifndef LLVM_CODEGEN_FPBUILTINFNSELECTION_H -#define LLVM_CODEGEN_FPBUILTINFNSELECTION_H +#ifndef LLVM_TRANSFORMS_SCALAR_FPBUILTINFNSELECTION_H +#define LLVM_TRANSFORMS_SCALAR_FPBUILTINFNSELECTION_H #include "llvm/IR/PassManager.h" @@ -25,4 +25,4 @@ struct FPBuiltinFnSelectionPass : PassInfoMixin { } // end namespace llvm -#endif // LLVM_CODEGEN_FPBUILTINFNSELECTION_H +#endif // LLVM_TRANSFORMS_SCALAR_FPBUILTINFNSELECTION_H diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt index 2658b70309674..77bf1b165d0cf 100644 --- a/llvm/lib/CodeGen/CMakeLists.txt +++ b/llvm/lib/CodeGen/CMakeLists.txt @@ -63,7 +63,6 @@ add_llvm_component_library(LLVMCodeGen ExpandVectorPredication.cpp FaultMaps.cpp FEntryInserter.cpp - FPBuiltinFnSelection.cpp FinalizeISel.cpp FixupStatepointCallerSaved.cpp FuncletLayout.cpp diff --git a/llvm/lib/Transforms/Scalar/CMakeLists.txt b/llvm/lib/Transforms/Scalar/CMakeLists.txt index ba09ebf8b04c4..079926a65b10c 100644 --- a/llvm/lib/Transforms/Scalar/CMakeLists.txt +++ b/llvm/lib/Transforms/Scalar/CMakeLists.txt @@ -14,6 +14,7 @@ add_llvm_component_library(LLVMScalarOpts EarlyCSE.cpp FlattenCFGPass.cpp Float2Int.cpp + FPBuiltinFnSelection.cpp GuardWidening.cpp GVN.cpp GVNHoist.cpp diff --git a/llvm/lib/CodeGen/FPBuiltinFnSelection.cpp b/llvm/lib/Transforms/Scalar/FPBuiltinFnSelection.cpp similarity index 98% rename from llvm/lib/CodeGen/FPBuiltinFnSelection.cpp rename to llvm/lib/Transforms/Scalar/FPBuiltinFnSelection.cpp index a4b6a34a2326a..b142a68037924 100644 --- a/llvm/lib/CodeGen/FPBuiltinFnSelection.cpp +++ b/llvm/lib/Transforms/Scalar/FPBuiltinFnSelection.cpp @@ -1,4 +1,4 @@ -//===- FPBuiltinFnSelection.cpp - Pre-ISel intrinsic lowering pass --------===// +//===- FPBuiltinFnSelection.cpp - fpbuiltin intrinsic lowering pass -------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,7 +11,6 @@ // //===----------------------------------------------------------------------===// -#include "llvm/CodeGen/FPBuiltinFnSelection.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/CodeGen/Passes.h" @@ -20,6 +19,7 @@ #include "llvm/IR/IntrinsicInst.h" #include "llvm/InitializePasses.h" #include "llvm/Support/FormatVariadic.h" +#include "llvm/Transforms/Scalar/FPBuiltinFnSelection.h" using namespace llvm; From 8aac45d0ab1ea7775e618915bcfe500a58a6c8e8 Mon Sep 17 00:00:00 2001 From: Andy Kaylor Date: Mon, 1 Jul 2024 15:25:20 -0700 Subject: [PATCH 2/2] Fix minor include order issue --- llvm/lib/Transforms/Scalar/FPBuiltinFnSelection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Scalar/FPBuiltinFnSelection.cpp b/llvm/lib/Transforms/Scalar/FPBuiltinFnSelection.cpp index b142a68037924..dd423b42ab0ec 100644 --- a/llvm/lib/Transforms/Scalar/FPBuiltinFnSelection.cpp +++ b/llvm/lib/Transforms/Scalar/FPBuiltinFnSelection.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Transforms/Scalar/FPBuiltinFnSelection.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/CodeGen/Passes.h" @@ -19,7 +20,6 @@ #include "llvm/IR/IntrinsicInst.h" #include "llvm/InitializePasses.h" #include "llvm/Support/FormatVariadic.h" -#include "llvm/Transforms/Scalar/FPBuiltinFnSelection.h" using namespace llvm;