71 lines · plain
1; RUN: llc -mtriple=hexagon < %s | FileCheck %s2 3; The early return is predicated, and the save-restore code is mixed together:4; {5; p0 = cmp.eq(r0, #0)6; if (p0.new) r17:16 = memd(r29 + #0)7; memd(r29+#0) = r17:168; }9; {10; if (p0) dealloc_return11; }12; The problem is that the load will execute before the store, clobbering the13; pair r17:16.14;15 16; Validate that store executes before load.17; CHECK: memd{{.*}} = r17:1618; CHECK: r17:16 = memd19; CHECK: } :mem_noshuf20; CHECK-LABEL: LBB0_1:21 22target triple = "hexagon"23 24%struct.0 = type { ptr, ptr, ptr, ptr, ptr }25%struct.1 = type { [60 x i8], i32, ptr }26%struct.2 = type { i8, i8, i8, i8, %union.anon }27%union.anon = type { ptr }28%struct.3 = type { ptr, ptr }29 30@var = external hidden unnamed_addr global ptr, align 431 32declare void @bar(ptr, i32) local_unnamed_addr #033 34define void @foo() local_unnamed_addr #1 {35entry:36 %.pr = load ptr, ptr @var, align 4, !tbaa !137 %cmp2 = icmp eq ptr %.pr, null38 br i1 %cmp2, label %while.end, label %while.body.preheader39 40while.body.preheader: ; preds = %entry41 br label %while.body42 43while.body: ; preds = %while.body.preheader, %while.body44 %0 = phi ptr [ %4, %while.body ], [ %.pr, %while.body.preheader ]45 %right = getelementptr inbounds %struct.0, ptr %0, i32 0, i32 446 %1 = bitcast ptr %right to ptr47 %2 = load i32, ptr %1, align 4, !tbaa !548 %3 = bitcast ptr %0 to ptr49 tail call void @bar(ptr %3, i32 20) #150 store i32 %2, ptr @var, align 4, !tbaa !151 %4 = inttoptr i32 %2 to ptr52 %cmp = icmp eq i32 %2, 053 br i1 %cmp, label %while.end.loopexit, label %while.body54 55while.end.loopexit: ; preds = %while.body56 br label %while.end57 58while.end: ; preds = %while.end.loopexit, %entry59 ret void60}61 62attributes #0 = { optsize }63attributes #1 = { nounwind optsize }64 65!1 = !{!2, !2, i64 0}66!2 = !{!"any pointer", !3, i64 0}67!3 = !{!"omnipotent char", !4, i64 0}68!4 = !{!"Simple C/C++ TBAA"}69!5 = !{!6, !2, i64 16}70!6 = !{!"0", !2, i64 0, !2, i64 4, !2, i64 8, !2, i64 12, !2, i64 16}71