mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-27 09:17:11 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71688 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#include "llvm/IntrinsicInst.h"
|
#include "llvm/IntrinsicInst.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
|
#include "llvm/GlobalVariable.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Analysis/ConstantFolding.h"
|
#include "llvm/Analysis/ConstantFolding.h"
|
||||||
@@ -393,6 +394,11 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB,
|
|||||||
if (!isa<AllocaInst>(I->getOperand(0)) &&
|
if (!isa<AllocaInst>(I->getOperand(0)) &&
|
||||||
!isa<Constant>(I->getOperand(0)))
|
!isa<Constant>(I->getOperand(0)))
|
||||||
return false;
|
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
|
// 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
|
// before the load in its basic block, as we are going to hoist the loop
|
||||||
|
|||||||
Reference in New Issue
Block a user