summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2016-02-10 17:39:43 +0000
committerDaniel Berlin <dberlin@dberlin.org>2016-02-10 17:39:43 +0000
commit932b4cbf5d4b629c2796aeb9460b988a555a85e0 (patch)
tree7501d4c592ddff9105b00a4354d0ae0be7d7ffbe /llvm/lib/Transforms
parent0e3f954898bb0d44313178508f4d74dbb6864890 (diff)
downloadbcm5719-llvm-932b4cbf5d4b629c2796aeb9460b988a555a85e0.tar.gz
bcm5719-llvm-932b4cbf5d4b629c2796aeb9460b988a555a85e0.zip
Constify two functions, make them accessible to unit tests
llvm-svn: 260387
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/MemorySSA.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/MemorySSA.cpp b/llvm/lib/Transforms/Utils/MemorySSA.cpp
index 54133f0df93..faa25b5ade8 100644
--- a/llvm/lib/Transforms/Utils/MemorySSA.cpp
+++ b/llvm/lib/Transforms/Utils/MemorySSA.cpp
@@ -439,9 +439,14 @@ void MemorySSA::dump() const {
F.print(dbgs(), &Writer);
}
+void MemorySSA::verifyMemorySSA() const {
+ verifyDefUses(F);
+ verifyDomination(F);
+}
+
/// \brief Verify the domination properties of MemorySSA by checking that each
/// definition dominates all of its uses.
-void MemorySSA::verifyDomination(Function &F) {
+void MemorySSA::verifyDomination(Function &F) const {
for (BasicBlock &B : F) {
// Phi nodes are attached to basic blocks
if (MemoryPhi *MP = getMemoryAccess(&B)) {
@@ -496,7 +501,7 @@ void MemorySSA::verifyDomination(Function &F) {
/// llvm_unreachable is used instead of asserts because this may be called in
/// a build without asserts. In that case, we don't want this to turn into a
/// nop.
-void MemorySSA::verifyUseInDefs(MemoryAccess *Def, MemoryAccess *Use) {
+void MemorySSA::verifyUseInDefs(MemoryAccess *Def, MemoryAccess *Use) const {
// The live on entry use may cause us to get a NULL def here
if (!Def) {
if (!isLiveOnEntryDef(Use))
@@ -510,7 +515,7 @@ void MemorySSA::verifyUseInDefs(MemoryAccess *Def, MemoryAccess *Use) {
/// \brief Verify the immediate use information, by walking all the memory
/// accesses and verifying that, for each use, it appears in the
/// appropriate def's use list
-void MemorySSA::verifyDefUses(Function &F) {
+void MemorySSA::verifyDefUses(Function &F) const {
for (BasicBlock &B : F) {
// Phi nodes are attached to basic blocks
if (MemoryPhi *Phi = getMemoryAccess(&B))
@@ -655,8 +660,7 @@ bool MemorySSAPrinterPass::runOnFunction(Function &F) {
Walker.reset(MSSA->buildMemorySSA(AA, DT));
if (VerifyMemorySSA) {
- MSSA->verifyDefUses(F);
- MSSA->verifyDomination(F);
+ MSSA->verifyMemorySSA();
}
return false;
OpenPOWER on IntegriCloud