[llvm] 5a41800 - [SROA] Fix NumPromoted statistic for SROA pass (#115586)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 9 01:09:02 PST 2024
Author: Afanasyev Ivan
Date: 2024-11-09T10:08:58+01:00
New Revision: 5a41800ea1d9bf382cf1039da6016550ddb072d7
URL: https://github.com/llvm/llvm-project/commit/5a41800ea1d9bf382cf1039da6016550ddb072d7
DIFF: https://github.com/llvm/llvm-project/commit/5a41800ea1d9bf382cf1039da6016550ddb072d7.diff
LOG: [SROA] Fix NumPromoted statistic for SROA pass (#115586)
`NumPromoted` stat should not be increased if `SROASkipMem2Reg` is set
and nothing is changed.
Added:
Modified:
llvm/lib/Transforms/Scalar/SROA.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 3b01089962e29c..4a23e2bee5ba25 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -5590,12 +5590,11 @@ bool SROA::promoteAllocas(Function &F) {
if (PromotableAllocas.empty())
return false;
- NumPromoted += PromotableAllocas.size();
-
if (SROASkipMem2Reg) {
LLVM_DEBUG(dbgs() << "Not promoting allocas with mem2reg!\n");
} else {
LLVM_DEBUG(dbgs() << "Promoting allocas with mem2reg...\n");
+ NumPromoted += PromotableAllocas.size();
PromoteMemToReg(PromotableAllocas.getArrayRef(), DTU->getDomTree(), AC);
}
More information about the llvm-commits
mailing list