[NFC] Minimize noundef analysis when disabled
authorKevin Athey <kda@google.com>
Wed, 12 Jan 2022 21:29:55 +0000 (13:29 -0800)
committerKevin Athey <kda@google.com>
Thu, 13 Jan 2022 01:21:19 +0000 (17:21 -0800)
Minor adjustment in order of noundef analysis to be a bit more optimal (when disabled).

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D117078

clang/lib/CodeGen/CGCall.cpp

index 26f0051..cd05fa7 100644 (file)
@@ -2377,9 +2377,10 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
     }
 
     // Decide whether the argument we're handling could be partially undef
-    bool ArgNoUndef = DetermineNoUndef(ParamType, getTypes(), DL, AI);
-    if (CodeGenOpts.EnableNoundefAttrs && ArgNoUndef)
+    if (CodeGenOpts.EnableNoundefAttrs &&
+        DetermineNoUndef(ParamType, getTypes(), DL, AI)) {
       Attrs.addAttribute(llvm::Attribute::NoUndef);
+    }
 
     // 'restrict' -> 'noalias' is done in EmitFunctionProlog when we
     // have the corresponding parameter variable.  It doesn't make