Skip to content

Commit 5a41800

Browse files
authored
[SROA] Fix NumPromoted statistic for SROA pass (#115586)
`NumPromoted` stat should not be increased if `SROASkipMem2Reg` is set and nothing is changed.
1 parent 9afec3c commit 5a41800

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5590,12 +5590,11 @@ bool SROA::promoteAllocas(Function &F) {
55905590
if (PromotableAllocas.empty())
55915591
return false;
55925592

5593-
NumPromoted += PromotableAllocas.size();
5594-
55955593
if (SROASkipMem2Reg) {
55965594
LLVM_DEBUG(dbgs() << "Not promoting allocas with mem2reg!\n");
55975595
} else {
55985596
LLVM_DEBUG(dbgs() << "Promoting allocas with mem2reg...\n");
5597+
NumPromoted += PromotableAllocas.size();
55995598
PromoteMemToReg(PromotableAllocas.getArrayRef(), DTU->getDomTree(), AC);
56005599
}
56015600

0 commit comments

Comments
 (0)