1
; RUN: opt -domtree -instcombine -loops -S < %s | FileCheck %s
2
; Note: The -loops above can be anything that requires the domtree, and is
3
; necessary to work around a pass-manager bug.
5
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6
target triple = "x86_64-unknown-linux-gnu"
8
%struct.s = type { double* }
10
; Function Attrs: nounwind uwtable
11
define void @_Z3fooR1s(%struct.s* nocapture readonly dereferenceable(8) %x) #0 {
13
; CHECK-LABEL: @_Z3fooR1s
14
; CHECK: call void @llvm.assume
15
; CHECK-NOT: call void @llvm.assume
18
%a = getelementptr inbounds %struct.s, %struct.s* %x, i64 0, i32 0
19
%0 = load double*, double** %a, align 8
20
%ptrint = ptrtoint double* %0 to i64
21
%maskedptr = and i64 %ptrint, 31
22
%maskcond = icmp eq i64 %maskedptr, 0
25
for.body: ; preds = %for.body, %entry
26
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.1, %for.body ]
27
tail call void @llvm.assume(i1 %maskcond)
28
%arrayidx = getelementptr inbounds double, double* %0, i64 %indvars.iv
29
%1 = load double, double* %arrayidx, align 16
30
%add = fadd double %1, 1.000000e+00
31
tail call void @llvm.assume(i1 %maskcond)
32
%mul = fmul double %add, 2.000000e+00
33
store double %mul, double* %arrayidx, align 16
34
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
35
tail call void @llvm.assume(i1 %maskcond)
36
%arrayidx.1 = getelementptr inbounds double, double* %0, i64 %indvars.iv.next
37
%2 = load double, double* %arrayidx.1, align 8
38
%add.1 = fadd double %2, 1.000000e+00
39
tail call void @llvm.assume(i1 %maskcond)
40
%mul.1 = fmul double %add.1, 2.000000e+00
41
store double %mul.1, double* %arrayidx.1, align 8
42
%indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.next, 1
43
%exitcond.1 = icmp eq i64 %indvars.iv.next, 1599
44
br i1 %exitcond.1, label %for.end, label %for.body
46
for.end: ; preds = %for.body
50
; Function Attrs: nounwind
51
declare void @llvm.assume(i1) #1
53
attributes #0 = { nounwind uwtable }
54
attributes #1 = { nounwind }