; RUN: opt < %s -instcombine -S | FileCheck %s ; Instcombine should be able to eliminate the 'lshr' shift because ; the 'select' uses constant source operands that will be shifted ; by a constant amount. define i8 @fold_lshr(i1 %arg) { ; CHECK-LABEL: @fold_lshr( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[V8:%.*]] = select i1 [[ARG:%.*]], i64 5369111361, i64 5369111591 ; CHECK-NEXT: ret i64 [[V8]] entry: %v0 = select i1 %arg, i8 64, i8 0 %v1 = lshr exact i8 %v0, 6 %v2 = xor i8 %v1, 1 %v3 = shl nuw i8 %v0, 57 %v4 = ashr exact i8 %v3, 63 %v5 = sub nsw i8 0, %v2 %v6 = and i8 %v5, 91 %v7 = and i8 %v4, 61 %v8 = add nuw nsw i8 %v7, %v6 ret i8 %v8 }