diff options
author | Sanjay Patel <spatel@rotateright.com> | 2015-07-28 23:28:22 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2015-07-28 23:28:22 +0000 |
commit | 133e68b45cea9fa52c9a519bf287c6eea8ed5bba (patch) | |
tree | 76cf6d7c85229f6eb2891fccbf0c061896302d82 /llvm/test/CodeGen/X86/fdiv-combine.ll | |
parent | 99a47ef90edb97b15becd553b1c9c5d76b9da376 (diff) | |
download | bcm5719-llvm-133e68b45cea9fa52c9a519bf287c6eea8ed5bba.tar.gz bcm5719-llvm-133e68b45cea9fa52c9a519bf287c6eea8ed5bba.zip |
ignore duplicate divisor uses when transforming into reciprocal multiplies (PR24141)
PR24141: https://llvm.org/bugs/show_bug.cgi?id=24141
contains a test case where we have duplicate entries in a node's uses() list.
After r241826, we use CombineTo() to delete dead nodes when combining the uses into
reciprocal multiplies, but this fails if we encounter the just-deleted node again in
the list.
The solution in this patch is to not add duplicate entries to the list of users that
we will subsequently iterate over. For the test case, this avoids triggering the
combine divisors logic entirely because there really is only one user of the divisor.
Differential Revision: http://reviews.llvm.org/D11345
llvm-svn: 243500
Diffstat (limited to 'llvm/test/CodeGen/X86/fdiv-combine.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/fdiv-combine.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fdiv-combine.ll b/llvm/test/CodeGen/X86/fdiv-combine.ll index 34eac62e367..b65e9d01ab8 100644 --- a/llvm/test/CodeGen/X86/fdiv-combine.ll +++ b/llvm/test/CodeGen/X86/fdiv-combine.ll @@ -44,5 +44,24 @@ define double @div3_arcp(double %x, double %y, double %z) #0 { ret double %ret } +define void @PR24141() #0 { +; CHECK-LABEL: PR24141: +; CHECK: callq +; CHECK-NEXT: divsd +; CHECK-NEXT: jmp +entry: + br label %while.body + +while.body: + %x.0 = phi double [ undef, %entry ], [ %div, %while.body ] + %call = call { double, double } @g(double %x.0) + %xv0 = extractvalue { double, double } %call, 0 + %xv1 = extractvalue { double, double } %call, 1 + %div = fdiv double %xv0, %xv1 + br label %while.body +} + +declare { double, double } @g(double) + ; FIXME: If the backend understands 'arcp', then this attribute is unnecessary. attributes #0 = { "unsafe-fp-math"="true" } |