-
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.
[GVN] Drop nsw/nuw flags when replacing the result of a with.overflow…
… intrinsic with a overflowing binary operator (#82935) Alive2: https://alive2.llvm.org/ce/z/gyL7mn Fixes #82884. (cherry picked from commit 892b4be)
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 | ||
; RUN: opt -S -passes=gvn < %s | FileCheck %s | ||
|
||
; Make sure nsw/nuw flags are dropped. | ||
|
||
define i32 @pr82884(i32 %x) { | ||
; CHECK-LABEL: define i32 @pr82884( | ||
; CHECK-SAME: i32 [[X:%.*]]) { | ||
; CHECK-NEXT: [[MUL:%.*]] = mul i32 [[X]], [[X]] | ||
; CHECK-NEXT: call void @use(i32 [[MUL]]) | ||
; CHECK-NEXT: [[MUL2:%.*]] = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[X]], i32 [[X]]) | ||
; CHECK-NEXT: ret i32 [[MUL]] | ||
; | ||
%mul = mul nsw nuw i32 %x, %x | ||
call void @use(i32 %mul) | ||
%mul2 = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 %x, i32 %x) | ||
%ret = extractvalue { i32, i1 } %mul2, 0 | ||
ret i32 %ret | ||
} | ||
|
||
declare void @use(i32) |