1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[Thumb] Fix infinite loop in ABS expansion (PR41160)

Don't expand ISD::ABS node if its legal.

llvm-svn: 356661
This commit is contained in:
Simon Pilgrim 2019-03-21 12:41:18 +00:00
parent c57b91da41
commit 77a4261c2d
2 changed files with 24 additions and 1 deletions

View File

@ -10391,9 +10391,12 @@ static SDValue PerformABSCombine(SDNode *N,
SelectionDAG &DAG = DCI.DAG;
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
if (!TLI.expandABS(N, res, DAG))
if (TLI.isOperationLegal(N->getOpcode(), N->getValueType(0)))
return SDValue();
if (!TLI.expandABS(N, res, DAG))
return SDValue();
return res;
}

View File

@ -0,0 +1,20 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=thumbv7--- | FileCheck %s
define void @PR41160(<8 x i32>* %p) nounwind {
; CHECK-LABEL: PR41160:
; CHECK: @ %bb.0:
; CHECK-NEXT: vld1.8 {d16, d17}, [r0]
; CHECK-NEXT: vabs.s32 q8, q8
; CHECK-NEXT: vst1.8 {d16, d17}, [r0]!
; CHECK-NEXT: vld1.8 {d16, d17}, [r0]
; CHECK-NEXT: vabs.s32 q8, q8
; CHECK-NEXT: vst1.8 {d16, d17}, [r0]
; CHECK-NEXT: bx lr
%tmp1 = load <8 x i32>, <8 x i32>* %p, align 1
%tmp2 = icmp slt <8 x i32> %tmp1, zeroinitializer
%tmp3 = sub nsw <8 x i32> zeroinitializer, %tmp1
%tmp4 = select <8 x i1> %tmp2, <8 x i32> %tmp3, <8 x i32> %tmp1
store <8 x i32> %tmp4, <8 x i32>* %p, align 1
ret void
}