[llvm] Revert "[WebAssembly] Mark extract.last.active as having invalid cost." (PR #180942)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 12 08:49:37 PST 2026
https://github.com/MacDue updated https://github.com/llvm/llvm-project/pull/180942
>From 045b1c65063175e0f6d017152d554f937b8d3855 Mon Sep 17 00:00:00 2001
From: Benjamin Maxwell <benjamin.maxwell at arm.com>
Date: Wed, 11 Feb 2026 13:28:11 +0000
Subject: [PATCH 1/2] Revert "[WebAssembly] Mark extract.last.active as having
invalid cost."
The failures should have been resolved with #180290 (which also added
WebAssembly tests).
This reverts commit 811fb223af2b3e2d68c99b346f4b75dcf3de3417.
---
.../WebAssembly/WebAssemblyTargetTransformInfo.cpp | 13 -------------
.../WebAssembly/WebAssemblyTargetTransformInfo.h | 4 ----
2 files changed, 17 deletions(-)
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
index 33498805112c0..f058d734bcb87 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp
@@ -453,19 +453,6 @@ InstructionCost WebAssemblyTTIImpl::getPartialReductionCost(
return Invalid;
}
-InstructionCost
-WebAssemblyTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
- TTI::TargetCostKind CostKind) const {
- switch (ICA.getID()) {
- case Intrinsic::experimental_vector_extract_last_active:
- // TODO: Remove once the intrinsic can be lowered without crashes.
- return InstructionCost::getInvalid();
- default:
- break;
- }
- return BaseT::getIntrinsicInstrCost(ICA, CostKind);
-}
-
TTI::ReductionShuffle WebAssemblyTTIImpl::getPreferredExpandedReductionShuffle(
const IntrinsicInst *II) const {
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
index 924249e051321..9b6de65f17c7f 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h
@@ -98,10 +98,6 @@ class WebAssemblyTTIImpl final : public BasicTTIImplBase<WebAssemblyTTIImpl> {
TTI::TargetCostKind CostKind,
std::optional<FastMathFlags> FMF) const override;
- InstructionCost
- getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
- TTI::TargetCostKind CostKind) const override;
-
TTI::ReductionShuffle
getPreferredExpandedReductionShuffle(const IntrinsicInst *II) const override;
>From 1e5a4fa0505e635e3b1dce489ce3bec2b3af1661 Mon Sep 17 00:00:00 2001
From: Benjamin Maxwell <benjamin.maxwell at arm.com>
Date: Thu, 12 Feb 2026 16:47:59 +0000
Subject: [PATCH 2/2] Add CostModel test
---
.../WebAssembly/extract-last-active.ll | 26 +++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 llvm/test/Analysis/CostModel/WebAssembly/extract-last-active.ll
diff --git a/llvm/test/Analysis/CostModel/WebAssembly/extract-last-active.ll b/llvm/test/Analysis/CostModel/WebAssembly/extract-last-active.ll
new file mode 100644
index 0000000000000..1feb9bae2de7a
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/WebAssembly/extract-last-active.ll
@@ -0,0 +1,26 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
+; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -S -mtriple=wasm32-unknown-unknown | FileCheck %s
+
+define void @extractions() {
+; CHECK-LABEL: 'extractions'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: %v16i8 = call i8 @llvm.experimental.vector.extract.last.active.v16i8(<16 x i8> poison, <16 x i1> poison, i8 poison)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %v8i16 = call i16 @llvm.experimental.vector.extract.last.active.v8i16(<8 x i16> poison, <8 x i1> poison, i16 poison)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %v4i32 = call i32 @llvm.experimental.vector.extract.last.active.v4i32(<4 x i32> poison, <4 x i1> poison, i32 poison)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v2i64 = call i64 @llvm.experimental.vector.extract.last.active.v2i64(<2 x i64> poison, <2 x i1> poison, i64 poison)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %v8f16 = call half @llvm.experimental.vector.extract.last.active.v8f16(<8 x half> poison, <8 x i1> poison, half poison)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %v8bf16 = call bfloat @llvm.experimental.vector.extract.last.active.v8bf16(<8 x bfloat> poison, <8 x i1> poison, bfloat poison)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %v4f32 = call float @llvm.experimental.vector.extract.last.active.v4f32(<4 x float> poison, <4 x i1> poison, float poison)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %v2f64 = call double @llvm.experimental.vector.extract.last.active.v2f64(<2 x double> poison, <2 x i1> poison, double poison)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
+;
+ %v16i8 = call i8 @llvm.experimental.vector.extract.last.active.v16i8(<16 x i8> poison, <16 x i1> poison, i8 poison)
+ %v8i16 = call i16 @llvm.experimental.vector.extract.last.active.v8i16(<8 x i16> poison, <8 x i1> poison, i16 poison)
+ %v4i32 = call i32 @llvm.experimental.vector.extract.last.active.v4i32(<4 x i32> poison, <4 x i1> poison, i32 poison)
+ %v2i64 = call i64 @llvm.experimental.vector.extract.last.active.v2i64(<2 x i64> poison, <2 x i1> poison, i64 poison)
+ %v8f16 = call half @llvm.experimental.vector.extract.last.active.v8f16(<8 x half> poison, <8 x i1> poison, half poison)
+ %v8bf16 = call bfloat @llvm.experimental.vector.extract.last.active.v8bf16(<8 x bfloat> poison, <8 x i1> poison, bfloat poison)
+ %v4f32 = call float @llvm.experimental.vector.extract.last.active.v4f32(<4 x float> poison, <4 x i1> poison, float poison)
+ %v2f64 = call double @llvm.experimental.vector.extract.last.active.v2f64(<2 x double> poison, <2 x i1> poison, double poison)
+
+ ret void
+}
More information about the llvm-commits
mailing list