| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | |
| ; RUN: opt -passes='require<domtree>,instcombine,require<domtree>' -S < %s | FileCheck %s | |
| ; Note: The -loops above can be anything that requires the domtree, and is | |
| ; necessary to work around a pass-manager bug. | |
| target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" | |
| target triple = "x86_64-unknown-linux-gnu" | |
| ; Function Attrs: nounwind uwtable | |
| define void @foo(ptr %a, ptr %b) #0 { | |
| ; CHECK-LABEL: @foo( | |
| ; CHECK-NEXT: entry: | |
| ; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[A:%.*]], i64 64) ] | |
| ; CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[B:%.*]], i64 64) ] | |
| ; CHECK-NEXT: br label [[FOR_BODY:%.*]] | |
| ; CHECK: for.body: | |
| ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ] | |
| ; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds nuw [4 x i8], ptr [[B]], i64 [[INDVARS_IV]] | |
| ; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[ARRAYIDX]], align 4 | |
| ; CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[TMP0]], 1 | |
| ; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds nuw [4 x i8], ptr [[A]], i64 [[INDVARS_IV]] | |
| ; CHECK-NEXT: store i32 [[ADD]], ptr [[ARRAYIDX5]], align 4 | |
| ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 16 | |
| ; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[INDVARS_IV_NEXT]] to i32 | |
| ; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[TMP1]], 1648 | |
| ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]] | |
| ; CHECK: for.end: | |
| ; CHECK-NEXT: ret void | |
| ; | |
| entry: | |
| %ptrint = ptrtoint ptr %a to i64 | |
| %maskedptr = and i64 %ptrint, 63 | |
| %maskcond = icmp eq i64 %maskedptr, 0 | |
| tail call void @llvm.assume(i1 %maskcond) | |
| %ptrint1 = ptrtoint ptr %b to i64 | |
| %maskedptr2 = and i64 %ptrint1, 63 | |
| %maskcond3 = icmp eq i64 %maskedptr2, 0 | |
| tail call void @llvm.assume(i1 %maskcond3) | |
| br label %for.body | |
| for.body: ; preds = %entry, %for.body | |
| %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] | |
| %arrayidx = getelementptr inbounds i32, ptr %b, i64 %indvars.iv | |
| %0 = load i32, ptr %arrayidx, align 4 | |
| %add = add nsw i32 %0, 1 | |
| %arrayidx5 = getelementptr inbounds i32, ptr %a, i64 %indvars.iv | |
| store i32 %add, ptr %arrayidx5, align 4 | |
| %indvars.iv.next = add nuw nsw i64 %indvars.iv, 16 | |
| %1 = trunc i64 %indvars.iv.next to i32 | |
| %cmp = icmp slt i32 %1, 1648 | |
| br i1 %cmp, label %for.body, label %for.end | |
| for.end: ; preds = %for.body | |
| ret void | |
| } | |
| ; Function Attrs: nounwind | |
| declare void @llvm.assume(i1) #1 | |
| attributes #0 = { nounwind uwtable } | |
| attributes #1 = { nounwind } |