1;RUN: opt -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -mtriple=riscv32 < %s | FileCheck %s 2 3; Test case taken from test/Transforms/SimplifyCFG/ARM/select-trunc-i64.ll. 4; A correct implementation of isTruncateFree allows this test case to be 5; reduced to a single basic block. 6 7; CHECK-LABEL: select_trunc_i64 8; CHECK-NOT: br 9; CHECK: select 10; CHECK: select 11define i32 @select_trunc_i64(i32 %a, i32 %b) { 12entry: 13 %conv = sext i32 %a to i64 14 %conv1 = sext i32 %b to i64 15 %add = add nsw i64 %conv1, %conv 16 %cmp = icmp sgt i64 %add, 2147483647 17 br i1 %cmp, label %cond.end7, label %cond.false 18 19cond.false: ; preds = %entry 20 %0 = icmp sgt i64 %add, -2147483648 21 %cond = select i1 %0, i64 %add, i64 -2147483648 22 %extract.t = trunc i64 %cond to i32 23 br label %cond.end7 24 25cond.end7: ; preds = %cond.false, %entry 26 %cond8.off0 = phi i32 [ 2147483647, %entry ], [ %extract.t, %cond.false ] 27 ret i32 %cond8.off0 28} 29