Skip to content

Commit fad4c27

Browse files
committed
[CostModel] Mark ssa_copy as free
These are intrinsics are only used ephemerally and be should be given a zero cost.
1 parent b003fed commit fad4c27

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ class TargetTransformInfoImplBase {
709709
case Intrinsic::coro_subfn_addr:
710710
case Intrinsic::threadlocal_address:
711711
case Intrinsic::experimental_widenable_condition:
712+
case Intrinsic::ssa_copy:
712713
// These intrinsics don't actually represent code after lowering.
713714
return 0;
714715
}

llvm/test/Analysis/CostModel/ARM/intrinsic-cost-kinds.ll

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,27 +341,27 @@ define void @memcpy(ptr %a, ptr %b, i32 %c) {
341341
define void @ssa_copy() {
342342
; CHECK: %{{.*}} = llvm.intr.ssa.copy %{{.*}} : f32
343343
; THRU-LABEL: 'ssa_copy'
344-
; THRU-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %i = call i32 @llvm.ssa.copy.i32(i32 undef)
345-
; THRU-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %f = call float @llvm.ssa.copy.f32(float undef)
346-
; THRU-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %p = call ptr @llvm.ssa.copy.p0(ptr undef)
344+
; THRU-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %i = call i32 @llvm.ssa.copy.i32(i32 undef)
345+
; THRU-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %f = call float @llvm.ssa.copy.f32(float undef)
346+
; THRU-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %p = call ptr @llvm.ssa.copy.p0(ptr undef)
347347
; THRU-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
348348
;
349349
; LATE-LABEL: 'ssa_copy'
350-
; LATE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %i = call i32 @llvm.ssa.copy.i32(i32 undef)
351-
; LATE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %f = call float @llvm.ssa.copy.f32(float undef)
352-
; LATE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %p = call ptr @llvm.ssa.copy.p0(ptr undef)
350+
; LATE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %i = call i32 @llvm.ssa.copy.i32(i32 undef)
351+
; LATE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %f = call float @llvm.ssa.copy.f32(float undef)
352+
; LATE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %p = call ptr @llvm.ssa.copy.p0(ptr undef)
353353
; LATE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
354354
;
355355
; SIZE-LABEL: 'ssa_copy'
356-
; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %i = call i32 @llvm.ssa.copy.i32(i32 undef)
357-
; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %f = call float @llvm.ssa.copy.f32(float undef)
358-
; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %p = call ptr @llvm.ssa.copy.p0(ptr undef)
356+
; SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %i = call i32 @llvm.ssa.copy.i32(i32 undef)
357+
; SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %f = call float @llvm.ssa.copy.f32(float undef)
358+
; SIZE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %p = call ptr @llvm.ssa.copy.p0(ptr undef)
359359
; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
360360
;
361361
; SIZE_LATE-LABEL: 'ssa_copy'
362-
; SIZE_LATE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %i = call i32 @llvm.ssa.copy.i32(i32 undef)
363-
; SIZE_LATE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %f = call float @llvm.ssa.copy.f32(float undef)
364-
; SIZE_LATE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %p = call ptr @llvm.ssa.copy.p0(ptr undef)
362+
; SIZE_LATE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %i = call i32 @llvm.ssa.copy.i32(i32 undef)
363+
; SIZE_LATE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %f = call float @llvm.ssa.copy.f32(float undef)
364+
; SIZE_LATE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %p = call ptr @llvm.ssa.copy.p0(ptr undef)
365365
; SIZE_LATE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void
366366
;
367367
%i = call i32 @llvm.ssa.copy.i32(i32 undef)

0 commit comments

Comments
 (0)