mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[SimplifyCFG] FoldTwoEntryPHINode(): don't fold if either block has it's address taken
Same as with HoistThenElseCodeToIf() (ad87761925c2790aab272138b5bbbde4a93e0383).
This commit is contained in:
parent
9120098319
commit
21a466ca4d
@ -2819,6 +2819,11 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI,
|
|||||||
}
|
}
|
||||||
assert(DomBlock && "Failed to find root DomBlock");
|
assert(DomBlock && "Failed to find root DomBlock");
|
||||||
|
|
||||||
|
// If either of the blocks has it's address taken, we can't do this fold.
|
||||||
|
if ((IfBlock1 && IfBlock1->hasAddressTaken()) ||
|
||||||
|
(IfBlock2 && IfBlock2->hasAddressTaken()))
|
||||||
|
return Changed;
|
||||||
|
|
||||||
LLVM_DEBUG(dbgs() << "FOUND IF CONDITION! " << *IfCond
|
LLVM_DEBUG(dbgs() << "FOUND IF CONDITION! " << *IfCond
|
||||||
<< " T: " << IfTrue->getName()
|
<< " T: " << IfTrue->getName()
|
||||||
<< " F: " << IfFalse->getName() << "\n");
|
<< " F: " << IfFalse->getName() << "\n");
|
||||||
|
@ -31,3 +31,17 @@ common.ret:
|
|||||||
%common.retval = phi i32 [ 0, %loc ], [ 42, %loc2 ]
|
%common.retval = phi i32 [ 0, %loc ], [ 42, %loc2 ]
|
||||||
ret i32 %common.retval
|
ret i32 %common.retval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define i32 @test_inline_constraint_S_label_tailmerged2(i1 %in) {
|
||||||
|
; CHECK-LABEL: test_inline_constraint_S_label_tailmerged2:
|
||||||
|
call void asm sideeffect "adr x0, $0", "S"(i8* blockaddress(@test_inline_constraint_S_label_tailmerged2, %loc))
|
||||||
|
; CHECK: adr x0, .Ltmp{{[0-9]+}}
|
||||||
|
br i1 %in, label %loc, label %loc2
|
||||||
|
common.ret:
|
||||||
|
%common.retval = phi i32 [ 0, %loc ], [ 42, %loc2 ]
|
||||||
|
ret i32 %common.retval
|
||||||
|
loc:
|
||||||
|
br label %common.ret
|
||||||
|
loc2:
|
||||||
|
br label %common.ret
|
||||||
|
}
|
||||||
|
@ -10,7 +10,7 @@ define i32 @test_inline_constraint_S_label_tailmerged(i1 %in) {
|
|||||||
; CHECK-NEXT: ret i32 [[COMMON_RETVAL]]
|
; CHECK-NEXT: ret i32 [[COMMON_RETVAL]]
|
||||||
;
|
;
|
||||||
call void asm sideeffect "adr x0, $0", "S"(i8* blockaddress(@test_inline_constraint_S_label_tailmerged, %loc))
|
call void asm sideeffect "adr x0, $0", "S"(i8* blockaddress(@test_inline_constraint_S_label_tailmerged, %loc))
|
||||||
br i1 %in, label %loc, label %loc2
|
br i1 %in, label %loc, label %loc2
|
||||||
loc:
|
loc:
|
||||||
br label %common.ret
|
br label %common.ret
|
||||||
loc2:
|
loc2:
|
||||||
@ -19,3 +19,21 @@ common.ret:
|
|||||||
%common.retval = phi i32 [ 0, %loc ], [ 42, %loc2 ]
|
%common.retval = phi i32 [ 0, %loc ], [ 42, %loc2 ]
|
||||||
ret i32 %common.retval
|
ret i32 %common.retval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define i32 @test_inline_constraint_S_label_tailmerged2(i1 %in) {
|
||||||
|
; CHECK-LABEL: @test_inline_constraint_S_label_tailmerged2(
|
||||||
|
; CHECK-NEXT: common.ret:
|
||||||
|
; CHECK-NEXT: call void asm sideeffect "adr x0, $0", "S"(i8* blockaddress(@test_inline_constraint_S_label_tailmerged, [[COMMON_RET:%.*]]))
|
||||||
|
; CHECK-NEXT: [[DOT:%.*]] = select i1 [[IN:%.*]], i32 0, i32 42
|
||||||
|
; CHECK-NEXT: ret i32 [[DOT]]
|
||||||
|
;
|
||||||
|
call void asm sideeffect "adr x0, $0", "S"(i8* blockaddress(@test_inline_constraint_S_label_tailmerged, %loc))
|
||||||
|
br i1 %in, label %loc, label %loc2
|
||||||
|
common.ret:
|
||||||
|
%common.retval = phi i32 [ 0, %loc ], [ 42, %loc2 ]
|
||||||
|
ret i32 %common.retval
|
||||||
|
loc:
|
||||||
|
br label %common.ret
|
||||||
|
loc2:
|
||||||
|
br label %common.ret
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user