Loading llvm/lib/Transforms/IPO/GlobalOpt.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -955,7 +955,8 @@ static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V, continue; // Otherwise, storing through it, or storing into GV... fine. } if (isa<GetElementPtrInst>(Inst)) { // Must index into the array and into the struct. if (isa<GetElementPtrInst>(Inst) && Inst->getNumOperands() >= 3) { if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Inst, GV, PHIs)) return false; continue; Loading llvm/test/Transforms/GlobalOpt/crash.ll +27 −1 Original line number Diff line number Diff line Loading @@ -14,3 +14,29 @@ entry: store float 1.0, float* getelementptr inbounds (%struct.btSimdScalar* @_ZL6vTwist, i32 0, i32 0, i32 0, i32 3), align 4 ret void } ; PR6760 %T = type { [5 x i32] } @switch_inf = internal global %T* null define void @test(i8* %arch_file, i32 %route_type) { entry: %A = sext i32 1 to i64 %B = mul i64 %A, 20 %C = call noalias i8* @malloc(i64 %B) nounwind %D = bitcast i8* %C to %T* store %T* %D, %T** @switch_inf, align 8 unreachable bb.nph.i: %scevgep.i539 = getelementptr i8* %C, i64 4 unreachable xx: %E = load %T** @switch_inf, align 8 unreachable } declare noalias i8* @malloc(i64) nounwind Loading
llvm/lib/Transforms/IPO/GlobalOpt.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -955,7 +955,8 @@ static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V, continue; // Otherwise, storing through it, or storing into GV... fine. } if (isa<GetElementPtrInst>(Inst)) { // Must index into the array and into the struct. if (isa<GetElementPtrInst>(Inst) && Inst->getNumOperands() >= 3) { if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Inst, GV, PHIs)) return false; continue; Loading
llvm/test/Transforms/GlobalOpt/crash.ll +27 −1 Original line number Diff line number Diff line Loading @@ -14,3 +14,29 @@ entry: store float 1.0, float* getelementptr inbounds (%struct.btSimdScalar* @_ZL6vTwist, i32 0, i32 0, i32 0, i32 3), align 4 ret void } ; PR6760 %T = type { [5 x i32] } @switch_inf = internal global %T* null define void @test(i8* %arch_file, i32 %route_type) { entry: %A = sext i32 1 to i64 %B = mul i64 %A, 20 %C = call noalias i8* @malloc(i64 %B) nounwind %D = bitcast i8* %C to %T* store %T* %D, %T** @switch_inf, align 8 unreachable bb.nph.i: %scevgep.i539 = getelementptr i8* %C, i64 4 unreachable xx: %E = load %T** @switch_inf, align 8 unreachable } declare noalias i8* @malloc(i64) nounwind