1 ;RUN: opt -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -mtriple=riscv32 < %s | FileCheck %s
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.
7 ; CHECK-LABEL: select_trunc_i64
11 define i32 @select_trunc_i64(i32 %a, i32 %b) {
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
19 cond.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
25 cond.end7: ; preds = %cond.false, %entry
26 %cond8.off0 = phi i32 [ 2147483647, %entry ], [ %extract.t, %cond.false ]