brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1002 B · 26a7191 Raw
36 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -O1 -S < %s | FileCheck %s3; RUN: opt -O2 -S < %s | FileCheck %s4; RUN: opt -O3 -S < %s | FileCheck %s5 6; srem should be folded based on branch conditions7; This can be done by IPSCCP or CVP.8 9define i32 @PR57472(i32 noundef %x) {10; CHECK-LABEL: @PR57472(11; CHECK-NEXT:  entry:12; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[X:%.*]], -113; CHECK-NEXT:    [[REM:%.*]] = and i32 [[X]], 1514; CHECK-NEXT:    [[SPEC_SELECT:%.*]] = select i1 [[CMP]], i32 [[REM]], i32 4215; CHECK-NEXT:    ret i32 [[SPEC_SELECT]]16;17entry:18  %x.addr = alloca i32, align 419  store i32 %x, ptr %x.addr, align 420  %0 = load i32, ptr %x.addr, align 421  %cmp = icmp sge i32 %0, 022  br i1 %cmp, label %cond.true, label %cond.false23 24cond.true:25  %1 = load i32, ptr %x.addr, align 426  %rem = srem i32 %1, 1627  br label %cond.end28 29cond.false:30  br label %cond.end31 32cond.end:33  %cond = phi i32 [ %rem, %cond.true ], [ 42, %cond.false ]34  ret i32 %cond35}36