Skip to content

Commit 80dba72

Browse files
aqjunehyeongyukim
authored andcommitted
[Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default
Turning on `enable_noundef_analysis` flag allows better codegen by removing freeze instructions. I modified clang by renaming `enable_noundef_analysis` flag to `disable-noundef-analysis` and turning it off by default. Test updates are made as a separate patch: D108453 Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D105169
1 parent da2e1f6 commit 80dba72

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ CODEGENOPT(DisableLifetimeMarkers, 1, 0) ///< Don't emit any lifetime markers
6464
CODEGENOPT(DisableO0ImplyOptNone , 1, 0) ///< Don't annonate function with optnone at O0
6565
CODEGENOPT(ExperimentalStrictFloatingPoint, 1, 0) ///< Enables the new, experimental
6666
///< strict floating point.
67-
CODEGENOPT(EnableNoundefAttrs, 1, 0) ///< Enable emitting `noundef` attributes on IR call arguments and return values
67+
CODEGENOPT(DisableNoundefAttrs, 1, 0) ///< Disable emitting `noundef` attributes on IR call arguments and return values
6868
CODEGENOPT(LegacyPassManager, 1, 0) ///< Use the legacy pass manager.
6969
CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new
7070
///< pass manager.

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5314,9 +5314,9 @@ def disable_free : Flag<["-"], "disable-free">,
53145314
def clear_ast_before_backend : Flag<["-"], "clear-ast-before-backend">,
53155315
HelpText<"Clear the Clang AST before running backend code generation">,
53165316
MarshallingInfoFlag<CodeGenOpts<"ClearASTBeforeBackend">>;
5317-
def enable_noundef_analysis : Flag<["-"], "enable-noundef-analysis">, Group<f_Group>,
5318-
HelpText<"Enable analyzing function argument and return types for mandatory definedness">,
5319-
MarshallingInfoFlag<CodeGenOpts<"EnableNoundefAttrs">>;
5317+
def disable_noundef_analysis : Flag<["-"], "disable-noundef-analysis">, Group<f_Group>,
5318+
HelpText<"Disable analyzing function argument and return types for mandatory definedness">,
5319+
MarshallingInfoFlag<CodeGenOpts<"DisableNoundefAttrs">>;
53205320
def discard_value_names : Flag<["-"], "discard-value-names">,
53215321
HelpText<"Discard value names in LLVM IR">,
53225322
MarshallingInfoFlag<CodeGenOpts<"DiscardValueNames">>;

clang/lib/CodeGen/CGCall.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,7 +2255,7 @@ void CodeGenModule::ConstructAttributeList(
22552255
getLangOpts().Sanitize.has(SanitizerKind::Return);
22562256

22572257
// Determine if the return type could be partially undef
2258-
if (CodeGenOpts.EnableNoundefAttrs && HasStrictReturn) {
2258+
if (!CodeGenOpts.DisableNoundefAttrs && HasStrictReturn) {
22592259
if (!RetTy->isVoidType() && RetAI.getKind() != ABIArgInfo::Indirect &&
22602260
DetermineNoUndef(RetTy, getTypes(), DL, RetAI))
22612261
RetAttrs.addAttribute(llvm::Attribute::NoUndef);
@@ -2390,7 +2390,7 @@ void CodeGenModule::ConstructAttributeList(
23902390

23912391
// Decide whether the argument we're handling could be partially undef
23922392
bool ArgNoUndef = DetermineNoUndef(ParamType, getTypes(), DL, AI);
2393-
if (CodeGenOpts.EnableNoundefAttrs && ArgNoUndef)
2393+
if (!CodeGenOpts.DisableNoundefAttrs && ArgNoUndef)
23942394
Attrs.addAttribute(llvm::Attribute::NoUndef);
23952395

23962396
// 'restrict' -> 'noalias' is done in EmitFunctionProlog when we

0 commit comments

Comments
 (0)