diff options
author | Philip Reames <listmail@philipreames.com> | 2018-03-08 21:25:30 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2018-03-08 21:25:30 +0000 |
commit | fbffd126b8cea0e6d249dce41850ce8ce0cf03bc (patch) | |
tree | 25f0da560654de0735f8ea8b9063b5326a7bd689 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | fb36d079e57cf56819bfbc1a1c2c8282accb58d5 (diff) | |
download | llvm-fbffd126b8cea0e6d249dce41850ce8ce0cf03bc.zip llvm-fbffd126b8cea0e6d249dce41850ce8ce0cf03bc.tar.gz llvm-fbffd126b8cea0e6d249dce41850ce8ce0cf03bc.tar.bz2 |
[NFC] Factor out a helper function for checking if a block has a potential early implicit exit.
llvm-svn: 327065
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index c132586..2ec9cc1 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -3968,6 +3968,15 @@ bool llvm::isGuaranteedToTransferExecutionToSuccessor(const Instruction *I) { return true; } +bool llvm::isGuaranteedToTransferExecutionToSuccessor(const BasicBlock *BB) { + // TODO: This is slightly consdervative for invoke instruction since exiting + // via an exception *is* normal control for them. + for (auto I = BB->begin(), E = BB->end(); I != E; ++I) + if (!isGuaranteedToTransferExecutionToSuccessor(&*I)) + return false; + return true; +} + bool llvm::isGuaranteedToExecuteForEveryIteration(const Instruction *I, const Loop *L) { // The loop header is guaranteed to be executed for every iteration. |