-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Newpm/expand large fp convert #71027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-llvm-transforms Author: Matt Arsenault (arsenm) ChangesDepends #71022 Full diff: https://github.com/llvm/llvm-project/pull/71027.diff 14 Files Affected:
diff --git a/llvm/include/llvm/CodeGen/ExpandLargeDivRem.h b/llvm/include/llvm/CodeGen/ExpandLargeDivRem.h
new file mode 100644
index 000000000000000..6fc44094925dcd9
--- /dev/null
+++ b/llvm/include/llvm/CodeGen/ExpandLargeDivRem.h
@@ -0,0 +1,30 @@
+//===- ExpandLargeDivRem.h --------------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_EXPANDLARGEDIVREM_H
+#define LLVM_CODEGEN_EXPANDLARGEDIVREM_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+class TargetMachine;
+
+class ExpandLargeDivRemPass : public PassInfoMixin<ExpandLargeDivRemPass> {
+private:
+ const TargetMachine *TM;
+
+public:
+ explicit ExpandLargeDivRemPass(const TargetMachine *TM_) : TM(TM_) {}
+
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
+
+} // end namespace llvm
+
+#endif // LLVM_CODEGEN_EXPANDLARGEDIVREM_H
diff --git a/llvm/include/llvm/CodeGen/ExpandLargeFpConvert.h b/llvm/include/llvm/CodeGen/ExpandLargeFpConvert.h
new file mode 100644
index 000000000000000..38d07d15c7d466a
--- /dev/null
+++ b/llvm/include/llvm/CodeGen/ExpandLargeFpConvert.h
@@ -0,0 +1,31 @@
+//===- ExpandLargeDivRem.h --------------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_EXPANDLARGEFPCONVERT_H
+#define LLVM_CODEGEN_EXPANDLARGEFPCONVERT_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+class TargetMachine;
+
+class ExpandLargeFpConvertPass
+ : public PassInfoMixin<ExpandLargeFpConvertPass> {
+private:
+ const TargetMachine *TM;
+
+public:
+ explicit ExpandLargeFpConvertPass(const TargetMachine *TM_) : TM(TM_) {}
+
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
+
+} // end namespace llvm
+
+#endif // LLVM_CODEGEN_EXPANDLARGEFPCONVERT_H
diff --git a/llvm/lib/CodeGen/ExpandLargeDivRem.cpp b/llvm/lib/CodeGen/ExpandLargeDivRem.cpp
index 057b5311db70eeb..e5f538e19a61a98 100644
--- a/llvm/lib/CodeGen/ExpandLargeDivRem.cpp
+++ b/llvm/lib/CodeGen/ExpandLargeDivRem.cpp
@@ -14,6 +14,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/CodeGen/ExpandLargeDivRem.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/GlobalsModRef.h"
@@ -128,6 +129,13 @@ class ExpandLargeDivRemLegacyPass : public FunctionPass {
};
} // namespace
+PreservedAnalyses ExpandLargeDivRemPass::run(Function &F,
+ FunctionAnalysisManager &FAM) {
+ const TargetSubtargetInfo *STI = TM->getSubtargetImpl(F);
+ PreservedAnalyses PA = PreservedAnalyses::none();
+ return runImpl(F, *STI->getTargetLowering()) ? PA : PreservedAnalyses::all();
+}
+
char ExpandLargeDivRemLegacyPass::ID = 0;
INITIALIZE_PASS_BEGIN(ExpandLargeDivRemLegacyPass, "expand-large-div-rem",
"Expand large div/rem", false, false)
diff --git a/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp b/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp
index ca8056a53139721..c7d3f3939866656 100644
--- a/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp
+++ b/llvm/lib/CodeGen/ExpandLargeFpConvert.cpp
@@ -14,6 +14,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/CodeGen/ExpandLargeFpConvert.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/GlobalsModRef.h"
@@ -653,6 +654,13 @@ class ExpandLargeFpConvertLegacyPass : public FunctionPass {
};
} // namespace
+PreservedAnalyses ExpandLargeFpConvertPass::run(Function &F,
+ FunctionAnalysisManager &FAM) {
+ const TargetSubtargetInfo *STI = TM->getSubtargetImpl(F);
+ PreservedAnalyses PA = PreservedAnalyses::none();
+ return runImpl(F, *STI->getTargetLowering()) ? PA : PreservedAnalyses::all();
+}
+
char ExpandLargeFpConvertLegacyPass::ID = 0;
INITIALIZE_PASS_BEGIN(ExpandLargeFpConvertLegacyPass, "expand-large-fp-convert",
"Expand large fp convert", false, false)
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index fde759026e5d780..0d7cac19d44c3a8 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -72,6 +72,8 @@
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
#include "llvm/Analysis/UniformityAnalysis.h"
+#include "llvm/CodeGen/ExpandLargeDivRem.h"
+#include "llvm/CodeGen/ExpandLargeFpConvert.h"
#include "llvm/CodeGen/HardwareLoops.h"
#include "llvm/CodeGen/TypePromotion.h"
#include "llvm/IR/DebugInfo.h"
@@ -234,8 +236,8 @@
#include "llvm/Transforms/Utils/CanonicalizeAliases.h"
#include "llvm/Transforms/Utils/CanonicalizeFreezeInLoops.h"
#include "llvm/Transforms/Utils/CountVisits.h"
-#include "llvm/Transforms/Utils/Debugify.h"
#include "llvm/Transforms/Utils/DXILUpgrade.h"
+#include "llvm/Transforms/Utils/Debugify.h"
#include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
#include "llvm/Transforms/Utils/FixIrreducible.h"
#include "llvm/Transforms/Utils/HelloWorld.h"
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 91782d661ddd7b7..eb51ccef68c827d 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -445,6 +445,8 @@ FUNCTION_PASS("transform-warning", WarnMissedTransformationsPass())
FUNCTION_PASS("tsan", ThreadSanitizerPass())
FUNCTION_PASS("memprof", MemProfilerPass())
FUNCTION_PASS("declare-to-assign", llvm::AssignmentTrackingPass())
+FUNCTION_PASS("expand-large-div-rem", ExpandLargeDivRemPass(TM));
+FUNCTION_PASS("expand-large-fp-convert", ExpandLargeFpConvertPass(TM));
#undef FUNCTION_PASS
#ifndef FUNCTION_PASS_WITH_PARAMS
diff --git a/llvm/test/CodeGen/X86/expand-large-fp-convert-fptosi129.ll b/llvm/test/CodeGen/X86/expand-large-fp-convert-fptosi129.ll
index ff460c155c5dba0..77bbd5f0bb4258b 100644
--- a/llvm/test/CodeGen/X86/expand-large-fp-convert-fptosi129.ll
+++ b/llvm/test/CodeGen/X86/expand-large-fp-convert-fptosi129.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=x86_64-- -expand-large-fp-convert < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-- -passes=expand-large-fp-convert < %s | FileCheck %s
define i129 @halftosi129(half %a) {
; CHECK-LABEL: @halftosi129(
diff --git a/llvm/test/CodeGen/X86/expand-large-fp-convert-fptoui129.ll b/llvm/test/CodeGen/X86/expand-large-fp-convert-fptoui129.ll
index 48c39bbff007b48..67d9eb533a3e7b4 100644
--- a/llvm/test/CodeGen/X86/expand-large-fp-convert-fptoui129.ll
+++ b/llvm/test/CodeGen/X86/expand-large-fp-convert-fptoui129.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=x86_64-- -expand-large-fp-convert < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-- -passes=expand-large-fp-convert < %s | FileCheck %s
define i129 @halftoui129(half %a) {
; CHECK-LABEL: @halftoui129(
diff --git a/llvm/test/CodeGen/X86/expand-large-fp-convert-si129tofp.ll b/llvm/test/CodeGen/X86/expand-large-fp-convert-si129tofp.ll
index d68126a39ad24c9..3961fec5b3be188 100644
--- a/llvm/test/CodeGen/X86/expand-large-fp-convert-si129tofp.ll
+++ b/llvm/test/CodeGen/X86/expand-large-fp-convert-si129tofp.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=x86_64-- -expand-large-fp-convert < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-- -passes=expand-large-fp-convert < %s | FileCheck %s
define half @si129tohalf(i129 %a) {
; CHECK-LABEL: @si129tohalf(
diff --git a/llvm/test/CodeGen/X86/expand-large-fp-convert-ui129tofp.ll b/llvm/test/CodeGen/X86/expand-large-fp-convert-ui129tofp.ll
index f7ff2172ea28b6e..e05ff198ecc33b8 100644
--- a/llvm/test/CodeGen/X86/expand-large-fp-convert-ui129tofp.ll
+++ b/llvm/test/CodeGen/X86/expand-large-fp-convert-ui129tofp.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=x86_64-- -expand-large-fp-convert < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-- -passes=expand-large-fp-convert < %s | FileCheck %s
define half @ui129tohalf(i129 %a) {
; CHECK-LABEL: @ui129tohalf(
diff --git a/llvm/test/Transforms/ExpandLargeDivRem/X86/sdiv129.ll b/llvm/test/Transforms/ExpandLargeDivRem/X86/sdiv129.ll
index 61c8f8863489812..184a420af1456d2 100644
--- a/llvm/test/Transforms/ExpandLargeDivRem/X86/sdiv129.ll
+++ b/llvm/test/Transforms/ExpandLargeDivRem/X86/sdiv129.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=x86_64-- -expand-large-div-rem -expand-div-rem-bits 128 < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-- -passes=expand-large-div-rem -expand-div-rem-bits 128 < %s | FileCheck %s
define void @sdiv129(ptr %ptr, ptr %out) nounwind {
; CHECK-LABEL: @sdiv129(
diff --git a/llvm/test/Transforms/ExpandLargeDivRem/X86/srem129.ll b/llvm/test/Transforms/ExpandLargeDivRem/X86/srem129.ll
index eddb2095c40f582..ce428dd895482a4 100644
--- a/llvm/test/Transforms/ExpandLargeDivRem/X86/srem129.ll
+++ b/llvm/test/Transforms/ExpandLargeDivRem/X86/srem129.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=x86_64-- -expand-large-div-rem -expand-div-rem-bits 128 < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-- -passes=expand-large-div-rem -expand-div-rem-bits 128 < %s | FileCheck %s
define void @test(ptr %ptr, ptr %out) nounwind {
; CHECK-LABEL: @test(
diff --git a/llvm/test/Transforms/ExpandLargeDivRem/X86/udiv129.ll b/llvm/test/Transforms/ExpandLargeDivRem/X86/udiv129.ll
index 78bce5c398cadfc..bc2d39d5a32781d 100644
--- a/llvm/test/Transforms/ExpandLargeDivRem/X86/udiv129.ll
+++ b/llvm/test/Transforms/ExpandLargeDivRem/X86/udiv129.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=x86_64-- -expand-large-div-rem -expand-div-rem-bits 128 < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-- -passes=expand-large-div-rem -expand-div-rem-bits 128 < %s | FileCheck %s
define void @test(ptr %ptr, ptr %out) nounwind {
; CHECK-LABEL: @test(
diff --git a/llvm/test/Transforms/ExpandLargeDivRem/X86/urem129.ll b/llvm/test/Transforms/ExpandLargeDivRem/X86/urem129.ll
index ebe75fcf23c4bcf..6e2f5b8d80e8c10 100644
--- a/llvm/test/Transforms/ExpandLargeDivRem/X86/urem129.ll
+++ b/llvm/test/Transforms/ExpandLargeDivRem/X86/urem129.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=x86_64-- -expand-large-div-rem -expand-div-rem-bits 128 < %s | FileCheck %s
+; RUN: opt -S -mtriple=x86_64-- -passes=expand-large-div-rem -expand-div-rem-bits 128 < %s | FileCheck %s
define void @test(ptr %ptr, ptr %out) nounwind {
; CHECK-LABEL: @test(
|
8b8766c
to
556553f
Compare
@@ -0,0 +1,31 @@ | |||
//===- ExpandLargeDivRem.h --------------------------------------*- C++ -*-===// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy + paste?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wish we could just get rid of all these comments, the only time they're noticed is for copy paste new files like this
PreservedAnalyses ExpandLargeFpConvertPass::run(Function &F, | ||
FunctionAnalysisManager &FAM) { | ||
const TargetSubtargetInfo *STI = TM->getSubtargetImpl(F); | ||
PreservedAnalyses PA = PreservedAnalyses::none(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just inline this (ditto in the other file too)
6ff9896
to
b87d840
Compare
Manually pushed squash with fixed commit message in 3cef582. Not sure what the best solution was, with the stack commit it has a messed up title and comment |
Depends #71022