r290539 - [inline-asm]No error for conflict between inputs\outputs and clobber list
Yatsina, Marina via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 29 04:35:15 PST 2016
Adding Ziv, the author of this patch.
From: Chandler Carruth [mailto:chandlerc at google.com]
Sent: Thursday, December 29, 2016 11:57
To: Yatsina, Marina <marina.yatsina at intel.com>; cfe-commits at lists.llvm.org
Subject: Re: r290539 - [inline-asm]No error for conflict between inputs\outputs and clobber list
On Mon, Dec 26, 2016 at 4:34 AM Marina Yatsina via cfe-commits <cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org>> wrote:
Date: Mon Dec 26 06:23:42 2016
New Revision: 290539
[inline-asm]No error for conflict between inputs\outputs and clobber list
According to extended asm syntax, a case where the clobber list includes a variable from the inputs or outputs should be an error - conflict.
const long double a = 0.0;
double t1 = a;
__asm__ ("fucompp": "=a" (b) : "u" (t1), "t" (t1) : "cc", "st", "st(1)");
This should conflict with the output - t1 which is st, and st which is st aswell.
The patch fixes it.
Commit on behald of Ziv Izhar.
Differential Revision: https://reviews.llvm.org/D15075
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Dec 26 06:23:42 2016
@@ -7069,6 +7069,10 @@ let CategoryName = "Inline Assembly Issu
"constraint '%0' is already present here">;
+ def error_inoutput_conflict_with_clobber : Error<
+ "asm-specifier for input or output variable conflicts with asm"
+ " clobber list">;
Clang generally works to avoid this kind of error message. All this does is say "there was a problem of this kind" without identifying any of the specifics. And for this error in particular I think this is of the utmost importance. Developers are not going to understand what went wrong here.
I would suggest at a minimum to enhance this to explain:
1) What operands and clobbers conflict, preferably with source ranges underlining them.
2) Why they conflict (for example the fact that "D" means the di register group, of which "%rdi" is a member)
Beyond that, I wonder if you could add a note suggesting to remove the clobber if the input (or output) operand is sufficient.
You can make this note explain carefully the case where something would need to be added to the inputs or outputs instead, but I think it at least makes sense to clarify that this will be a common fix and what to look out for that might make it an incorrect fix.
Intel Israel (74) Limited
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits