optimizer clobber EFLAGS

Using Clang/LLVM 3.6.0 we are observing a case where the optimizations are clobbering EFLAGS on x86_64. This is inconvenient when the status of bit 9 (IF), which controls interrupts, changes.

Here's a simple test program. Assume that the external function foo() modifies the IF bit in EFLAGS.

I remember this bug. :slight_smile: IMO, LLVM should never emit pushf / popf. I’m not sure this patch to fix it ever got committed:


Agreed, never emit pushf/popf. Sorry I never committed the patch, the cmov issue got hairy and I never got to debugging it :slight_smile:
I can get back to it if there’s interest!

You've definitely got some interest here. I've been looking at your patch on http://reviews.llvm.org/D6629 and I think I'm up to speed on where it's stuck. I'll shoot you an email directly unless you want to keep the effort here on the list.

- michael

Off-list is fine, we'll circle back when we come to a conclusion.