-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
luxufan
committed
Jun 18, 2023
1 parent
ee8b8d6
commit f2d9f84
Showing
1 changed file
with
19 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,43 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2 | ||
; RUN: opt < %s -passes=sccp -S | FileCheck %s | ||
|
||
; Test that SCCP has basic knowledge of when div can nuke overdefined values. | ||
|
||
; 0 / X = 0 even if X is overdefined. | ||
; CHECK-LABEL: test1 | ||
; CHECK-NEXT: ret i32 0 | ||
define i32 @test1(i32 %foo) { | ||
; CHECK-LABEL: define i32 @test1 | ||
; CHECK-SAME: (i32 [[FOO:%.*]]) { | ||
; CHECK-NEXT: ret i32 0 | ||
; | ||
%tinkywinky = udiv i32 0, %foo | ||
ret i32 %tinkywinky | ||
} | ||
|
||
; CHECK-LABEL: test2 | ||
; CHECK-NEXT: ret i32 0 | ||
define i32 @test2(i32 %foo) { | ||
; CHECK-LABEL: define i32 @test2 | ||
; CHECK-SAME: (i32 [[FOO:%.*]]) { | ||
; CHECK-NEXT: ret i32 0 | ||
; | ||
%tinkywinky = sdiv i32 0, %foo | ||
ret i32 %tinkywinky | ||
} | ||
|
||
; CHECK-LABEL: test3 | ||
; CHECK: ret i32 %tinkywinky | ||
define i32 @test3(i32 %foo) { | ||
; CHECK-LABEL: define i32 @test3 | ||
; CHECK-SAME: (i32 [[FOO:%.*]]) { | ||
; CHECK-NEXT: [[TINKYWINKY:%.*]] = udiv i32 [[FOO]], 0 | ||
; CHECK-NEXT: ret i32 [[TINKYWINKY]] | ||
; | ||
%tinkywinky = udiv i32 %foo, 0 | ||
ret i32 %tinkywinky | ||
} | ||
|
||
; CHECK-LABEL: test4 | ||
; CHECK: ret i32 %tinkywinky | ||
define i32 @test4(i32 %foo) { | ||
; CHECK-LABEL: define i32 @test4 | ||
; CHECK-SAME: (i32 [[FOO:%.*]]) { | ||
; CHECK-NEXT: [[TINKYWINKY:%.*]] = sdiv i32 [[FOO]], 0 | ||
; CHECK-NEXT: ret i32 [[TINKYWINKY]] | ||
; | ||
%tinkywinky = sdiv i32 %foo, 0 | ||
ret i32 %tinkywinky | ||
} |