[TTI] getTypeBasedIntrinsicInstrCost - add basic handling for strided load/store...
[llvm-project.git] / llvm / test / Transforms / LoopInterchange / vector-gep-operand.ll
blob478042f6f3c4dfa1079ca2050d37e093398f26ed
1 ; Remove 'S' Scalar Dependencies #119345
2 ; Scalar dependencies are not handled correctly, so they were removed to avoid
3 ; miscompiles. The loop nest in this test case used to be interchanged, but it's
4 ; no longer triggering. XFAIL'ing this test to indicate that this test should
5 ; interchanged if scalar deps are handled correctly.
7 ; XFAIL: *
9 ; RUN: opt -passes=loop-interchange -cache-line-size=64 -loop-interchange-threshold=-10 %s -pass-remarks-output=%t -disable-output
10 ; RUN: FileCheck -input-file %t %s
12 ; The test contains a GEP with an operand that is not SCEV-able. Make sure
13 ; loop-interchange does not crash.
15 ; CHECK:       --- !Passed
16 ; CHECK-NEXT:  Pass:            loop-interchange
17 ; CHECK-NEXT:  Name:            Interchanged
18 ; CHECK-NEXT:  Function:        test
19 ; CHECK-NEXT:  Args:
20 ; CHECK-NEXT:    - String:          Loop interchanged with enclosing loop.
22 define void @test(ptr noalias %src, ptr %dst) {
23 entry:
24   br label %outer.header
26 outer.header:
27   %i = phi i32 [ %i.next, %outer.latch ], [ 0, %entry ]
28   br label %inner
30 inner:
31   %j = phi i64 [ 0, %outer.header ], [ %j.next, %inner ]
32   %src.gep = getelementptr inbounds [256 x float], ptr %src, <2 x i64> <i64 0, i64 1>, i64 %j
33   %src.0 = extractelement <2 x ptr> %src.gep, i32 0
34   %lv.0 = load float, ptr %src.0
35   %add.0 = fadd float %lv.0, 1.0
36   %dst.gep = getelementptr inbounds float, ptr %dst, i64 %j
37   store float %add.0, ptr %dst.gep
38   %j.next = add nuw nsw i64 %j, 1
39   %inner.exitcond = icmp eq i64 %j.next, 100
40   br i1 %inner.exitcond, label %outer.latch, label %inner
42 outer.latch:
43   %i.next = add nuw nsw i32 %i, 1
44   %outer.exitcond = icmp eq i32 %i.next, 100
45   br i1 %outer.exitcond, label %exit, label %outer.header
47 exit:
48   ret void