Skip to content

Commit 3082258

Browse files
authored
[CodeGen][X86] Use TargetLowering for TypeInfo of PointerTy (#93469)
This uses the TargetLowering getSimpleValueType mechanism to retrieve the ValueType info inside the X86 cost model. This resolves a build issue we were seeing for the miniQMC application after #92671.
1 parent 3ce9b86 commit 3082258

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

llvm/lib/Target/X86/X86TargetTransformInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6257,7 +6257,8 @@ InstructionCost X86TTIImpl::getInterleavedMemoryOpCostAVX512(
62576257
AddressSpace, CostKind);
62586258

62596259
unsigned VF = VecTy->getNumElements() / Factor;
6260-
MVT VT = MVT::getVectorVT(MVT::getVT(VecTy->getScalarType()), VF);
6260+
MVT VT =
6261+
MVT::getVectorVT(TLI->getSimpleValueType(DL, VecTy->getScalarType()), VF);
62616262

62626263
InstructionCost MaskCost;
62636264
if (UseMaskedMemOp) {
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --filter "LV: Found an estimated cost of [0-9] for VF [0-9] For instruction:\s*store ptr %[0-9], ptr %__last" --filter "LV: Found an estimated cost of [0-9] for VF [0-9] For instruction:\s*store ptr %[0-9]" --version 5
2+
; REQUIRES: asserts
3+
; RUN: opt -passes=loop-vectorize -debug-only=loop-vectorize -S < %s 2>&1 | FileCheck %s
4+
target triple = "x86_64-unknown-linux-gnu"
5+
6+
define ptr @foo(ptr %__first, ptr %__last) #0 {
7+
; CHECK-LABEL: 'foo'
8+
; CHECK: LV: Found an estimated cost of 1 for VF 1 For instruction: store ptr %0, ptr %__last, align 8
9+
; CHECK: LV: Found an estimated cost of 2 for VF 2 For instruction: store ptr %0, ptr %__last, align 8
10+
; CHECK: LV: Found an estimated cost of 3 for VF 4 For instruction: store ptr %0, ptr %__last, align 8
11+
; CHECK: LV: Found an estimated cost of 3 for VF 8 For instruction: store ptr %0, ptr %__last, align 8
12+
;
13+
entry:
14+
%cmp.not1 = icmp eq ptr %__first, %__last
15+
br i1 %cmp.not1, label %for.end, label %for.body.preheader
16+
17+
for.body.preheader:
18+
br label %for.body
19+
20+
for.body:
21+
%__first.addr.02 = phi ptr [ %incdec.ptr, %for.body ], [ %__first, %for.body.preheader ]
22+
%0 = load ptr, ptr %__first.addr.02, align 8
23+
store ptr %0, ptr %__last, align 8
24+
%incdec.ptr = getelementptr inbounds i8, ptr %__first.addr.02, i64 16
25+
%cmp.not = icmp eq ptr %incdec.ptr, %__last
26+
br i1 %cmp.not, label %for.end.loopexit, label %for.body
27+
28+
for.end.loopexit:
29+
br label %for.end
30+
31+
for.end:
32+
ret ptr null
33+
}
34+
35+
attributes #0 = { "target-cpu"="znver4" }

0 commit comments

Comments
 (0)