mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[InlineCost] Fix scalable vectors in visitAlloca
Discovered as part of the VLS type work (see D85128). Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D85848
This commit is contained in:
parent
42145d2b15
commit
ed95f77522
@ -867,7 +867,7 @@ bool CallAnalyzer::visitAlloca(AllocaInst &I) {
|
||||
// is needed to track stack usage during inlining.
|
||||
Type *Ty = I.getAllocatedType();
|
||||
AllocatedSize = SaturatingMultiplyAdd(
|
||||
AllocSize->getLimitedValue(), DL.getTypeAllocSize(Ty).getFixedSize(),
|
||||
AllocSize->getLimitedValue(), DL.getTypeAllocSize(Ty).getKnownMinSize(),
|
||||
AllocatedSize);
|
||||
if (AllocatedSize > InlineConstants::MaxSimplifiedDynamicAllocaToInline) {
|
||||
HasDynamicAlloca = true;
|
||||
@ -881,7 +881,7 @@ bool CallAnalyzer::visitAlloca(AllocaInst &I) {
|
||||
if (I.isStaticAlloca()) {
|
||||
Type *Ty = I.getAllocatedType();
|
||||
AllocatedSize =
|
||||
SaturatingAdd(DL.getTypeAllocSize(Ty).getFixedSize(), AllocatedSize);
|
||||
SaturatingAdd(DL.getTypeAllocSize(Ty).getKnownMinSize(), AllocatedSize);
|
||||
}
|
||||
|
||||
// We will happily inline static alloca instructions.
|
||||
|
11
test/Transforms/Inline/inline-scalable.ll
Normal file
11
test/Transforms/Inline/inline-scalable.ll
Normal file
@ -0,0 +1,11 @@
|
||||
; RUN: opt -S -inline < %s | FileCheck %s
|
||||
|
||||
define void @func() {
|
||||
; CHECK-LABEL: func
|
||||
; CHECK-NEXT: [[VEC_ADDR:%.*]] = alloca <vscale x 4 x i32>
|
||||
; CHECK-NEXT: call void @func()
|
||||
; CHECK-NEXT: ret void
|
||||
%vec.addr = alloca <vscale x 4 x i32>
|
||||
call void @func();
|
||||
ret void
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user