brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 7433606 Raw
35 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt < %s -passes=correlated-propagation -S | FileCheck %s3 4; Make sure that the optimization does not introduce immediate UB.5 6define i8 @test(i16 %x) {7; CHECK-LABEL: define range(i8 -128, 1) i8 @test(8; CHECK-SAME: i16 [[X:%.*]]) {9; CHECK-NEXT:  [[ENTRY:.*]]:10; CHECK-NEXT:    [[OR:%.*]] = or i16 [[X]], 111; CHECK-NEXT:    [[CONV:%.*]] = trunc i16 [[OR]] to i812; CHECK-NEXT:    [[MIN:%.*]] = call noundef i8 @llvm.smin.i8(i8 [[CONV]], i8 0)13; CHECK-NEXT:    [[COND:%.*]] = icmp eq i16 [[X]], 014; CHECK-NEXT:    br i1 [[COND]], label %[[IF_END:.*]], label %[[IF_THEN:.*]]15; CHECK:       [[IF_THEN]]:16; CHECK-NEXT:    br label %[[IF_END]]17; CHECK:       [[IF_END]]:18; CHECK-NEXT:    [[RES:%.*]] = phi i8 [ [[MIN]], %[[ENTRY]] ], [ 0, %[[IF_THEN]] ]19; CHECK-NEXT:    ret i8 [[RES]]20;21entry:22  %or = or i16 %x, 123  %conv = trunc i16 %or to i824  %min = call noundef i8 @llvm.smin.i8(i8 %conv, i8 0)25  %cond = icmp eq i16 %x, 026  br i1 %cond, label %if.end, label %if.then27 28if.then:29  br label %if.end30 31if.end:32  %res = phi i8 [ %min, %entry ], [ 0, %if.then ]33  ret i8 %res34}35