Skip to content

Commit 3d5cf0d

Browse files
committed
Revert "[InstSimplify] Fold all global variables with initializers"
This reverts commit 17b7df3. Reason: causes chrome builds to crash: https://crbug.com/1454861
1 parent 0ce7037 commit 3d5cf0d

File tree

3 files changed

+1
-87
lines changed

3 files changed

+1
-87
lines changed

llvm/lib/Analysis/MemoryBuiltins.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,9 +826,7 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalAlias(GlobalAlias &GA) {
826826
}
827827

828828
SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalVariable(GlobalVariable &GV){
829-
if (GV.hasExternalWeakLinkage() ||
830-
((!GV.hasInitializer() || GV.isInterposable()) &&
831-
Options.EvalMode != ObjectSizeOpts::Mode::Min))
829+
if (!GV.hasDefinitiveInitializer())
832830
return unknown();
833831

834832
APInt Size(IntTyBits, DL.getTypeAllocSize(GV.getValueType()));

llvm/test/Transforms/InstSimplify/gv-alloca-cmp.ll

Lines changed: 0 additions & 46 deletions
This file was deleted.

llvm/test/Transforms/LowerConstantIntrinsics/objectsize_basic.ll

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -146,41 +146,3 @@ define i64 @test_objectsize_malloc() {
146146
%objsize = call i64 @llvm.objectsize.i64(ptr %ptr, i1 false, i1 true, i1 true)
147147
ret i64 %objsize
148148
}
149-
150-
@gv_weak = weak global i64 zeroinitializer, align 16
151-
152-
define i32 @promote_with_objectsize_min_false() {
153-
; CHECK-LABEL: @promote_with_objectsize_min_false(
154-
; CHECK-NEXT: ret i32 -1
155-
;
156-
%size = call i32 @llvm.objectsize.i32.p0(ptr @gv_weak, i1 false, i1 false, i1 false)
157-
ret i32 %size
158-
}
159-
160-
define i32 @promote_with_objectsize_min_true() {
161-
; CHECK-LABEL: @promote_with_objectsize_min_true(
162-
; CHECK-NEXT: ret i32 8
163-
;
164-
%size = call i32 @llvm.objectsize.i32.p0(ptr @gv_weak, i1 true, i1 false, i1 false)
165-
ret i32 %size
166-
}
167-
168-
@gv_extern = extern_weak global i64, align 16
169-
170-
define i32 @promote_with_objectsize_nullunknown_false() {
171-
; CHECK-LABEL: @promote_with_objectsize_nullunknown_false(
172-
; CHECK-NEXT: ret i32 0
173-
;
174-
%size = call i32 @llvm.objectsize.i32.p0(ptr @gv_extern, i1 true, i1 false, i1 false)
175-
ret i32 %size
176-
}
177-
178-
define i32 @promote_with_objectsize_nullunknown_true() {
179-
; CHECK-LABEL: @promote_with_objectsize_nullunknown_true(
180-
; CHECK-NEXT: ret i32 0
181-
;
182-
%size = call i32 @llvm.objectsize.i32.p0(ptr @gv_extern, i1 true, i1 true, i1 false)
183-
ret i32 %size
184-
}
185-
186-
declare i32 @llvm.objectsize.i32.p0(ptr, i1, i1, i1)

0 commit comments

Comments
 (0)