-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypePromotion] Replace Zext to Truncate for the case src bitwidth is…
… larger Fix: llvm/llvm-project#58843 Reviewed By: samtebbs Differential Revision: https://reviews.llvm.org/D137613 (cherry picked from commit 597f444)
- Loading branch information
Showing
2 changed files
with
27 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,20 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; RUN: opt -mtriple=aarch64 -type-promotion -verify -S %s -o - | FileCheck %s | ||
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" | ||
|
||
; Check the case don't crash due to zext source type bitwidth | ||
; larger than dest type bitwidth. | ||
define i1 @test(i8 %arg) { | ||
; CHECK-LABEL: @test( | ||
; CHECK-NEXT: [[EXT1:%.*]] = zext i8 [[ARG:%.*]] to i64 | ||
; CHECK-NEXT: [[TMP1:%.*]] = and i64 [[EXT1]], 7 | ||
; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP1]] to i32 | ||
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[TMP2]], 0 | ||
; CHECK-NEXT: ret i1 [[CMP]] | ||
; | ||
%ext1 = zext i8 %arg to i64 | ||
%trunc = trunc i64 %ext1 to i3 | ||
%ext2 = zext i3 %trunc to i8 | ||
%cmp = icmp ne i8 %ext2, 0 | ||
ret i1 %cmp | ||
} |