Loading llvm/lib/Transforms/IPO/GlobalOpt.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -623,7 +623,10 @@ static bool OptimizeAwayTrappingUsesOfLoads(GlobalVariable *GV, Constant *LV) { Loads.push_back(LI); Changed |= OptimizeAwayTrappingUsesOfValue(LI, LV); } else { assert(isa<StoreInst>(*GUI) && "Only expect load and stores!"); // If we get here we could have stores, loads, or phi nodes whose values // are loaded. assert((isa<StoreInst>(*GUI) || isa<PHINode>(*GUI)) && "Only expect load and stores!"); } if (Changed) { Loading llvm/lib/Transforms/Scalar/InstructionCombining.cpp +16 −7 Original line number Diff line number Diff line Loading @@ -6449,16 +6449,25 @@ Instruction *InstCombiner::commonPointerCastTransforms(CastInst &CI) { while (Offset) { if (const StructType *STy = dyn_cast<StructType>(GEPIdxTy)) { const StructLayout *SL = TD->getStructLayout(STy); if (Offset < (int64_t)SL->getSizeInBytes()) { unsigned Elt = SL->getElementContainingOffset(Offset); NewIndices.push_back(ConstantInt::get(Type::Int32Ty, Elt)); Offset -= SL->getElementOffset(Elt); GEPIdxTy = STy->getElementType(Elt); } else { // Otherwise, we can't index into this, bail out. Offset = 0; OrigBase = 0; } } else if (isa<ArrayType>(GEPIdxTy) || isa<VectorType>(GEPIdxTy)) { const SequentialType *STy = cast<SequentialType>(GEPIdxTy); uint64_t EltSize = TD->getTypeSize(STy->getElementType()); if (uint64_t EltSize = TD->getTypeSize(STy->getElementType())) { NewIndices.push_back(ConstantInt::get(IntPtrTy,Offset/EltSize)); Offset %= EltSize; } else { NewIndices.push_back(ConstantInt::get(IntPtrTy, 0)); } GEPIdxTy = STy->getElementType(); } else { // Otherwise, we can't index into this, bail out. Loading Loading
llvm/lib/Transforms/IPO/GlobalOpt.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -623,7 +623,10 @@ static bool OptimizeAwayTrappingUsesOfLoads(GlobalVariable *GV, Constant *LV) { Loads.push_back(LI); Changed |= OptimizeAwayTrappingUsesOfValue(LI, LV); } else { assert(isa<StoreInst>(*GUI) && "Only expect load and stores!"); // If we get here we could have stores, loads, or phi nodes whose values // are loaded. assert((isa<StoreInst>(*GUI) || isa<PHINode>(*GUI)) && "Only expect load and stores!"); } if (Changed) { Loading
llvm/lib/Transforms/Scalar/InstructionCombining.cpp +16 −7 Original line number Diff line number Diff line Loading @@ -6449,16 +6449,25 @@ Instruction *InstCombiner::commonPointerCastTransforms(CastInst &CI) { while (Offset) { if (const StructType *STy = dyn_cast<StructType>(GEPIdxTy)) { const StructLayout *SL = TD->getStructLayout(STy); if (Offset < (int64_t)SL->getSizeInBytes()) { unsigned Elt = SL->getElementContainingOffset(Offset); NewIndices.push_back(ConstantInt::get(Type::Int32Ty, Elt)); Offset -= SL->getElementOffset(Elt); GEPIdxTy = STy->getElementType(Elt); } else { // Otherwise, we can't index into this, bail out. Offset = 0; OrigBase = 0; } } else if (isa<ArrayType>(GEPIdxTy) || isa<VectorType>(GEPIdxTy)) { const SequentialType *STy = cast<SequentialType>(GEPIdxTy); uint64_t EltSize = TD->getTypeSize(STy->getElementType()); if (uint64_t EltSize = TD->getTypeSize(STy->getElementType())) { NewIndices.push_back(ConstantInt::get(IntPtrTy,Offset/EltSize)); Offset %= EltSize; } else { NewIndices.push_back(ConstantInt::get(IntPtrTy, 0)); } GEPIdxTy = STy->getElementType(); } else { // Otherwise, we can't index into this, bail out. Loading