[PATCH] D58589: [ConstantHoisting] Inline releaseMemory() into ConstantHoistingPass::runImpl to avoid dangling elements in ConstIntInfoVec for new PM
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 25 18:31:35 PST 2019
MaskRay updated this revision to Diff 188293.
MaskRay marked an inline comment as done.
MaskRay retitled this revision from "[ConstantHoisting] Call releaseMemory() to avoid dangling elements in ConstIntInfoVec" to "[ConstantHoisting] Inline releaseMemory() into ConstantHoistingPass::runImpl to avoid dangling elements in ConstIntInfoVec for new PM".
MaskRay edited the summary of this revision.
MaskRay added a comment.
Update title
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58589/new/
https://reviews.llvm.org/D58589
Files:
include/llvm/Transforms/Scalar/ConstantHoisting.h
lib/Transforms/Scalar/ConstantHoisting.cpp
test/Transforms/ConstantHoisting/X86/phi.ll
Index: test/Transforms/ConstantHoisting/X86/phi.ll
===================================================================
--- test/Transforms/ConstantHoisting/X86/phi.ll
+++ test/Transforms/ConstantHoisting/X86/phi.ll
@@ -1,4 +1,5 @@
; RUN: opt -S -consthoist < %s | FileCheck %s
+; RUN: opt -S -passes=consthoist < %s | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0"
Index: lib/Transforms/Scalar/ConstantHoisting.cpp
===================================================================
--- lib/Transforms/Scalar/ConstantHoisting.cpp
+++ lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -114,8 +114,6 @@
AU.addRequired<TargetTransformInfoWrapperPass>();
}
- void releaseMemory() override { Impl.releaseMemory(); }
-
private:
ConstantHoistingPass Impl;
};
@@ -947,6 +945,16 @@
// Cleanup dead instructions.
deleteDeadCastInst();
+ ClonedCastMap.clear();
+ ConstIntCandVec.clear();
+ for (auto MapEntry : ConstGEPCandMap)
+ MapEntry.second.clear();
+ ConstGEPCandMap.clear();
+ ConstIntInfoVec.clear();
+ for (auto MapEntry : ConstGEPInfoMap)
+ MapEntry.second.clear();
+ ConstGEPInfoMap.clear();
+
return MadeChange;
}
Index: include/llvm/Transforms/Scalar/ConstantHoisting.h
===================================================================
--- include/llvm/Transforms/Scalar/ConstantHoisting.h
+++ include/llvm/Transforms/Scalar/ConstantHoisting.h
@@ -126,18 +126,6 @@
bool runImpl(Function &F, TargetTransformInfo &TTI, DominatorTree &DT,
BlockFrequencyInfo *BFI, BasicBlock &Entry);
- void releaseMemory() {
- ClonedCastMap.clear();
- ConstIntCandVec.clear();
- for (auto MapEntry : ConstGEPCandMap)
- MapEntry.second.clear();
- ConstGEPCandMap.clear();
- ConstIntInfoVec.clear();
- for (auto MapEntry : ConstGEPInfoMap)
- MapEntry.second.clear();
- ConstGEPInfoMap.clear();
- }
-
private:
using ConstPtrUnionType = PointerUnion<ConstantInt *, ConstantExpr *>;
using ConstCandMapType = DenseMap<ConstPtrUnionType, unsigned>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58589.188293.patch
Type: text/x-patch
Size: 2102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190226/d4ecb95e/attachment.bin>
More information about the llvm-commits
mailing list