aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index e49f285..ebd2145 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4285,6 +4285,11 @@ bool llvm::isGuaranteedToTransferExecutionToSuccessor(const Instruction *I) {
if (!CS.doesNotThrow())
return false;
+ // A function which doens't throw and has "willreturn" attribute will
+ // always return.
+ if (CS.hasFnAttr(Attribute::WillReturn))
+ return true;
+
// Non-throwing call sites can loop infinitely, call exit/pthread_exit
// etc. and thus not return. However, LLVM already assumes that
//