Walter's talk on D backend

Dibyendu Majumdar mobile at majumdar.org.uk
Mon Sep 23 18:59:13 UTC 2024


On Monday, 23 September 2024 at 16:57:47 UTC, Dibyendu Majumdar 
wrote:
> On Monday, 23 September 2024 at 08:44:04 UTC, Walter Bright 
> wrote:
>> On 9/23/2024 1:23 AM, claptrap wrote:
>>> Thats why OP asked about phi instructions, you need them to 
>>> merge the versions of a variable that reach the start of a 
>>> basic block. Or at least you need to have some mechanism for 
>>> it.
>>
>> Seems to me it's the same thing from a different angle.
>
> It isn't?
>
> Perhaps you could show what the IR looks like for something 
> like this:
>
>
> ```
> int x = foo();
> if (x == 1)
>    x = 5;
> else
>    x = 6;
> ```

If the IR is SSA then it needs to output something like this:

```
int x = foo();
if (x == 1)
    x1 = 5;
else
    x2 = 6;
x3 = phi(x1,x2)
```



More information about the Digitalmars-d mailing list