Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MachineSink] Fix for breaking phi edges with instructions with multi…
…ple defs BreakPHIEdge would be set based on whether the instruction needs to insert a new critical edge to allow sinking into a block where the uses are PHI nodes. But for instructions with multiple defs it would be reset on the second def, allowing the instruciton to sink where it should not. Fixes PR44981 Differential Revision: https://reviews.llvm.org/D78087
- Loading branch information
1 parent
ea88dd8
commit 44c4ba3
Showing
2 changed files
with
69 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc < %s -mtriple=arm-none-eabi | FileCheck %s | ||
|
||
%struct.anon.1.19.23.27.35.49.55.57.59.61.89.95 = type { i32, i32 } | ||
|
||
@e = external constant [2 x %struct.anon.1.19.23.27.35.49.55.57.59.61.89.95], align 4 | ||
@f = external global i32, align 4 | ||
|
||
define arm_aapcscc void @g() { | ||
; CHECK-LABEL: g: | ||
; CHECK: @ %bb.0: @ %entry | ||
; CHECK-NEXT: .save {r11, lr} | ||
; CHECK-NEXT: push {r11, lr} | ||
; CHECK-NEXT: ldr r0, .LCPI0_0 | ||
; CHECK-NEXT: mov r2, #0 | ||
; CHECK-NEXT: ldr r1, .LCPI0_1 | ||
; CHECK-NEXT: cmp r2, #0 | ||
; CHECK-NEXT: ldr r0, [r0] | ||
; CHECK-NEXT: ldr r0, [r1, r0, lsl #3]! | ||
; CHECK-NEXT: moveq r0, #0 | ||
; CHECK-NEXT: cmp r2, #0 | ||
; CHECK-NEXT: popne {r11, lr} | ||
; CHECK-NEXT: movne pc, lr | ||
; CHECK-NEXT: ldr r1, [r1, #4] | ||
; CHECK-NEXT: bl k | ||
; CHECK-NEXT: .p2align 2 | ||
; CHECK-NEXT: @ %bb.1: | ||
; CHECK-NEXT: .LCPI0_0: | ||
; CHECK-NEXT: .long f | ||
; CHECK-NEXT: .LCPI0_1: | ||
; CHECK-NEXT: .long e | ||
entry: | ||
%0 = load i32, i32* @f, align 4 | ||
%c = getelementptr inbounds [2 x %struct.anon.1.19.23.27.35.49.55.57.59.61.89.95], [2 x %struct.anon.1.19.23.27.35.49.55.57.59.61.89.95]* @e, i32 0, i32 %0, i32 0 | ||
%1 = load i32, i32* %c, align 4 | ||
%d = getelementptr inbounds [2 x %struct.anon.1.19.23.27.35.49.55.57.59.61.89.95], [2 x %struct.anon.1.19.23.27.35.49.55.57.59.61.89.95]* @e, i32 0, i32 %0, i32 1 | ||
%2 = load i32, i32* %d, align 4 | ||
br i1 undef, label %land.lhs.true, label %if.end | ||
|
||
land.lhs.true: ; preds = %entry | ||
br label %if.end | ||
|
||
if.end: ; preds = %land.lhs.true, %entry | ||
%h.0 = phi i32 [ %1, %entry ], [ 0, %land.lhs.true ] | ||
br i1 undef, label %if.end7, label %if.then5 | ||
|
||
if.then5: ; preds = %if.end | ||
%call6 = call arm_aapcscc i32 bitcast (i32 (...)* @k to i32 (i32, i32)*)(i32 %h.0, i32 %2) | ||
unreachable | ||
|
||
if.end7: ; preds = %if.end | ||
ret void | ||
} | ||
|
||
declare arm_aapcscc i32 @k(...) | ||
|