diff options
author | Sanjay Patel <spatel@rotateright.com> | 2015-12-03 01:25:12 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2015-12-03 01:25:12 +0000 |
commit | a50dd2aa4c0f83f429f32e30c5e2d59e549c5c8d (patch) | |
tree | 1390c1e732c30fda70dc787050aff2b254ccf481 /test | |
parent | 82c87a4b94fbeaf860bcdd363ffab7e245c9c468 (diff) | |
download | clang-a50dd2aa4c0f83f429f32e30c5e2d59e549c5c8d.tar.gz |
change an assert when generating fmuladd to an ordinary 'if' check (PR25719)
We don't want to generate fmuladd if there's a use of the fmul expression, but this shouldn't be an assert.
The test case is derived from the commit message for r253337:
http://reviews.llvm.org/rL253337
That commit reverted r253269:
http://reviews.llvm.org/rL253269
...but the bug exists independently of the default fp-contract setting. It just became easier to hit with that change.
PR25719:
https://llvm.org/bugs/show_bug.cgi?id=25719
Differential Revision: http://reviews.llvm.org/D15165
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254573 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/fp-contract-pragma.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CodeGen/fp-contract-pragma.cpp b/test/CodeGen/fp-contract-pragma.cpp index 86e236e4db..1ea974f5fe 100644 --- a/test/CodeGen/fp-contract-pragma.cpp +++ b/test/CodeGen/fp-contract-pragma.cpp @@ -62,3 +62,15 @@ float fp_contract_6(float a, float b, float c) { return a * b + c; } +// If the multiply has multiple uses, don't produce fmuladd. +// This used to assert (PR25719): +// https://llvm.org/bugs/show_bug.cgi?id=25719 + +float fp_contract_7(float a, float b, float c) { +// CHECK: _Z13fp_contract_7fff +// CHECK: %mul = fmul float %b, 2.000000e+00 +// CHECK-NEXT: fsub float %mul, %c + #pragma STDC FP_CONTRACT ON + return (a = 2 * b) - c; +} + |