1
0
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:
Cullen Rhodes 2020-08-12 18:03:46 +00:00
parent 42145d2b15
commit ed95f77522
2 changed files with 13 additions and 2 deletions

View File

@ -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.

View 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
}