mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
SCCP: overdefined calls cannot become constant
We would attempt to fold away a call instruction which had been marked overdefined. However, it's not valid to transition to constant from overdefined. This fixes PR21512. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221513 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
893f22f882
commit
3f2ffe0423
@ -1107,6 +1107,9 @@ CallOverdefined:
|
||||
Operands.push_back(State.getConstant());
|
||||
}
|
||||
|
||||
if (getValueState(I).isOverdefined())
|
||||
return;
|
||||
|
||||
// If we can constant fold this, mark the result of the call as a
|
||||
// constant.
|
||||
if (Constant *C = ConstantFoldCall(F, Operands, TLI))
|
||||
|
@ -227,3 +227,23 @@ entry:
|
||||
; CHECK-LABEL: define internal i32 @test10b(
|
||||
; CHECK: ret i32 undef
|
||||
}
|
||||
|
||||
;;======================== test11
|
||||
|
||||
define i64 @test11a() {
|
||||
%xor = xor i64 undef, undef
|
||||
ret i64 %xor
|
||||
; CHECK-LABEL: define i64 @test11a
|
||||
; CHECK: ret i64 0
|
||||
}
|
||||
|
||||
define void @test11b() {
|
||||
%call1 = call i64 @test11a()
|
||||
%call2 = call i64 @llvm.ctpop.i64(i64 %call1)
|
||||
ret void
|
||||
; CHECK-LABEL: define void @test11b
|
||||
; CHECK: %[[call1:.*]] = call i64 @test11a()
|
||||
; CHECK: %[[call2:.*]] = call i64 @llvm.ctpop.i64(i64 0)
|
||||
}
|
||||
|
||||
declare i64 @llvm.ctpop.i64(i64)
|
||||
|
Loading…
Reference in New Issue
Block a user