How to prevent optimizer from reordering stuff?

Dan Olson via digitalmars-d-ldc digitalmars-d-ldc at
Sun Mar 15 18:39:16 PDT 2015

David Nadlinger via digitalmars-d-ldc <digitalmars-d-ldc at> writes:

> Hi Dan,
> On 03/14/2015 09:20 PM, Dan Olson via digitalmars-d-ldc wrote:
>> I don't see any attributes for for that function.  I will just paste
>> some of the -output-ll results since nothing sticks out to me.
> Yeah, seems like everything is in order (no pun intended) after the
> main IR-level optimizer. This suggests that the reordering happens on
> the target-specific optimization or instruction selection level. I
> suppose you could try disabling codegen optimizations if you wanted to
> investigate this further.

It is a good puzzle.  For what it is worth, clang does the same thing
with similar code.

>> Maybe that means the compiler can says FPSCR state from my vdiv.f64
>> is undefined across function call boundaries, so ordering should not
>> matter?
> This seems like a reasonable guess. Did you try asking on the LLVM IRC
> channel or mailing list? Depending on the outcome (i.e. if the ABI is
> really to be interpreted that way), we should probably discuss its
> implications for D's FP handling strategy on the main D mailing lists.

I have not asked elsewhere yet.  I'm going to explore the problem a bit
more, then ask.

More information about the digitalmars-d-ldc mailing list