A test for patch D4978
This is a non-JIT-specific codegen bug (see the linked patch). I only noticed it on X86, but I suspect other platforms may have similar semantics, so it may be an issue there anyway. The fix certainly isn't architecture specific, so it might make sense to have this run on all platforms.
It's tricky. This may be a generic codegen bug, but it will manifest differently on different platforms. I'd be inclined to pick a popular target where it's currently broken (X86?), fix it there, then add the test to test/CodeGen/<Target>.