diff --git a/llvm/test/Transforms/LICM/speculate-div.ll b/llvm/test/Transforms/LICM/speculate-div.ll --- a/llvm/test/Transforms/LICM/speculate-div.ll +++ b/llvm/test/Transforms/LICM/speculate-div.ll @@ -92,6 +92,29 @@ br label %loop } +define void @srem_ok3(i16 %nn, i16 %xx) { +; CHECK-LABEL: @srem_ok3( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[N:%.*]] = and i16 [[NN:%.*]], 123 +; CHECK-NEXT: [[X:%.*]] = add nuw nsw i16 [[XX:%.*]], 1 +; CHECK-NEXT: br label [[LOOP:%.*]] +; CHECK: loop: +; CHECK-NEXT: call void @maythrow() +; CHECK-NEXT: [[DIV:%.*]] = srem i16 [[N]], [[X]] +; CHECK-NEXT: call void @use(i16 [[DIV]]) +; CHECK-NEXT: br label [[LOOP]] +; +entry: + %n = and i16 %nn, 123 + %x = add nuw nsw i16 %xx, 1 + br label %loop +loop: + call void @maythrow() + %div = srem i16 %n, %x + call void @use(i16 %div) + br label %loop +} + define void @udiv_not_ok(i16 %n, i16 %xx) { ; CHECK-LABEL: @udiv_not_ok( ; CHECK-NEXT: entry: