diff options
author | Richard Trieu <rtrieu@google.com> | 2014-06-09 22:53:16 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2014-06-09 22:53:16 +0000 |
commit | a23043cb9c1ef021a9cf05cd62cce76cd03c0ba2 (patch) | |
tree | 65eda585bf8ca912429cd6c56f02c614337aa6a2 /llvm/lib/Analysis | |
parent | d3d017cf00714c7d376a3cf87d2a17002e12cac7 (diff) | |
download | bcm5719-llvm-a23043cb9c1ef021a9cf05cd62cce76cd03c0ba2.tar.gz bcm5719-llvm-a23043cb9c1ef021a9cf05cd62cce76cd03c0ba2.zip |
Removing an "if (!this)" check from two print methods. The condition will
never be true in a well-defined context. The checking for null pointers
has been moved into the caller logic so it does not rely on undefined behavior.
llvm-svn: 210497
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Analysis/IVUsers.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/Analysis/LoopPass.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/Analysis/RegionPass.cpp | 4 |
4 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp index bfab744d479..0d9d0ef842c 100644 --- a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -602,8 +602,10 @@ namespace { bool runOnSCC(CallGraphSCC &SCC) override { Out << Banner; - for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) + for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) { + assert((*I)->getFunction() && "Expecting non-null Function"); (*I)->getFunction()->print(Out); + } return false; } }; diff --git a/llvm/lib/Analysis/IVUsers.cpp b/llvm/lib/Analysis/IVUsers.cpp index c819bd319c6..0b94238e663 100644 --- a/llvm/lib/Analysis/IVUsers.cpp +++ b/llvm/lib/Analysis/IVUsers.cpp @@ -287,6 +287,7 @@ void IVUsers::print(raw_ostream &OS, const Module *M) const { OS << ")"; } OS << " in "; + assert(UI->getUser() != nullptr && "Expected non-null User"); UI->getUser()->print(OS); OS << '\n'; } diff --git a/llvm/lib/Analysis/LoopPass.cpp b/llvm/lib/Analysis/LoopPass.cpp index 8df18e75c64..2c6e6e3ffff 100644 --- a/llvm/lib/Analysis/LoopPass.cpp +++ b/llvm/lib/Analysis/LoopPass.cpp @@ -45,6 +45,7 @@ public: for (Loop::block_iterator b = L->block_begin(), be = L->block_end(); b != be; ++b) { + assert((*b) != nullptr && "Expecting non-null block"); (*b)->print(Out); } return false; diff --git a/llvm/lib/Analysis/RegionPass.cpp b/llvm/lib/Analysis/RegionPass.cpp index 3c7798f2f42..d11b3323cac 100644 --- a/llvm/lib/Analysis/RegionPass.cpp +++ b/llvm/lib/Analysis/RegionPass.cpp @@ -195,8 +195,10 @@ public: bool runOnRegion(Region *R, RGPassManager &RGM) override { Out << Banner; - for (const auto &BB : R->blocks()) + for (const auto &BB : R->blocks()) { + assert(BB != nullptr && "Expecting non-null Block"); BB->print(Out); + } return false; } |