Fixes #155738. The original assumption "we already replaced its users with a constant" for the global variable becomes incorrect after #154668. The users in the dead function are not simplified, in fact. This patch poisons all the unsimplified constant global variable users.
32 lines
896 B
LLVM
32 lines
896 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
|
|
; RUN: opt -passes=ipsccp --funcspec-min-function-size=1 -S < %s | FileCheck %s
|
|
|
|
@gv = internal global ptr null
|
|
|
|
define i8 @caller() {
|
|
; CHECK-LABEL: define i8 @caller() {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[CALL1:%.*]] = call i8 @callee.specialized.1(i32 1)
|
|
; CHECK-NEXT: [[CALL2:%.*]] = call i8 @callee.specialized.2(i32 0)
|
|
; CHECK-NEXT: ret i8 undef
|
|
;
|
|
entry:
|
|
%call1 = call i8 @callee(i32 1)
|
|
%call2 = call i8 @callee(i32 0)
|
|
ret i8 %call2
|
|
}
|
|
|
|
define internal i8 @callee(i32 %arg) {
|
|
entry:
|
|
%useless = icmp ne i32 %arg, 0
|
|
br label %loop
|
|
|
|
loop: ; preds = %loop, %entry
|
|
br label %loop
|
|
|
|
dead_bb: ; No predecessors!
|
|
%l1 = load ptr, ptr @gv, align 8
|
|
%l2 = load ptr, ptr %l1, align 8
|
|
ret i8 0
|
|
}
|