[PATCH] D149570: [ValueTracking] Add another test for `isSafeToSpeculate` for sdiv/srem; NFC
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 30 22:01:33 PDT 2023
goldstein.w.n created this revision.
goldstein.w.n added reviewers: nikic, spatel, StephenFan.
Herald added a subscriber: asbirlea.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149570
Files:
llvm/test/Transforms/LICM/speculate-div.ll
Index: llvm/test/Transforms/LICM/speculate-div.ll
===================================================================
--- llvm/test/Transforms/LICM/speculate-div.ll
+++ 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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149570.518397.patch
Type: text/x-patch
Size: 991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230501/fe991358/attachment.bin>
More information about the llvm-commits
mailing list