Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 7e9afd4

Browse files
committed
Skip out of SimplifyDemandedBits for BITCAST of f16 to i16
Mirrors the existing exit path for f128, avoiding a crash later on. Differential Revision: https://reviews.llvm.org/D49524 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337506 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent b3e4684 commit 7e9afd4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
11871187
bool OpVTLegal = isOperationLegalOrCustom(ISD::FGETSIGN, VT);
11881188
bool i32Legal = isOperationLegalOrCustom(ISD::FGETSIGN, MVT::i32);
11891189
if ((OpVTLegal || i32Legal) && VT.isSimple() &&
1190+
Op.getOperand(0).getValueType() != MVT::f16 &&
11901191
Op.getOperand(0).getValueType() != MVT::f128) {
11911192
// Cannot eliminate/lower SHL for f128 yet.
11921193
EVT Ty = OpVTLegal ? VT : MVT::i32;

test/CodeGen/X86/pr38038.ll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
; RUN: llc < %s
2+
; PR38038
3+
4+
define i8 @crash(half) {
5+
entry:
6+
%1 = bitcast half %0 to i16
7+
%.lobit = lshr i16 %1, 15
8+
%2 = trunc i16 %.lobit to i8
9+
ret i8 %2
10+
}

0 commit comments

Comments
 (0)