mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-13 16:03:58 +00:00
Fix GlobalOpt to avoid committing a store if the address getelementptr
is missing the inbounds flag. This is slightly conservative, but it avoids problems with two constants pointing to the same address but getting distinct entries in the Memory DenseMap. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81163 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4a7e6b7a15
commit
c62482d4ed
@ -2032,7 +2032,8 @@ static bool isSimpleEnoughPointerToCommit(Constant *C, LLVMContext &Context) {
|
||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
|
||||
// Handle a constantexpr gep.
|
||||
if (CE->getOpcode() == Instruction::GetElementPtr &&
|
||||
isa<GlobalVariable>(CE->getOperand(0))) {
|
||||
isa<GlobalVariable>(CE->getOperand(0)) &&
|
||||
cast<GEPOperator>(CE)->isInBounds()) {
|
||||
GlobalVariable *GV = cast<GlobalVariable>(CE->getOperand(0));
|
||||
// Do not allow weak/linkonce/dllimport/dllexport linkage or
|
||||
// external globals.
|
||||
|
Loading…
x
Reference in New Issue
Block a user