diff options
Diffstat (limited to 'llvm/lib/Transforms/IPO/GlobalOpt.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 1a1bde4f0668..1ad6e2b2a1d2 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -1584,11 +1584,6 @@ processInternalGlobal(GlobalVariable *GV, const GlobalStatus &GS, } Value *StoredOnceValue = GS.getStoredOnceValue(); if (GS.StoredType == GlobalStatus::StoredOnce && StoredOnceValue) { - // Avoid speculating constant expressions that might trap (div/rem). - auto *SOVConstant = dyn_cast<Constant>(StoredOnceValue); - if (SOVConstant && SOVConstant->canTrap()) - return Changed; - Function &StoreFn = const_cast<Function &>(*GS.StoredOnceStore->getFunction()); bool CanHaveNonUndefGlobalInitializer = @@ -1601,6 +1596,7 @@ processInternalGlobal(GlobalVariable *GV, const GlobalStatus &GS, // This is restricted to address spaces that allow globals to have // initializers. NVPTX, for example, does not support initializers for // shared memory (AS 3). + auto *SOVConstant = dyn_cast<Constant>(StoredOnceValue); if (SOVConstant && isa<UndefValue>(GV->getInitializer()) && DL.getTypeAllocSize(SOVConstant->getType()) == DL.getTypeAllocSize(GV->getValueType()) && |