summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-01-26 06:51:24 +0000
committerBill Wendling <isanbard@gmail.com>2008-01-26 06:51:24 +0000
commit507948395726537d025ec95bf31baa3409e63da6 (patch)
treee67d7fda7b66a19fd37254f83e385d8d2fe5b286 /llvm/lib/Transforms
parentc4dc3dc3a2b00c138484ce941914a77b429ae48a (diff)
downloadbcm5719-llvm-507948395726537d025ec95bf31baa3409e63da6.tar.gz
bcm5719-llvm-507948395726537d025ec95bf31baa3409e63da6.zip
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. llvm-svn: 46394
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SimplifyCFG.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp
index 9d0757a7146..3d1a5bea97c 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud