xref: /llvm-project/llvm/test/Transforms/InstCombine/annotation-intrinsic.ll (revision 9114ac67a986400155b8b82013d09a9e4f48e534)
1926cca96SClement Courbet; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2acdc419cSBjorn Pettersson; RUN: opt -passes=instcombine %s -S -o - | FileCheck %s
3926cca96SClement Courbet
4926cca96SClement Courbet; This tests that llvm.annotation does not prevent load combining.
5926cca96SClement Courbet
6926cca96SClement Courbettarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
7926cca96SClement Courbettarget triple = "x86_64-grtev4-linux-gnu"
8926cca96SClement Courbet
94ab40ecaSBjorn Petterssondeclare i32 @llvm.annotation.i32(i32, ptr, ptr, i32) #1
10926cca96SClement Courbet
114ab40ecaSBjorn Petterssondefine dso_local i32 @annotated(ptr %c) local_unnamed_addr #0 {
12926cca96SClement Courbet; CHECK-LABEL: @annotated(
13926cca96SClement Courbet; CHECK-NEXT:  entry:
144ab40ecaSBjorn Pettersson; CHECK-NEXT:    [[TMP0:%.*]] = load i32, ptr [[C:%.*]], align 4
15*9114ac67SAlex Richardson; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @llvm.annotation.i32.p0(i32 [[TMP0]], ptr undef, ptr undef, i32 undef)
16ca28e323SNikita Popov; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP1]], [[TMP0]]
17926cca96SClement Courbet; CHECK-NEXT:    ret i32 [[ADD]]
18926cca96SClement Courbet;
19926cca96SClement Courbetentry:
204ab40ecaSBjorn Pettersson  %0 = load i32, ptr %c, align 4
214ab40ecaSBjorn Pettersson  %1 = call i32 @llvm.annotation.i32(i32 %0, ptr undef, ptr undef, i32 undef)
224ab40ecaSBjorn Pettersson  %2 = load i32, ptr %c, align 4
23926cca96SClement Courbet  %add = add nsw i32 %1, %2
24926cca96SClement Courbet  ret i32 %add
25926cca96SClement Courbet}
26926cca96SClement Courbet
27926cca96SClement Courbetattributes #0 = { nofree nounwind uwtable willreturn mustprogress }
28