Skip to content

Commit 4ab6754

Browse files
committed
Merging r245907:
------------------------------------------------------------------------ r245907 | hfinkel | 2015-08-24 19:48:28 -0400 (Mon, 24 Aug 2015) | 6 lines [PowerPC] PPCVSXFMAMutate should ignore trivial-copy addends We might end up with a trivial copy as the addend, and if so, we should ignore the corresponding FMA instruction. The trivial copy can be coalesced away later, so there's nothing to do here. We should not, however, assert. Fixes PR24544. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_37@252476 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 13640e5 commit 4ab6754

File tree

2 files changed

+46
-5
lines changed

2 files changed

+46
-5
lines changed

lib/Target/PowerPC/PPCVSXFMAMutate.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,14 @@ namespace {
186186
if (!KilledProdOp)
187187
continue;
188188

189-
// For virtual registers, verify that the addend source register
190-
// is live here (as should have been assured above).
191-
assert((!TargetRegisterInfo::isVirtualRegister(AddendSrcReg) ||
192-
LIS->getInterval(AddendSrcReg).liveAt(FMAIdx)) &&
193-
"Addend source register is not live!");
189+
// If the addend copy is used only by this MI, then the addend source
190+
// register is likely not live here. This could be fixed (based on the
191+
// legality checks above, the live range for the addend source register
192+
// could be extended), but it seems likely that such a trivial copy can
193+
// be coalesced away later, and thus is not worth the effort.
194+
if (TargetRegisterInfo::isVirtualRegister(AddendSrcReg) &&
195+
!LIS->getInterval(AddendSrcReg).liveAt(FMAIdx))
196+
continue;
194197

195198
// Transform: (O2 * O3) + O1 -> (O2 * O1) + O3.
196199

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
; RUN: llc < %s | FileCheck %s
2+
target datalayout = "E-m:e-i64:64-n32:64"
3+
target triple = "powerpc64-unknown-linux-gnu"
4+
5+
; Function Attrs: nounwind
6+
define void @LSH_recall_init(float %d_min, float %W) #0 {
7+
entry:
8+
br i1 undef, label %for.body.lr.ph, label %for.end
9+
10+
; CHECK-LABEL: @LSH_recall_init
11+
; CHECK: xsnmsubadp
12+
13+
for.body.lr.ph: ; preds = %entry
14+
%conv3 = fpext float %W to double
15+
br label %for.body
16+
17+
for.body: ; preds = %for.body, %for.body.lr.ph
18+
%div = fdiv fast float 0.000000e+00, 0.000000e+00
19+
%add = fadd fast float %div, %d_min
20+
%conv2 = fpext float %add to double
21+
%0 = tail call double @llvm.sqrt.f64(double %conv2)
22+
%div4 = fdiv fast double %conv3, %0
23+
%call = tail call signext i32 bitcast (i32 (...)* @p_col_helper to i32 (double)*)(double %div4) #2
24+
br label %for.body
25+
26+
for.end: ; preds = %entry
27+
ret void
28+
}
29+
30+
; Function Attrs: nounwind readnone
31+
declare double @llvm.sqrt.f64(double) #1
32+
33+
declare signext i32 @p_col_helper(...) #2
34+
35+
attributes #0 = { nounwind "no-infs-fp-math"="true" "no-nans-fp-math"="true" "target-cpu"="pwr7" "unsafe-fp-math"="true" }
36+
attributes #1 = { nounwind readnone }
37+
attributes #2 = { nounwind }
38+

0 commit comments

Comments
 (0)