Skip to content

Commit 7773dcd

Browse files
authored
[X86][NFC] Change test name and add a new test (#109638)
Address post commit comments in #108754.
1 parent e0bd8d3 commit 7773dcd

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

llvm/test/Transforms/SimplifyCFG/X86/hoist-loads-stores-with-cf.ll

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,8 @@ if.false:
672672
ret void
673673
}
674674

675-
define i32 @str_transcode0(i1 %cond1, ptr %p, i1 %cond2) {
676-
; CHECK-LABEL: @str_transcode0(
675+
define i32 @succ_phi_has_3input(i1 %cond1, ptr %p, i1 %cond2) {
676+
; CHECK-LABEL: @succ_phi_has_3input(
677677
; CHECK-NEXT: entry:
678678
; CHECK-NEXT: br i1 [[COND1:%.*]], label [[BB3:%.*]], label [[BB1:%.*]]
679679
; CHECK: bb1:
@@ -728,6 +728,37 @@ if.true:
728728
ret i32 %res
729729
}
730730

731+
define i32 @succ1to0_phi3(ptr %p, ptr %p2, i32 %x) {
732+
; CHECK-LABEL: @succ1to0_phi3(
733+
; CHECK-NEXT: entry:
734+
; CHECK-NEXT: [[COND:%.*]] = icmp eq ptr [[P:%.*]], null
735+
; CHECK-NEXT: [[TMP0:%.*]] = xor i1 [[COND]], true
736+
; CHECK-NEXT: [[TMP1:%.*]] = bitcast i1 [[TMP0]] to <1 x i1>
737+
; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32 [[X:%.*]] to <1 x i32>
738+
; CHECK-NEXT: [[TMP3:%.*]] = call <1 x i32> @llvm.masked.load.v1i32.p0(ptr [[P]], i32 4, <1 x i1> [[TMP1]], <1 x i32> [[TMP2]])
739+
; CHECK-NEXT: [[TMP4:%.*]] = bitcast <1 x i32> [[TMP3]] to i32
740+
; CHECK-NEXT: [[TMP5:%.*]] = bitcast i32 [[TMP4]] to <1 x i32>
741+
; CHECK-NEXT: call void @llvm.masked.store.v1i32.p0(<1 x i32> [[TMP5]], ptr [[P2:%.*]], i32 4, <1 x i1> [[TMP1]])
742+
; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[COND]], i32 0, i32 [[TMP4]]
743+
; CHECK-NEXT: [[RES:%.*]] = add i32 [[SPEC_SELECT]], [[TMP4]]
744+
; CHECK-NEXT: ret i32 [[RES]]
745+
;
746+
entry:
747+
%cond = icmp eq ptr %p, null
748+
br i1 %cond, label %if.true, label %if.false
749+
750+
if.false:
751+
%0 = load i32, ptr %p
752+
store i32 %0, ptr %p2
753+
br label %if.true
754+
755+
if.true:
756+
%res0 = phi i32 [ %0, %if.false ], [ 0, %entry ]
757+
%res1 = phi i32 [ %0, %if.false ], [ %x, %entry ]
758+
%res = add i32 %res0, %res1
759+
ret i32 %res
760+
}
761+
731762
declare i32 @read_memory_only() readonly nounwind willreturn speculatable
732763

733764
!llvm.dbg.cu = !{!0}

0 commit comments

Comments
 (0)