Expected constant simplification not happening


the appended IR code does not optimize to my liking :slight_smile:

this is the interesting part in x86_64, that got produced via clang -Os:

[cc’ing Zia]

We have this transform with -Os for some cases after:

but something in this example is causing the transform to not trigger.

I filed a related bug here:

If you can file your test case(s) in a bug report, that would be the best way to track progress on solving it. Thanks!

I took a quick look at this and relaxed the conditions under which we prevent immediate subsumption (specifically, optsize and instruction shape), and I managed to merge 2 of those immediates. I need to dig in a little more to see why it didn’t catch the third. I suspect a phase ordering issue.

I’ll take a closer look at this as soon as I get a chance. If you could please attach a testcase to the bug report, I’d appreciate it.




Has there been any progress on this topic ? The 3.9 optimizer output is still the same as I just looked.



Sanjay Patel schrieb:

AFAIK, there haven’t been any changes in this area. It’s in my bug queue (that only seem to get longer!), but I don’t have immediate plans to look at it.