Skip to content

Commit

Permalink
[ConstantFolding] Fix crash when folding vector llvm.is.fpclass
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D148803
  • Loading branch information
jayfoad committed Apr 20, 2023
1 parent e46fcab commit 5fc6425
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/Analysis/VectorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ bool llvm::isTriviallyVectorizable(Intrinsic::ID ID) {
case Intrinsic::pow:
case Intrinsic::fma:
case Intrinsic::fmuladd:
case Intrinsic::is_fpclass:
case Intrinsic::powi:
case Intrinsic::canonicalize:
case Intrinsic::fptosi_sat:
Expand All @@ -103,6 +104,7 @@ bool llvm::isVectorIntrinsicWithScalarOpAtArg(Intrinsic::ID ID,
case Intrinsic::abs:
case Intrinsic::ctlz:
case Intrinsic::cttz:
case Intrinsic::is_fpclass:
case Intrinsic::powi:
return (ScalarOpdIdx == 1);
case Intrinsic::smul_fix:
Expand Down
12 changes: 12 additions & 0 deletions llvm/test/Transforms/InstSimplify/is_fpclass.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt < %s -S -passes=instsimplify | FileCheck %s

define <2 x i1> @f() {
; CHECK-LABEL: define <2 x i1> @f() {
; CHECK-NEXT: ret <2 x i1> zeroinitializer
;
%i = call <2 x i1> @llvm.is.fpclass.v2f16(<2 x half> <half 0xH7C00, half 0xH7C00>, i32 3)
ret <2 x i1> %i
}

declare <2 x i1> @llvm.is.fpclass.v2f16(<2 x half>, i32 immarg)

0 comments on commit 5fc6425

Please sign in to comment.