1; RUN: opt -S -instcombine < %s | FileCheck %s 2 3; https://llvm.org/bugs/show_bug.cgi?id=25900 4; An arithmetic shift right of a power of two is not a power 5; of two if the original value is the sign bit. Therefore, 6; we can't transform the sdiv into a udiv. 7 8define i32 @pr25900(i32 %d) { 9 %and = and i32 %d, -2147483648 10; The next 3 lines prevent another fold from masking the bug. 11 %ext = zext i32 %and to i64 12 %or = or i64 %ext, 4294967296 13 %trunc = trunc i64 %or to i32 14 %ashr = ashr exact i32 %trunc, 31 15 %div = sdiv i32 4, %ashr 16 ret i32 %div 17 18; CHECK: sdiv 19} 20 21