[llvm] 7faed5c - [X86][AMX] Let Store not be removed if combineCastStore failed
Bing1 Yu via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 19 00:21:04 PDT 2023
Author: Bing1 Yu
Date: 2023-06-19T15:20:55+08:00
New Revision: 7faed5c49ca1809e07601894435e243e91ea8808
URL: https://github.com/llvm/llvm-project/commit/7faed5c49ca1809e07601894435e243e91ea8808
DIFF: https://github.com/llvm/llvm-project/commit/7faed5c49ca1809e07601894435e243e91ea8808.diff
LOG: [X86][AMX] Let Store not be removed if combineCastStore failed
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D152819
Added:
Modified:
llvm/lib/Target/X86/X86LowerAMXType.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86LowerAMXType.cpp b/llvm/lib/Target/X86/X86LowerAMXType.cpp
index 6966ee4b6fbe5..fa9d367cf7628 100644
--- a/llvm/lib/Target/X86/X86LowerAMXType.cpp
+++ b/llvm/lib/Target/X86/X86LowerAMXType.cpp
@@ -709,7 +709,7 @@ class X86LowerAMXCast {
public:
X86LowerAMXCast(Function &F) : Func(F), DT(nullptr) {}
- void combineCastStore(IntrinsicInst *Cast, StoreInst *ST);
+ bool combineCastStore(IntrinsicInst *Cast, StoreInst *ST);
bool combineLoadCast(IntrinsicInst *Cast, LoadInst *LD);
bool combineLdSt(SmallVectorImpl<Instruction *> &Casts);
bool combineAMXcast(TargetLibraryInfo *TLI);
@@ -922,12 +922,12 @@ bool X86LowerAMXCast::optimizeAMXCastFromPhi(
// -->
// call void @llvm.x86.tilestored64.internal(i16 %row, i16 %col, i8* %p,
// i64 64, x86_amx %42)
-void X86LowerAMXCast::combineCastStore(IntrinsicInst *Cast, StoreInst *ST) {
+bool X86LowerAMXCast::combineCastStore(IntrinsicInst *Cast, StoreInst *ST) {
Value *Tile = Cast->getOperand(0);
// TODO: If it is cast intrinsic or phi node, we can propagate the
// shape information through def-use chain.
if (!isAMXIntrinsic(Tile))
- return;
+ return false;
auto *II = cast<IntrinsicInst>(Tile);
// Tile is output from AMX intrinsic. The first operand of the
// intrinsic is row, the second operand of the intrinsic is column.
@@ -942,6 +942,7 @@ void X86LowerAMXCast::combineCastStore(IntrinsicInst *Cast, StoreInst *ST) {
std::array<Value *, 5> Args = {Row, Col, I8Ptr, Stride, Tile};
Builder.CreateIntrinsic(Intrinsic::x86_tilestored64_internal, std::nullopt,
Args);
+ return true;
}
// %65 = load <256 x i32>, <256 x i32>* %p, align 64
@@ -1006,9 +1007,10 @@ bool X86LowerAMXCast::combineLdSt(SmallVectorImpl<Instruction *> &Casts) {
StoreInst *Store = dyn_cast<StoreInst>(U);
if (!Store)
continue;
- combineCastStore(cast<IntrinsicInst>(Cast), Store);
- DeadStores.push_back(Store);
- Change = true;
+ if (combineCastStore(cast<IntrinsicInst>(Cast), Store)) {
+ DeadStores.push_back(Store);
+ Change = true;
+ }
}
for (auto *Store : DeadStores)
Store->eraseFromParent();
More information about the llvm-commits
mailing list