Page MenuHomePhabricator

#pragma float_control should be permitted at namespace scope
ClosedPublic

Authored by mibintc on Fri, May 8, 8:17 AM.

Details

Summary

I got a bug report from Intel that https://reviews.llvm.org/D72841 was causing a crash on Windows in vs2017 <numeric> header in /std:c++17 mode, because #pragma float_control is used in a namespace. This patch allows float_control to be in a namespace. I checked the Microsoft compiler to see if the namespace caused the effectiveness of the pragma to be scoped (i.e. a pragma in the namespace would not be effective after the namespace closed) and the pragma is still effective after the namespace. I added the test case that I used for the investigation to the LIT tests. I used this compile line and checked the assembly. cl -c test.cpp -Fatest.asm /arch:AVX2 -O2 ; when the pragma is in effect the div instruction is not eliminated.

Diff Detail

Event Timeline

mibintc created this revision.Fri, May 8, 8:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptFri, May 8, 8:17 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

No this patch isn't ready yet. i see an assertion if try to instantiate a template function when the template has enabled floating point settings

mibintc updated this revision to Diff 263020.Sat, May 9, 9:01 AM

I corrected the assertion error by propagating usesFPIntrin flag from the template function to the template instantiation and added a test case. Ready for review.

This revision was not accepted when it landed; it landed in state Needs Review.Tue, May 12, 6:25 AM
This revision was automatically updated to reflect the committed changes.