summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-05-13 18:25:07 +0000
committerDale Johannesen <dalej@apple.com>2009-05-13 18:25:07 +0000
commit69921959b417f9c64727aaef41147b067bc890d7 (patch)
tree352754dcb3ee1344922512a1ba871db5d428d17e /llvm/lib/Transforms
parent5801f65a528415516598adbe7bdd22da21c3c2ba (diff)
downloadbcm5719-llvm-69921959b417f9c64727aaef41147b067bc890d7.tar.gz
bcm5719-llvm-69921959b417f9c64727aaef41147b067bc890d7.zip
Don't generate a select whose operand is load of a weak
external. These may have address 0 and are not safe to execute unconditionally. llvm-svn: 71688
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 4435b13e00b..48345915736 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -18,6 +18,7 @@
#include "llvm/IntrinsicInst.h"
#include "llvm/Type.h"
#include "llvm/DerivedTypes.h"
+#include "llvm/GlobalVariable.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Debug.h"
#include "llvm/Analysis/ConstantFolding.h"
@@ -393,6 +394,11 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB,
if (!isa<AllocaInst>(I->getOperand(0)) &&
!isa<Constant>(I->getOperand(0)))
return false;
+ // External weak globals may have address 0, so we can't load them.
+ if (GlobalVariable* GV= dyn_cast<GlobalVariable>(I->getOperand(0))) {
+ if (GV->hasExternalWeakLinkage())
+ return false;
+ }
// Finally, we have to check to make sure there are no instructions
// before the load in its basic block, as we are going to hoist the loop
OpenPOWER on IntegriCloud