diff options
| author | Daniel Neilson <dneilson@azul.com> | 2018-03-05 18:05:51 +0000 |
|---|---|---|
| committer | Daniel Neilson <dneilson@azul.com> | 2018-03-05 18:05:51 +0000 |
| commit | bdda115e190092abac5a2dc6a2ed8c19e06a4156 (patch) | |
| tree | 4663037fd4d301d724942ddf921a8a679d99afe5 /llvm/test/Transforms | |
| parent | 8452faceaee4a4adee5194d6c6ec7caad760c670 (diff) | |
| download | bcm5719-llvm-bdda115e190092abac5a2dc6a2ed8c19e06a4156.tar.gz bcm5719-llvm-bdda115e190092abac5a2dc6a2ed8c19e06a4156.zip | |
[InstCombine] Don't blow up in foldICmpWithCastAndCast on vector icmp instructions.
Summary:
Presently, InstCombiner::foldICmpWithCastAndCast() implicitly assumes that it is
only invoked with icmp instructions of integer type. If that assumption is broken,
and it is called with an icmp of vector type, then it fails (asserts/crashes).
This patch addresses the deficiency. It allows it to simplify
icmp (ptrtoint x), (ptrtoint/c) of vector type into a compare of the inputs,
much as is done when the type is integer.
Reviewers: apilipenko, fedor.sergeev, mkazantsev, anna
Reviewed By: anna
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44063
llvm-svn: 326730
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/icmp.ll | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index 26d21fb15a0..22f5ba5117b 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -3302,3 +3302,15 @@ define i1 @PR35794(i32* %a) { ret i1 %cmp } +; Don't crash by assuming the compared values are integers. +define <2 x i1> @PR36583(<2 x i8*>) { +; CHECK-LABEL: @PR36583( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[RES:%.*]] = icmp eq <2 x i8*> %0, zeroinitializer +; CHECK-NEXT: ret <2 x i1> [[RES]] +; +entry: + %cast = ptrtoint <2 x i8*> %0 to <2 x i64> + %res = icmp eq <2 x i64> %cast, zeroinitializer + ret <2 x i1> %res +} |

