Process the -freciprocal-math optimization flag (PR20912)
The driver currently accepts but ignores the -freciprocal-math flag. This patch passes the flag through and enables 'arcp' fast-math-flag generation in IR. Note that this change does not actually enable the optimization for any target. The reassociation optimization that this flag specifies was implemented by http://reviews.llvm.org/D6334 : http://llvm.org/viewvc/llvm-project?view=revision&revision=222510 Because the optimization is done in the backend rather than IR, the backend must be modified to understand instruction-level fast-math-flags or a new function-level attribute must be created. Also note that -freciprocal-math is independent of any target-specific usage of reciprocal estimate hardware instructions. That requires its own flag ('-mrecip'). https://llvm.org/bugs/show_bug.cgi?id=20912 llvm-svn: 234493
This commit is contained in:
@@ -70,6 +70,9 @@ CodeGenFunction::CodeGenFunction(CodeGenModule &cgm, bool suppressNewContext)
|
||||
if (CGM.getCodeGenOpts().NoSignedZeros) {
|
||||
FMF.setNoSignedZeros();
|
||||
}
|
||||
if (CGM.getCodeGenOpts().ReciprocalMath) {
|
||||
FMF.setAllowReciprocal();
|
||||
}
|
||||
Builder.SetFastMathFlags(FMF);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user