brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 32d803e Raw
85 lines · plain
1; RUN: opt -passes='require<domtree>,instcombine<no-verify-fixpoint>,require<domtree>' -S < %s | FileCheck %s2; Note: The -loops above can be anything that requires the domtree, and is3; necessary to work around a pass-manager bug.4 5; In _Z3fooR1s we can only infer nuw on the gep after the IV has been6; simplified, which we can't do in one iteration. (Note that nowadays7; LoopUnroll would pre-simplify the IV and avoid the issue.)8 9target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"10target triple = "x86_64-unknown-linux-gnu"11 12%struct.s = type { ptr }13 14; Function Attrs: nounwind uwtable15define void @_Z3fooR1s(ptr nocapture readonly dereferenceable(8) %x) #0 {16 17; CHECK-LABEL: @_Z3fooR1s18; CHECK: call void @llvm.assume19; CHECK-NOT: call void @llvm.assume20 21entry:22  %0 = load ptr, ptr %x, align 823  %ptrint = ptrtoint ptr %0 to i6424  %maskedptr = and i64 %ptrint, 3125  %maskcond = icmp eq i64 %maskedptr, 026  br label %for.body27 28for.body:                                         ; preds = %for.body, %entry29  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next.1, %for.body ]30  tail call void @llvm.assume(i1 %maskcond)31  %arrayidx = getelementptr inbounds double, ptr %0, i64 %indvars.iv32  %1 = load double, ptr %arrayidx, align 1633  %add = fadd double %1, 1.000000e+0034  tail call void @llvm.assume(i1 %maskcond)35  %mul = fmul double %add, 2.000000e+0036  store double %mul, ptr %arrayidx, align 1637  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 138  tail call void @llvm.assume(i1 %maskcond)39  %arrayidx.1 = getelementptr inbounds double, ptr %0, i64 %indvars.iv.next40  %2 = load double, ptr %arrayidx.1, align 841  %add.1 = fadd double %2, 1.000000e+0042  tail call void @llvm.assume(i1 %maskcond)43  %mul.1 = fmul double %add.1, 2.000000e+0044  store double %mul.1, ptr %arrayidx.1, align 845  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv.next, 146  %exitcond.1 = icmp eq i64 %indvars.iv.next, 159947  br i1 %exitcond.1, label %for.end, label %for.body48 49for.end:                                          ; preds = %for.body50  ret void51}52 53declare align 8 ptr @get()54 55; Check that redundant align assume is removed56; CHECK-LABEL: @test57; CHECK-NOT: call void @llvm.assume58define void @test1() {59  %p = call align 8 ptr @get()60  %ptrint = ptrtoint ptr %p to i6461  %maskedptr = and i64 %ptrint, 762  %maskcond = icmp eq i64 %maskedptr, 063  call void @llvm.assume(i1 %maskcond)64  ret void65}66 67; Check that redundant align assume is removed68; CHECK-LABEL: @test69; CHECK-NOT: call void @llvm.assume70define void @test3() {71  %p = alloca i8, align 872  %ptrint = ptrtoint ptr %p to i6473  %maskedptr = and i64 %ptrint, 774  %maskcond = icmp eq i64 %maskedptr, 075  call void @llvm.assume(i1 %maskcond)76  ret void77}78 79; Function Attrs: nounwind80declare void @llvm.assume(i1) #181 82attributes #0 = { nounwind uwtable }83attributes #1 = { nounwind }84 85