Patchwork [cxx-mem-model] expand_atomic_load: Handle an empty target

login
register
mail settings
Submitter Aldy Hernandez
Date Oct. 20, 2011, 8:54 p.m.
Message ID <4EA08A96.4070209@redhat.com>
Download mbox | patch
Permalink /patch/120874/
State New
Headers show

Comments

Aldy Hernandez - Oct. 20, 2011, 8:54 p.m.
Found this while testing the branch on ia64.  The call to 
expand_val_compare_and_swap() above returns NULL_RTX when it can't find 
a suitable instruction.

OK for branch?
* optabs.c (expand_atomic_load): Handle a NULL target.
Andrew MacLeod - Oct. 20, 2011, 8:56 p.m.
On 10/20/2011 04:54 PM, Aldy Hernandez wrote:
> Found this while testing the branch on ia64.  The call to 
> expand_val_compare_and_swap() above returns NULL_RTX when it can't 
> find a suitable instruction.
>
> OK for branch?

yes.   btw, did you audit the other new expand routines to see if they 
handled a NULL return target as well?

Andrew
Aldy Hernandez - Oct. 20, 2011, 9:05 p.m.
On 10/20/11 15:56, Andrew MacLeod wrote:
> On 10/20/2011 04:54 PM, Aldy Hernandez wrote:
>> Found this while testing the branch on ia64. The call to
>> expand_val_compare_and_swap() above returns NULL_RTX when it can't
>> find a suitable instruction.
>>
>> OK for branch?
>
> yes. btw, did you audit the other new expand routines to see if they
> handled a NULL return target as well?
>
> Andrew

They seem ok, but I am re-running tests on ia64 to see if I find other 
similar failures.  If I do, I will submit fixes.

Aldy

Patch

Index: optabs.c
===================================================================
--- optabs.c	(revision 180273)
+++ optabs.c	(working copy)
@@ -7140,7 +7140,7 @@  expand_atomic_load (rtx target, rtx mem,
       return target;
     }
 
-  if (target == const0_rtx)
+  if (!target || target == const0_rtx)
     target = gen_reg_rtx (mode);
 
   /* Emit the appropriate barrier before the load.  */