mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-12 07:37:34 +00:00
Don't try to promote the same alloca twice. Fixes PR13916!
Chandler, it's not obvious that it's okay that this alloca gets into the list twice to begin with. Please review and see whether this is the fix you really want, but I wanted to get a fix checked in quickly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164634 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ba48ceb1a3
commit
c3f10e43fc
@ -3108,6 +3108,12 @@ bool SROA::promoteAllocas(Function &F) {
|
||||
if (PromotableAllocas.empty())
|
||||
return false;
|
||||
|
||||
// Ensure that the list is unique.
|
||||
std::sort(PromotableAllocas.begin(), PromotableAllocas.end());
|
||||
PromotableAllocas.erase(std::unique(PromotableAllocas.begin(),
|
||||
PromotableAllocas.end()),
|
||||
PromotableAllocas.end());
|
||||
|
||||
NumPromoted += PromotableAllocas.size();
|
||||
|
||||
if (DT && !ForceSSAUpdater) {
|
||||
|
@ -855,3 +855,25 @@ entry:
|
||||
%result = or i8 %load, %load2
|
||||
ret i8 %result
|
||||
}
|
||||
|
||||
%test22.struct = type { i8 }
|
||||
|
||||
define void @test22() {
|
||||
; CHECK: @test22
|
||||
; CHECK-NOT: alloca
|
||||
; CHECK: ret void
|
||||
; PR13916
|
||||
entry:
|
||||
%A = alloca %test22.struct
|
||||
br i1 undef, label %if.then, label %if.end
|
||||
|
||||
if.then: ; preds = %entry
|
||||
%tmp = bitcast %test22.struct* %A to i8*
|
||||
%tmp1 = bitcast %test22.struct* %A to i8*
|
||||
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp, i8* %tmp1, i32 1, i32 1, i1 false)
|
||||
unreachable
|
||||
|
||||
if.end: ; preds = %entry
|
||||
%tmp2 = load %test22.struct* %A
|
||||
ret void
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user