diff options
| author | Bill Wendling <isanbard@gmail.com> | 2008-01-26 06:51:24 +0000 |
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2008-01-26 06:51:24 +0000 |
| commit | 381802f8e06668d0ec5fc760804c83e511dafc7c (patch) | |
| tree | b06c50d1c029703ef07733f84fb360e4775d1544 /lib/Transforms | |
| parent | 418ab3729cbf094011eeaeb92306c410ae0f8944 (diff) | |
If there are no machine instructions emitted for a function, then insert
a "nop" instruction so that we don't have the function's label associated
with something that it's not supposed to be associated with.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46394 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
| -rw-r--r-- | lib/Transforms/Scalar/SimplifyCFG.cpp | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/Transforms/Scalar/SimplifyCFG.cpp b/lib/Transforms/Scalar/SimplifyCFG.cpp index 9d0757a714..3d1a5bea97 100644 --- a/lib/Transforms/Scalar/SimplifyCFG.cpp +++ b/lib/Transforms/Scalar/SimplifyCFG.cpp @@ -26,7 +26,6 @@ #include "llvm/Transforms/Utils/Local.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" -#include "llvm/Intrinsics.h" #include "llvm/Module.h" #include "llvm/ParameterAttributes.h" #include "llvm/Support/CFG.h" @@ -155,20 +154,8 @@ static bool RemoveUnreachableBlocks(Function &F) { bool Changed = MarkAliveBlocks(F.begin(), Reachable); // If there are unreachable blocks in the CFG... - if (Reachable.size() == F.size()) { - if (F.size() == 1) { - // If the function has only one block with an "unreachable" instruction, - // then we should create *some* code for it. Issue a "trap" instead. - BasicBlock &BB = F.front(); - - if (BB.size() == 1 && dyn_cast<UnreachableInst>(&BB.front())) - new CallInst(Intrinsic::getDeclaration(F.getParent(), - Intrinsic::trap), - "", &BB.front()); - } - + if (Reachable.size() == F.size()) return Changed; - } assert(Reachable.size() < F.size()); NumSimpl += F.size()-Reachable.size(); |
