1 ; RUN: opt %loadPolly -polly-print-ast -polly-process-unprofitable -polly-allow-nonaffine -disable-output < %s | FileCheck %s
4 ; Make sure we generate the correct aliasing check for a fixed-size memset operation.
5 ; CHECK: if (1 && (&MemRef_tmp0[15] <= &MemRef_tmp1[0] || &MemRef_tmp1[32] <= &MemRef_tmp0[14]))
8 ; Make sure we generate the correct aliasing check for a variable-size memset operation.
9 ; CHECK: if (1 && (&MemRef_tmp0[15] <= &MemRef_tmp1[0] || &MemRef_tmp1[n] <= &MemRef_tmp0[14]))
12 ; We can't do anything interesting with a non-affine memset; just make sure it doesn't crash.
14 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
16 %struct.info = type { i32, ptr, i32, ptr, ptr, i32, ptr, i32, i32, double }
17 %struct.ctr = type { i32, i8, i8, i32 }
18 %struct.ord = type { i32, i8 }
20 ; Function Attrs: argmemonly nounwind
21 declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i32, i1) #0
23 define void @test1(ptr %ppIdxInfo) {
25 %tmp0 = load ptr, ptr %ppIdxInfo, align 8
28 if.end125: ; preds = %entry
29 %tmp1 = load ptr, ptr undef, align 8
32 for.end143: ; preds = %if.end125
33 tail call void @llvm.memset.p0.i64(ptr %tmp1, i8 0, i64 32, i32 4, i1 false)
34 %needToFreeIdxStr = getelementptr inbounds %struct.info, ptr %tmp0, i64 0, i32 7
35 %tmp3 = load i32, ptr %needToFreeIdxStr, align 8
36 br i1 false, label %if.end149, label %if.then148
38 if.then148: ; preds = %for.end143
41 if.end149: ; preds = %if.then148, %for.end143
45 define void @test2(ptr %ppIdxInfo, i64 %n) {
47 %tmp0 = load ptr, ptr %ppIdxInfo, align 8
50 if.end125: ; preds = %entry
51 %tmp1 = load ptr, ptr undef, align 8
54 for.end143: ; preds = %if.end125
55 tail call void @llvm.memset.p0.i64(ptr %tmp1, i8 0, i64 %n, i32 4, i1 false)
56 %needToFreeIdxStr = getelementptr inbounds %struct.info, ptr %tmp0, i64 0, i32 7
57 %tmp3 = load i32, ptr %needToFreeIdxStr, align 8
58 br i1 false, label %if.end149, label %if.then148
60 if.then148: ; preds = %for.end143
63 if.end149: ; preds = %if.then148, %for.end143
67 define i32 @test3(ptr %x, i32 %n) {
71 entry.split: ; preds = %entry
72 %conv = sext i32 %n to i64
73 %cmp8 = icmp sgt i32 %n, 0
74 br i1 %cmp8, label %for.body.lr.ph, label %for.cond.cleanup
76 for.body.lr.ph: ; preds = %entry.split
79 for.cond.cleanup: ; preds = %for.body, %entry.split
82 for.body: ; preds = %for.body, %for.body.lr.ph
83 %i.09 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
84 %mul = mul nsw i64 %i.09, %i.09
85 tail call void @llvm.memset.p0.i64(ptr %x, i8 0, i64 %mul, i32 4, i1 false)
86 %add = add nuw nsw i64 %i.09, 1000
87 %arrayidx = getelementptr inbounds i32, ptr %x, i64 %add
88 store i32 5, ptr %arrayidx, align 4
89 %inc = add nuw nsw i64 %i.09, 1
90 %exitcond = icmp eq i64 %inc, %conv
91 br i1 %exitcond, label %for.cond.cleanup, label %for.body
94 attributes #0 = { argmemonly nounwind }