65 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt < %s -O1 -S | FileCheck %s3 4target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"5target triple = "x86_64-apple-macosx10.10.0"6 7@a = internal global [3 x i32] zeroinitializer, align 48@b = common global i32 0, align 49 10; The important thing we're checking here is that the value from the memset11; rather than the preceding store is forwarded.12 13define i32 @main() {14; CHECK-LABEL: define noundef i32 @main(15; CHECK-SAME: ) local_unnamed_addr #[[ATTR0:[0-9]+]] {16; CHECK-NEXT: [[ENTRY:.*:]]17; CHECK-NEXT: store i32 3, ptr @b, align 418; CHECK-NEXT: ret i32 019;20entry:21 %retval = alloca i32, align 422 %c = alloca [1 x i32], align 423 store i32 0, ptr %retval, align 424 call void @llvm.memset.p0.i64(ptr align 4 %c, i8 0, i64 4, i1 false)25 store i32 1, ptr getelementptr inbounds ([3 x i32], ptr @a, i64 0, i64 2), align 426 store i32 0, ptr @b, align 427 br label %for.cond28 29for.cond: ; preds = %for.inc, %entry30 %0 = load i32, ptr @b, align 431 %cmp = icmp slt i32 %0, 332 br i1 %cmp, label %for.body, label %for.end33 34for.body: ; preds = %for.cond35 %1 = load i32, ptr @b, align 436 %idxprom = sext i32 %1 to i6437 %arrayidx = getelementptr inbounds [3 x i32], ptr @a, i64 0, i64 %idxprom38 store i32 0, ptr %arrayidx, align 439 br label %for.inc40 41for.inc: ; preds = %for.body42 %2 = load i32, ptr @b, align 443 %inc = add nsw i32 %2, 144 store i32 %inc, ptr @b, align 445 br label %for.cond46 47for.end: ; preds = %for.cond48 %3 = load i32, ptr getelementptr inbounds ([3 x i32], ptr @a, i64 0, i64 2), align 449 %cmp1 = icmp ne i32 %3, 050 br i1 %cmp1, label %if.then, label %if.end51 52if.then: ; preds = %for.end53 call void @abort() #354 unreachable55 56if.end: ; preds = %for.end57 ret i32 058}59 60; Function Attrs: nounwind argmemonly61declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind argmemonly62 63; Function Attrs: noreturn nounwind64declare void @abort() noreturn nounwind65