forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[InstCombine] Fix miscompilation in PR83947 (llvm#83993)
https://github.com/llvm/llvm-project/blob/762f762504967efbe159db5c737154b989afc9bb/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp#L394-L407 Comment from @topperc: > This transforms assumes the mask is a non-zero splat. We only know its a splat and not provably all 0s. The mask is a constexpr that includes the address of the global variable. We can't resolve the constant expression to an exact value. Fixes llvm#83947.
- Loading branch information
Showing
4 changed files
with
105 additions
and
5 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
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
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,67 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4 | ||
; RUN: opt -S -passes=instcombine < %s | FileCheck %s | ||
|
||
@c = global i32 0, align 4 | ||
@b = global i32 0, align 4 | ||
|
||
define void @masked_scatter1() { | ||
; CHECK-LABEL: define void @masked_scatter1() { | ||
; CHECK-NEXT: call void @llvm.masked.scatter.nxv4i32.nxv4p0(<vscale x 4 x i32> zeroinitializer, <vscale x 4 x ptr> shufflevector (<vscale x 4 x ptr> insertelement (<vscale x 4 x ptr> poison, ptr @c, i64 0), <vscale x 4 x ptr> poison, <vscale x 4 x i32> zeroinitializer), i32 4, <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 icmp eq (ptr getelementptr inbounds (i32, ptr @b, i64 1), ptr @c), i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer)) | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @llvm.masked.scatter.nxv4i32.nxv4p0(<vscale x 4 x i32> zeroinitializer, <vscale x 4 x ptr> splat (ptr @c), i32 4, <vscale x 4 x i1> splat (i1 icmp eq (ptr getelementptr (i32, ptr @b, i64 1), ptr @c))) | ||
ret void | ||
} | ||
|
||
define void @masked_scatter2() { | ||
; CHECK-LABEL: define void @masked_scatter2() { | ||
; CHECK-NEXT: store i32 0, ptr @c, align 4 | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> zeroinitializer, <2 x ptr> splat (ptr @c), i32 4, <2 x i1> splat (i1 true)) | ||
ret void | ||
} | ||
|
||
define void @masked_scatter3() { | ||
; CHECK-LABEL: define void @masked_scatter3() { | ||
; CHECK-NEXT: store i32 0, ptr @c, align 4 | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> zeroinitializer, <2 x ptr> splat (ptr @c), i32 4, <2 x i1> undef) | ||
ret void | ||
} | ||
|
||
define void @masked_scatter4() { | ||
; CHECK-LABEL: define void @masked_scatter4() { | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> zeroinitializer, <2 x ptr> splat (ptr @c), i32 4, <2 x i1> splat (i1 false)) | ||
ret void | ||
} | ||
|
||
define void @masked_scatter5() { | ||
; CHECK-LABEL: define void @masked_scatter5() { | ||
; CHECK-NEXT: store i32 0, ptr @c, align 4 | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> zeroinitializer, <2 x ptr> splat (ptr @c), i32 4, <2 x i1> <i1 true, i1 false>) | ||
ret void | ||
} | ||
|
||
define void @masked_scatter6() { | ||
; CHECK-LABEL: define void @masked_scatter6() { | ||
; CHECK-NEXT: store i32 0, ptr @c, align 4 | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> zeroinitializer, <2 x ptr> splat (ptr @c), i32 4, <2 x i1> <i1 undef, i1 false>) | ||
ret void | ||
} | ||
|
||
define void @masked_scatter7() { | ||
; CHECK-LABEL: define void @masked_scatter7() { | ||
; CHECK-NEXT: call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> zeroinitializer, <2 x ptr> <ptr @c, ptr @c>, i32 4, <2 x i1> <i1 icmp eq (ptr getelementptr inbounds (i32, ptr @b, i64 1), ptr @c), i1 icmp eq (ptr getelementptr inbounds (i32, ptr @b, i64 1), ptr @c)>) | ||
; CHECK-NEXT: ret void | ||
; | ||
call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> zeroinitializer, <2 x ptr> splat (ptr @c), i32 4, <2 x i1> splat (i1 icmp eq (ptr getelementptr (i32, ptr @b, i64 1), ptr @c))) | ||
ret void | ||
} |