[PATCH] D149800: [WIP][PGO] Add ability to mark cold functions as optsize/minsize/optnone

2023-05-03 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

high level question, why not have it as a pass that runs after profiles (of 
whatever kind - instrumented or sample-based) are ingested. The pass would 
attribute functions as described.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149800/new/

https://reviews.llvm.org/D149800

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143624: Inlining: Run the legacy AlwaysInliner before the regular inliner.

2023-05-03 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D143624#4315508 , @nikic wrote:

> In D143624#4315468 , @dmgreen wrote:
>
>> It looks like there is quite a lot more optimization that happens to the 
>> function being always-inlined (__SSAT) before this change. Through multiple 
>> rounds of instcombine, almost to the end of the pass pipeline. The new 
>> version runs a lot less before inlining, only running 
>> instcombine->simplifycfg and not seeing another instcombine to clean up the 
>> results. Is that because the AlwaysInlinePass is a module pass and it now 
>> only runs the passes up to that point?
>
> Yes, which is why I personally think this change isn't a good idea. This 
> essentially breaks our invariant that functions get simplified before they 
> are inlined. This significantly alters the way alwaysinline functions will be 
> optimized relative to normally inlined functions.

(Nitpicking just on the invariant part) Not sure if that's always the 
invariant, because we could be inlining a call site in a SCC where both caller 
and callee are in that same SCC.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143624/new/

https://reviews.llvm.org/D143624

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143624: Inlining: Run the legacy AlwaysInliner before the regular inliner.

2023-02-09 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D143624#4116546 , @aeubanks wrote:

> Had a chat offline with @mtrofin, wanted to be clear for future purposes that 
> we do need the separate AlwaysInliner pass because it's used in -O0 and 
> constructing a call graph there is non-trivial in terms of compile time.

Worth maybe spelling that out in the patch description - i.e. why not go the 
D91567  route again, makes it easier to 
understand later.

> Originally the mandatory mode of the normal inliner was added to maybe remove 
> the separate AlwaysInliner pass in the future, but that's not going to happen 
> because of what I just said. Given that, we can eventually remove the 
> mandatory mode of the normal inliner after this patch goes through. So this 
> patch should also make `mandatory-inlining-first` false by default, then we 
> remove it in a separate patch.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143624/new/

https://reviews.llvm.org/D143624

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143624: Inlining: Run the legacy AlwaysInliner before the regular inliner.

2023-02-09 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin accepted this revision.
mtrofin added a comment.
This revision is now accepted and ready to land.

lgtm. Like @aeubanks was saying, let's just give a bit of time (1 month or so?) 
between when this lands and until we clean up the "mandatory" notion from the 
advisor, just to make sure nothing breaks/regresses.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143624/new/

https://reviews.llvm.org/D143624

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D143624: Inlining: Run the legacy AlwaysInliner before the regular inliner.

2023-02-09 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D143624#4115986 , @aeubanks wrote:

> __clang_hip_math.hip is annoying...
>
> We'll need to remove the `MandatoryFirst` inliner in 
> `ModuleInlinerWrapperPass`, although not sure if @mtrofin has any issues with 
> that or not

IIRC we had at a point a mandatory , whole-module pass. The idea wast that 
let's not have N inliners, and that AlwaysInliner had some limitations, and for 
similar reasons @aemerson  pointed out, it'd make sense to first perform the 
mandatory inlines (D91567 ). In D94825 
 we went away from that. I don't remember why. 
@aeubanks? (it's referencing a patch you started)

> This isn't quite what I had initially thought, but this might be better. (I 
> was thinking that we sort the calls in the inliner to visit alwaysinline 
> calls first, but that might cause more compile time issues since we have to 
> update the call graph after visiting all the calls in a function, but we 
> might be visiting every function twice if we first batch process the 
> alwaysinline calls then all other calls)




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143624/new/

https://reviews.llvm.org/D143624

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D139006: [UpdateTestChecks] Match define for labels

2022-11-30 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin accepted this revision.
mtrofin added a comment.

LGTM, but I'd wait for Johannes to review it, too (because of 
e67f6477fd1ed29acbeddf8482c25d8db826912f 
. I for 
one don't quite follow the reasoning there wrt adding the `else`)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139006/new/

https://reviews.llvm.org/D139006

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138836: [UpdateTestChecks] Fix `update_test_checks.py` to add "unused" prefixes

2022-11-28 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG255e7e1c21ee: [UpdateTestChecks] Fix 
`update_*_test_checks.py` to add unused prefixes (authored by 
mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138836/new/

https://reviews.llvm.org/D138836

Files:
  
clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp.expected
  clang/test/utils/update_cc_test_checks/prefix-never-matches.test
  llvm/test/Transforms/InstCombine/widen-load-of-small-alloca.ll
  
llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-loopvectorize-costmodel.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected
  llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_analyze_test_checks.py
  llvm/utils/update_cc_test_checks.py
  llvm/utils/update_test_checks.py

Index: llvm/utils/update_test_checks.py
===
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -150,7 +150,7 @@
   lambda args: ti.args.include_generated_funcs,
   '--include-generated-funcs',
   True)
-
+generated_prefixes = []
 if include_generated_funcs:
   # Generate the appropriate checks for each function.  We need to emit
   # these in the order according to the generated output so that CHECK-LABEL
@@ -163,17 +163,26 @@
 
   args = ti.args
   if args.check_globals:
-  common.add_global_checks(builder.global_var_dict(), ';', prefix_list, output_lines, global_vars_seen_dict, args.preserve_names, True)
+generated_prefixes.extend(
+common.add_global_checks(builder.global_var_dict(), ';',
+ prefix_list, output_lines,
+ global_vars_seen_dict, args.preserve_names,
+ True))
 
   # Now generate all the checks.
-  common.add_checks_at_end(output_lines, prefix_list, builder.func_order(),
-   ';', lambda my_output_lines, prefixes, func:
-   common.add_ir_checks(my_output_lines, ';',
-prefixes,
-func_dict, func, False,
-args.function_signature,
-global_vars_seen_dict,
-is_filtered=builder.is_filtered()))
+  generated_prefixes.extend(
+  common.add_checks_at_end(
+  output_lines, prefix_list, builder.func_order(), ';',
+  lambda my_output_lines, prefixes, func: common.add_ir_checks(
+  my_output_lines,
+  ';',
+  prefixes,
+  func_dict,
+  func,
+  False,
+  args.function_signature,
+  global_vars_seen_dict,
+  is_filtered=builder.is_filtered(
 else:
   # "Normal" mode.
   for input_line_info in ti.iterlines(output_lines):
@@ -189,29 +198,40 @@
   continue
 
   # Print out the various check lines here.
-  common.add_ir_checks(output_lines, ';', prefix_list, func_dict,
-   func_name, args.preserve_names, args.function_signature,
-   global_vars_seen_dict,
-   is_filtered=builder.is_filtered())
+  generated_prefixes.extend(
+  common.add_ir_checks(
+  output_lines,
+  ';',
+  prefix_list,
+  func_dict,
+  func_name,
+  args.preserve_names,
+  args.function_signature,
+  global_vars_seen_dict,
+  is_filtered=builder.is_filtered()))
   is_in_function_start = False
 
 m = common.IR_FUNCTION_RE.match(input_line)
 if m and not has_checked_pre_function_globals:
-if args.check_globals:
-common.add_global_checks(builder.global_var_dict(), ';', prefix_list, output_lines, 

[PATCH] D138836: [UpdateTestChecks] Fix `update_test_checks.py` to add "unused" prefixes

2022-11-28 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D138836#3954851 , @lebedev.ri 
wrote:

> In D138836#3954850 , @mtrofin wrote:
>
>> In D138836#3954782 , @lebedev.ri 
>> wrote:
>>
>>> Thanks!
>>> There's also the one for MCA, but this situation basically never happens 
>>> for those tests.
>>
>> Yup, checked that and the mir one. The latter seems to be implementing its 
>> own "add_checks", so would leave it as-is (plus, I'm guessing, by their 
>> nature, mir tests wouldn't get into this type of scenario anyway, IIUC).
>
> mca!=mir

Right - they are different, there's a update_mir_test_checks and also an 
update_mca_test_checks; basically agreeing that, indeed, after patching _cc and 
_analysis (and update_test_checks), the remaining don't need patching.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138836/new/

https://reviews.llvm.org/D138836

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138836: [UpdateTestChecks] Fix `update_test_checks.py` to add "unused" prefixes

2022-11-28 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D138836#3954782 , @lebedev.ri 
wrote:

> Thanks!
> There's also the one for MCA, but this situation basically never happens for 
> those tests.

Yup, checked that and the mir one. The latter seems to be implementing its own 
"add_checks", so would leave it as-is (plus, I'm guessing, by their nature, mir 
tests wouldn't get into this type of scenario anyway, IIUC).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138836/new/

https://reviews.llvm.org/D138836

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D138836: [UpdateTestChecks] Fix `update_test_checks.py` to add "unused" prefixes

2022-11-28 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 478343.
mtrofin added a comment.
Herald added a subscriber: pcwang-thead.

missed one


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138836/new/

https://reviews.llvm.org/D138836

Files:
  
clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp.expected
  clang/test/utils/update_cc_test_checks/prefix-never-matches.test
  llvm/test/Transforms/InstCombine/widen-load-of-small-alloca.ll
  
llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/x86-loopvectorize-costmodel.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected
  llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_analyze_test_checks.py
  llvm/utils/update_cc_test_checks.py
  llvm/utils/update_test_checks.py

Index: llvm/utils/update_test_checks.py
===
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -150,7 +150,7 @@
   lambda args: ti.args.include_generated_funcs,
   '--include-generated-funcs',
   True)
-
+generated_prefixes = []
 if include_generated_funcs:
   # Generate the appropriate checks for each function.  We need to emit
   # these in the order according to the generated output so that CHECK-LABEL
@@ -163,17 +163,26 @@
 
   args = ti.args
   if args.check_globals:
-  common.add_global_checks(builder.global_var_dict(), ';', prefix_list, output_lines, global_vars_seen_dict, args.preserve_names, True)
+generated_prefixes.extend(
+common.add_global_checks(builder.global_var_dict(), ';',
+ prefix_list, output_lines,
+ global_vars_seen_dict, args.preserve_names,
+ True))
 
   # Now generate all the checks.
-  common.add_checks_at_end(output_lines, prefix_list, builder.func_order(),
-   ';', lambda my_output_lines, prefixes, func:
-   common.add_ir_checks(my_output_lines, ';',
-prefixes,
-func_dict, func, False,
-args.function_signature,
-global_vars_seen_dict,
-is_filtered=builder.is_filtered()))
+  generated_prefixes.extend(
+  common.add_checks_at_end(
+  output_lines, prefix_list, builder.func_order(), ';',
+  lambda my_output_lines, prefixes, func: common.add_ir_checks(
+  my_output_lines,
+  ';',
+  prefixes,
+  func_dict,
+  func,
+  False,
+  args.function_signature,
+  global_vars_seen_dict,
+  is_filtered=builder.is_filtered(
 else:
   # "Normal" mode.
   for input_line_info in ti.iterlines(output_lines):
@@ -189,29 +198,40 @@
   continue
 
   # Print out the various check lines here.
-  common.add_ir_checks(output_lines, ';', prefix_list, func_dict,
-   func_name, args.preserve_names, args.function_signature,
-   global_vars_seen_dict,
-   is_filtered=builder.is_filtered())
+  generated_prefixes.extend(
+  common.add_ir_checks(
+  output_lines,
+  ';',
+  prefix_list,
+  func_dict,
+  func_name,
+  args.preserve_names,
+  args.function_signature,
+  global_vars_seen_dict,
+  is_filtered=builder.is_filtered()))
   is_in_function_start = False
 
 m = common.IR_FUNCTION_RE.match(input_line)
 if m and not has_checked_pre_function_globals:
-if args.check_globals:
-common.add_global_checks(builder.global_var_dict(), ';', prefix_list, output_lines, global_vars_seen_dict, args.preserve_names, True)
-has_checked_pre_function_globals = True
+  if args.check_globals:
+  

[PATCH] D138836: [UpdateTestChecks] Fix `update_test_checks.py` to add "unused" prefixes

2022-11-28 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 478339.
mtrofin added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

fixed the other 2 scripts


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138836/new/

https://reviews.llvm.org/D138836

Files:
  
clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp.expected
  clang/test/utils/update_cc_test_checks/prefix-never-matches.test
  llvm/test/Transforms/InstCombine/widen-load-of-small-alloca.ll
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.funcattrs.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/check_attrs.ll.plain.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/function_name.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll.expected
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/sometimes_deleted_function.ll.expected
  llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_analyze_test_checks.py
  llvm/utils/update_cc_test_checks.py
  llvm/utils/update_test_checks.py

Index: llvm/utils/update_test_checks.py
===
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -150,7 +150,7 @@
   lambda args: ti.args.include_generated_funcs,
   '--include-generated-funcs',
   True)
-
+generated_prefixes = []
 if include_generated_funcs:
   # Generate the appropriate checks for each function.  We need to emit
   # these in the order according to the generated output so that CHECK-LABEL
@@ -163,17 +163,26 @@
 
   args = ti.args
   if args.check_globals:
-  common.add_global_checks(builder.global_var_dict(), ';', prefix_list, output_lines, global_vars_seen_dict, args.preserve_names, True)
+generated_prefixes.extend(
+common.add_global_checks(builder.global_var_dict(), ';',
+ prefix_list, output_lines,
+ global_vars_seen_dict, args.preserve_names,
+ True))
 
   # Now generate all the checks.
-  common.add_checks_at_end(output_lines, prefix_list, builder.func_order(),
-   ';', lambda my_output_lines, prefixes, func:
-   common.add_ir_checks(my_output_lines, ';',
-prefixes,
-func_dict, func, False,
-args.function_signature,
-global_vars_seen_dict,
-is_filtered=builder.is_filtered()))
+  generated_prefixes.extend(
+  common.add_checks_at_end(
+  output_lines, prefix_list, builder.func_order(), ';',
+  lambda my_output_lines, prefixes, func: common.add_ir_checks(
+  my_output_lines,
+  ';',
+  prefixes,
+  func_dict,
+  func,
+  False,
+  args.function_signature,
+  global_vars_seen_dict,
+  is_filtered=builder.is_filtered(
 else:
   # "Normal" mode.
   for input_line_info in ti.iterlines(output_lines):
@@ -189,29 +198,40 @@
   continue
 
   # Print out the various check lines here.
-  common.add_ir_checks(output_lines, ';', prefix_list, func_dict,
-   func_name, args.preserve_names, args.function_signature,
-   global_vars_seen_dict,
-   is_filtered=builder.is_filtered())
+  generated_prefixes.extend(
+  common.add_ir_checks(
+  output_lines,
+  ';',
+  prefix_list,
+  func_dict,
+  func_name,
+  args.preserve_names,
+  args.function_signature,
+  global_vars_seen_dict,
+  is_filtered=builder.is_filtered()))
   is_in_function_start = False
 
 m = common.IR_FUNCTION_RE.match(input_line)
 if m and not has_checked_pre_function_globals:
-if args.check_globals:
-common.add_global_checks(builder.global_var_dict(), ';', prefix_list, output_lines, global_vars_seen_dict, args.preserve_names, True)
-has_checked_pre_function_globals = True
+  if args.check_globals:
+generated_prefixes.extend(
+

[PATCH] D132991: [Clang] Give error message for invalid profile path when compiling IR

2022-09-07 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D132991#3764877 , @aidengrossman 
wrote:

> @xur I've modified the patch slightly (mainly fixing tests and changing the 
> error message printing in `CodeGenModule` to an assert as we should be 
> capturing everything in `CompilerInvocation`. Do you mind looking over these 
> changes, specifically making sure that going through CompilerInvocation is 
> always guaranteed if we end up hitting `CodeGenModule`?

How come the old error checking in CodeGenModule wasn't tripped before?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132991/new/

https://reviews.llvm.org/D132991

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D131448: Introduce iterator sentinel to make graph traversal implementation more efficient and cleaner

2022-08-09 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

lgtm for the MLInlineAdvisor bit


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131448/new/

https://reviews.llvm.org/D131448

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D130620: Fix lack of cc1 flag in llvmcmd sections when assertions are enabled

2022-07-29 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGafb4efd3bcc6: Fix lack of cc1 flag in llvmcmd sections when 
assertions are enabled (authored by aidengrossman, committed by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130620/new/

https://reviews.llvm.org/D130620

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/unittests/Frontend/CompilerInvocationTest.cpp


Index: clang/unittests/Frontend/CompilerInvocationTest.cpp
===
--- clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -23,6 +23,7 @@
 using ::testing::Contains;
 using ::testing::HasSubstr;
 using ::testing::StrEq;
+using ::testing::StartsWith;
 
 namespace {
 class CommandLineTest : public ::testing::Test {
@@ -145,6 +146,26 @@
   ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fno-temp-file")));
 }
 
+TEST_F(CommandLineTest, CC1FlagPresentWhenDoingRoundTrip) {
+  const char *Args[] = {"-cc1", "-round-trip-args"};
+
+  ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
+
+  ASSERT_THAT(std::string(Invocation.getCodeGenOpts().CmdArgs.begin(),
+  Invocation.getCodeGenOpts().CmdArgs.end()),
+  StartsWith("-cc1"));
+}
+
+TEST_F(CommandLineTest, CC1FlagPresentWhenNotDoingRoundTrip) {
+  const char *Args[] = {"-cc1", "-no-round-trip-args"};
+
+  ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
+
+  ASSERT_THAT(std::string(Invocation.getCodeGenOpts().CmdArgs.begin(),
+  Invocation.getCodeGenOpts().CmdArgs.end()),
+  StartsWith("-cc1"));
+}
+
 TEST_F(CommandLineTest, BoolOptionDefaultTrueSingleFlagUnknownPresent) {
   const char *Args[] = {"-ftemp-file"};
 
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -4544,7 +4544,10 @@
 return CreateFromArgsImpl(Invocation, CommandLineArgs, Diags, Argv0);
   },
   [](CompilerInvocation , SmallVectorImpl ,
- StringAllocator SA) { Invocation.generateCC1CommandLine(Args, SA); },
+ StringAllocator SA) {
+Args.push_back("-cc1");
+Invocation.generateCC1CommandLine(Args, SA);
+  },
   Invocation, DummyInvocation, CommandLineArgs, Diags, Argv0);
 }
 


Index: clang/unittests/Frontend/CompilerInvocationTest.cpp
===
--- clang/unittests/Frontend/CompilerInvocationTest.cpp
+++ clang/unittests/Frontend/CompilerInvocationTest.cpp
@@ -23,6 +23,7 @@
 using ::testing::Contains;
 using ::testing::HasSubstr;
 using ::testing::StrEq;
+using ::testing::StartsWith;
 
 namespace {
 class CommandLineTest : public ::testing::Test {
@@ -145,6 +146,26 @@
   ASSERT_THAT(GeneratedArgs, Contains(StrEq("-fno-temp-file")));
 }
 
+TEST_F(CommandLineTest, CC1FlagPresentWhenDoingRoundTrip) {
+  const char *Args[] = {"-cc1", "-round-trip-args"};
+
+  ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
+
+  ASSERT_THAT(std::string(Invocation.getCodeGenOpts().CmdArgs.begin(),
+  Invocation.getCodeGenOpts().CmdArgs.end()),
+  StartsWith("-cc1"));
+}
+
+TEST_F(CommandLineTest, CC1FlagPresentWhenNotDoingRoundTrip) {
+  const char *Args[] = {"-cc1", "-no-round-trip-args"};
+
+  ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags));
+
+  ASSERT_THAT(std::string(Invocation.getCodeGenOpts().CmdArgs.begin(),
+  Invocation.getCodeGenOpts().CmdArgs.end()),
+  StartsWith("-cc1"));
+}
+
 TEST_F(CommandLineTest, BoolOptionDefaultTrueSingleFlagUnknownPresent) {
   const char *Args[] = {"-ftemp-file"};
 
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -4544,7 +4544,10 @@
 return CreateFromArgsImpl(Invocation, CommandLineArgs, Diags, Argv0);
   },
   [](CompilerInvocation , SmallVectorImpl ,
- StringAllocator SA) { Invocation.generateCC1CommandLine(Args, SA); },
+ StringAllocator SA) {
+Args.push_back("-cc1");
+Invocation.generateCC1CommandLine(Args, SA);
+  },
   Invocation, DummyInvocation, CommandLineArgs, Diags, Argv0);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D130620: Fix lack of cc1 flag in llvmcmd sections when assertions are enabled

2022-07-29 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D130620#3686357 , @aidengrossman 
wrote:

> Thanks for the review and your suggestions. Do you mind pushing this commit? 
> I don't currently have commit access to LLVM. Thanks.

I can do it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130620/new/

https://reviews.llvm.org/D130620

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119876: [nfc][codegen] Move RegisterBank[Info].h under CodeGen

2022-03-01 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
mtrofin marked an inline comment as done.
Closed by commit rGcb2160760e67: [nfc][codegen] Move RegisterBank[Info].h under 
CodeGen (authored by mtrofin).
Herald added a project: All.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119876/new/

https://reviews.llvm.org/D119876

Files:
  clang/docs/tools/clang-formatted-files.txt
  llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
  llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h
  llvm/include/llvm/CodeGen/GlobalISel/RegisterBank.h
  llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
  llvm/include/llvm/CodeGen/MachineRegisterInfo.h
  llvm/include/llvm/CodeGen/RegisterBank.h
  llvm/include/llvm/CodeGen/RegisterBankInfo.h
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
  llvm/lib/CodeGen/GlobalISel/Utils.cpp
  llvm/lib/CodeGen/MIRParser/MIParser.cpp
  llvm/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/lib/CodeGen/MIRPrinter.cpp
  llvm/lib/CodeGen/MachineInstr.cpp
  llvm/lib/CodeGen/MachineVerifier.cpp
  llvm/lib/CodeGen/RegisterBank.cpp
  llvm/lib/CodeGen/RegisterBankInfo.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp
  llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.h
  llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
  llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.h
  llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp
  llvm/lib/Target/ARM/ARMRegisterBankInfo.h
  llvm/lib/Target/ARM/ARMSubtarget.h
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/M68k/GISel/M68kRegisterBankInfo.cpp
  llvm/lib/Target/M68k/GISel/M68kRegisterBankInfo.h
  llvm/lib/Target/M68k/M68kSubtarget.h
  llvm/lib/Target/Mips/MipsRegisterBankInfo.h
  llvm/lib/Target/Mips/MipsSubtarget.h
  llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.h
  llvm/lib/Target/PowerPC/PPCSubtarget.h
  llvm/lib/Target/RISCV/RISCVRegisterBankInfo.cpp
  llvm/lib/Target/RISCV/RISCVRegisterBankInfo.h
  llvm/lib/Target/RISCV/RISCVSubtarget.h
  llvm/lib/Target/X86/X86InstructionSelector.cpp
  llvm/lib/Target/X86/X86RegisterBankInfo.cpp
  llvm/lib/Target/X86/X86RegisterBankInfo.h

Index: llvm/lib/Target/X86/X86RegisterBankInfo.h
===
--- llvm/lib/Target/X86/X86RegisterBankInfo.h
+++ llvm/lib/Target/X86/X86RegisterBankInfo.h
@@ -13,7 +13,7 @@
 #ifndef LLVM_LIB_TARGET_X86_X86REGISTERBANKINFO_H
 #define LLVM_LIB_TARGET_X86_X86REGISTERBANKINFO_H
 
-#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
+#include "llvm/CodeGen/RegisterBankInfo.h"
 
 #define GET_REGBANK_DECLARATIONS
 #include "X86GenRegisterBank.inc"
Index: llvm/lib/Target/X86/X86RegisterBankInfo.cpp
===
--- llvm/lib/Target/X86/X86RegisterBankInfo.cpp
+++ llvm/lib/Target/X86/X86RegisterBankInfo.cpp
@@ -12,9 +12,9 @@
 
 #include "X86RegisterBankInfo.h"
 #include "X86InstrInfo.h"
-#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
-#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/CodeGen/RegisterBank.h"
+#include "llvm/CodeGen/RegisterBankInfo.h"
 #include "llvm/CodeGen/TargetRegisterInfo.h"
 
 #define GET_TARGET_REGBANK_IMPL
Index: llvm/lib/Target/X86/X86InstructionSelector.cpp
===
--- llvm/lib/Target/X86/X86InstructionSelector.cpp
+++ llvm/lib/Target/X86/X86InstructionSelector.cpp
@@ -21,7 +21,6 @@
 #include "X86TargetMachine.h"
 #include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
 #include "llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h"
-#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
 #include "llvm/CodeGen/GlobalISel/Utils.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
@@ -31,6 +30,7 @@
 #include "llvm/CodeGen/MachineMemOperand.h"
 #include "llvm/CodeGen/MachineOperand.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/CodeGen/RegisterBank.h"
 #include "llvm/CodeGen/TargetOpcodes.h"
 #include "llvm/CodeGen/TargetRegisterInfo.h"
 #include "llvm/IR/DataLayout.h"
Index: llvm/lib/Target/RISCV/RISCVSubtarget.h
===
--- llvm/lib/Target/RISCV/RISCVSubtarget.h
+++ llvm/lib/Target/RISCV/RISCVSubtarget.h
@@ -20,7 +20,7 @@
 #include "llvm/CodeGen/GlobalISel/CallLowering.h"
 #include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
 #include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
-#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
+#include "llvm/CodeGen/RegisterBankInfo.h"
 #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
 #include "llvm/CodeGen/TargetSubtargetInfo.h"
 #include "llvm/IR/DataLayout.h"
Index: llvm/lib/Target/RISCV/RISCVRegisterBankInfo.h

[PATCH] D119876: [nfc][codegen] Move RegisterBank[Info].h under CodeGen

2022-03-01 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin marked an inline comment as done.
mtrofin added inline comments.



Comment at: llvm/lib/Target/ARM/ARMTargetMachine.cpp:43
 #include "llvm/Pass.h"
+#include "llvm/Support/ARMTargetParser.h"
 #include "llvm/Support/CodeGen.h"

myhsu wrote:
> Hmm...did you use clang-format-diff.py? I wonder why this was changed 
> (although it's a legit one)
did git clang-format, and since that had to re-sort the includes due to my 
change, it affected incorrectly placed lines. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119876/new/

https://reviews.llvm.org/D119876

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119876: [nfc][codegen] Move RegisterBank[Info].h under CodeGen

2022-03-01 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

As this is a follow-up of a refactoring, I assume I can just land it (short of 
file header comments, there was nothing really this patch did more 
intelligently)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119876/new/

https://reviews.llvm.org/D119876

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119876: [nfc][codegen] Move RegisterBank[Info].h under CodeGen

2022-02-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added inline comments.



Comment at: llvm/include/llvm/CodeGen/RegisterBankInfo.h:220
 : ID(ID), Cost(Cost), OperandsMapping(OperandsMapping),
-  NumOperands(NumOperands) {
-}
+  NumOperands(NumOperands) {}
 

ah - `clang-format` handled the moved file as a new file; but I'd say let's let 
it make these changes, they are goodness anyway (and small)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119876/new/

https://reviews.llvm.org/D119876

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119876: [nfc][codegen] Move RegisterBank[Info].h under CodeGen

2022-02-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin added a reviewer: qcolombet.
Herald added subscribers: foad, frasercrmck, kerbowa, luismarques, apazos, 
sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, 
MartinMosbeck, rogfer01, atanasyan, edward-jones, zzheng, jrtc27, niosHD, 
sabuasal, simoncook, johnrusso, rbar, asb, kbarton, hiraditya, nhaehnle, 
jvesely, nemanjai, sdardis, arsenm.
mtrofin requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, pcwang-thead, MaskRay.
Herald added projects: clang, LLVM.

This wraps up from D119053 . The 2 headers 
are moved as described,
fixed file headers and include guards, updated all files where the old
paths were detected (simple grep through the repo), and `clang-format`-ed it 
all.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119876

Files:
  clang/docs/tools/clang-formatted-files.txt
  llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
  llvm/include/llvm/CodeGen/GlobalISel/RegBankSelect.h
  llvm/include/llvm/CodeGen/GlobalISel/RegisterBank.h
  llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
  llvm/include/llvm/CodeGen/MachineRegisterInfo.h
  llvm/include/llvm/CodeGen/RegisterBank.h
  llvm/include/llvm/CodeGen/RegisterBankInfo.h
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
  llvm/lib/CodeGen/GlobalISel/Utils.cpp
  llvm/lib/CodeGen/MIRParser/MIParser.cpp
  llvm/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/lib/CodeGen/MIRPrinter.cpp
  llvm/lib/CodeGen/MachineInstr.cpp
  llvm/lib/CodeGen/MachineVerifier.cpp
  llvm/lib/CodeGen/RegisterBank.cpp
  llvm/lib/CodeGen/RegisterBankInfo.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h
  llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.cpp
  llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.h
  llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
  llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.h
  llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp
  llvm/lib/Target/ARM/ARMRegisterBankInfo.h
  llvm/lib/Target/ARM/ARMSubtarget.h
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/M68k/GISel/M68kRegisterBankInfo.cpp
  llvm/lib/Target/M68k/GISel/M68kRegisterBankInfo.h
  llvm/lib/Target/M68k/M68kSubtarget.h
  llvm/lib/Target/Mips/MipsRegisterBankInfo.h
  llvm/lib/Target/Mips/MipsSubtarget.h
  llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.h
  llvm/lib/Target/PowerPC/PPCSubtarget.h
  llvm/lib/Target/RISCV/RISCVRegisterBankInfo.cpp
  llvm/lib/Target/RISCV/RISCVRegisterBankInfo.h
  llvm/lib/Target/RISCV/RISCVSubtarget.h
  llvm/lib/Target/X86/X86InstructionSelector.cpp
  llvm/lib/Target/X86/X86RegisterBankInfo.cpp
  llvm/lib/Target/X86/X86RegisterBankInfo.h

Index: llvm/lib/Target/X86/X86RegisterBankInfo.h
===
--- llvm/lib/Target/X86/X86RegisterBankInfo.h
+++ llvm/lib/Target/X86/X86RegisterBankInfo.h
@@ -13,7 +13,7 @@
 #ifndef LLVM_LIB_TARGET_X86_X86REGISTERBANKINFO_H
 #define LLVM_LIB_TARGET_X86_X86REGISTERBANKINFO_H
 
-#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
+#include "llvm/CodeGen/RegisterBankInfo.h"
 
 #define GET_REGBANK_DECLARATIONS
 #include "X86GenRegisterBank.inc"
Index: llvm/lib/Target/X86/X86RegisterBankInfo.cpp
===
--- llvm/lib/Target/X86/X86RegisterBankInfo.cpp
+++ llvm/lib/Target/X86/X86RegisterBankInfo.cpp
@@ -12,9 +12,9 @@
 
 #include "X86RegisterBankInfo.h"
 #include "X86InstrInfo.h"
-#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
-#include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/CodeGen/RegisterBank.h"
+#include "llvm/CodeGen/RegisterBankInfo.h"
 #include "llvm/CodeGen/TargetRegisterInfo.h"
 
 #define GET_TARGET_REGBANK_IMPL
Index: llvm/lib/Target/X86/X86InstructionSelector.cpp
===
--- llvm/lib/Target/X86/X86InstructionSelector.cpp
+++ llvm/lib/Target/X86/X86InstructionSelector.cpp
@@ -21,7 +21,6 @@
 #include "X86TargetMachine.h"
 #include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
 #include "llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h"
-#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
 #include "llvm/CodeGen/GlobalISel/Utils.h"
 #include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
@@ -31,6 +30,7 @@
 #include "llvm/CodeGen/MachineMemOperand.h"
 #include "llvm/CodeGen/MachineOperand.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
+#include "llvm/CodeGen/RegisterBank.h"
 #include "llvm/CodeGen/TargetOpcodes.h"
 #include "llvm/CodeGen/TargetRegisterInfo.h"
 #include "llvm/IR/DataLayout.h"
Index: llvm/lib/Target/RISCV/RISCVSubtarget.h
===
--- llvm/lib/Target/RISCV/RISCVSubtarget.h
+++ llvm/lib/Target/RISCV/RISCVSubtarget.h
@@ -20,7 +20,7 @@
 #include 

[PATCH] D115393: [InstrProf][NFC] Refactor Profile kind into a bitset enum.

2022-01-27 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added inline comments.



Comment at: llvm/include/llvm/ProfileData/InstrProfReader.h:495
 
+  InstrProfKind getProfileKind() const override {
+InstrProfKind ProfileKind = InstrProfKind::Unknown;

This looks a lot like line 290, can it be refactored (or am I missing 
something?)



Comment at: llvm/lib/ProfileData/InstrProfWriter.cpp:337
   uint64_t CSSummarySize = 0;
-  if (ProfileKind == PF_IRLevelWithCS) {
+  if (static_cast(ProfileKind & InstrProfKind::CS)) {
 CSSummaryOffset = OS.tell();

consider adding helper APIs for test/set?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115393/new/

https://reviews.llvm.org/D115393

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D79959: [SampleFDO] Add use-sample-profile function attribute

2021-11-17 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added inline comments.
Herald added subscribers: ormris, jdoerfert.



Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:856
 
+  // Add use-sample-profile value.
+  if (!CGM.getCodeGenOpts().SampleProfileFile.empty())

MaskRay wrote:
> The code self explains. I think the comment does not add much value.
Could this be applied by a pass, early on in 
PassBuilder::buildPerModuleDefaultPipeline, if we determine we're not in 
ThinLTO post link? That way it would be a frontend-independent solution.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79959/new/

https://reviews.llvm.org/D79959

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D113304: [NewPM] Only invalidate modified functions' analyses in CGSCC passes + turn on eagerly invalidate analyses

2021-11-08 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added inline comments.



Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:1017
+// invalidate analyses for all functions in this SCC later.
+FAM.invalidate(F, PreservedAnalyses::none());
   }

Should we do this if !Changed? Actually, if this function did not change 
(`Changed` is per cgscc)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113304/new/

https://reviews.llvm.org/D113304

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110891: [inliner] Mandatory inlining decisions produce remarks

2021-10-05 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
mtrofin marked an inline comment as done.
Closed by commit rG7d541eb4d49a: [inliner] Mandatory inlining decisions produce 
remarks (authored by mtrofin).

Changed prior to commit:
  https://reviews.llvm.org/D110891?vs=377091=377350#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110891/new/

https://reviews.llvm.org/D110891

Files:
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Transforms/IPO/AlwaysInliner.cpp
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/test/Transforms/Inline/inline-remark-mandatory.ll

Index: llvm/test/Transforms/Inline/inline-remark-mandatory.ll
===
--- /dev/null
+++ llvm/test/Transforms/Inline/inline-remark-mandatory.ll
@@ -0,0 +1,16 @@
+; RUN: opt -passes="cgscc(inline)" -pass-remarks-missed=inline -S < %s 2>&1 | FileCheck %s
+
+declare void @personalityFn1();
+declare void @personalityFn2();
+
+define i32 @a() personality void ()* @personalityFn1 {
+ret i32 1
+}
+
+define i32 @b() personality void ()* @personalityFn2 {
+%r = call i32 @a() alwaysinline
+ret i32 %r
+}
+
+; CHECK: remark: {{.*}} 'a' is not AlwaysInline into 'b': incompatible personality
+
Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1204,8 +1204,8 @@
*CalledFunction);
 
 // The call to InlineFunction erases I, so we can't pass it here.
-emitInlinedInto(*ORE, DLoc, BB, *CalledFunction, *BB->getParent(), Cost,
-true, CSINLINE_DEBUG);
+emitInlinedIntoBasedOnCost(*ORE, DLoc, BB, *CalledFunction,
+   *BB->getParent(), Cost, true, CSINLINE_DEBUG);
 
 // Now populate the list of newly exposed call sites.
 if (InlinedCallSites) {
Index: llvm/lib/Transforms/IPO/Inliner.cpp
===
--- llvm/lib/Transforms/IPO/Inliner.cpp
+++ llvm/lib/Transforms/IPO/Inliner.cpp
@@ -464,7 +464,7 @@
 }
 ++NumInlined;
 
-emitInlinedInto(ORE, DLoc, Block, *Callee, *Caller, *OIC);
+emitInlinedIntoBasedOnCost(ORE, DLoc, Block, *Callee, *Caller, *OIC);
 
 // If inlining this function gave us any new call sites, throw them
 // onto our worklist to process.  They are useful inline candidates.
Index: llvm/lib/Transforms/IPO/AlwaysInliner.cpp
===
--- llvm/lib/Transforms/IPO/AlwaysInliner.cpp
+++ llvm/lib/Transforms/IPO/AlwaysInliner.cpp
@@ -73,8 +73,8 @@
 },
 ORE);
 assert(OIC);
-emitInlinedInto(ORE, CB->getDebugLoc(), CB->getParent(), F, *Caller,
-*OIC, false, DEBUG_TYPE);
+emitInlinedIntoBasedOnCost(ORE, CB->getDebugLoc(), CB->getParent(), F,
+   *Caller, *OIC, false, DEBUG_TYPE);
 
 InlineFunctionInfo IFI(
 /*cg=*/nullptr, GetAssumptionCache, ,
Index: llvm/lib/Analysis/InlineAdvisor.cpp
===
--- llvm/lib/Analysis/InlineAdvisor.cpp
+++ llvm/lib/Analysis/InlineAdvisor.cpp
@@ -49,6 +49,42 @@
 
 extern cl::opt InlinerFunctionImportStats;
 
+namespace {
+using namespace llvm::ore;
+class MandatoryInlineAdvice : public InlineAdvice {
+public:
+  MandatoryInlineAdvice(InlineAdvisor *Advisor, CallBase ,
+OptimizationRemarkEmitter ,
+bool IsInliningMandatory)
+  : InlineAdvice(Advisor, CB, ORE, IsInliningMandatory) {}
+
+private:
+  void recordInliningWithCalleeDeletedImpl() override { recordInliningImpl(); }
+
+  void recordInliningImpl() override {
+if (IsInliningRecommended)
+  emitInlinedInto(ORE, DLoc, Block, *Callee, *Caller, IsInliningRecommended,
+  [&](OptimizationRemark ) {
+Remark << ": always inline attribute";
+  });
+  }
+
+  void recordUnsuccessfulInliningImpl(const InlineResult ) override {
+if (IsInliningRecommended)
+  ORE.emit([&]() {
+return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
+   << "'" << NV("Callee", Callee) << "' is not AlwaysInline into '"
+   << NV("Caller", Caller)
+   << "': " << NV("Reason", Result.getFailureReason());
+  });
+  }
+
+  void recordUnattemptedInliningImpl() override {
+

[PATCH] D110891: [inliner] Mandatory inlining decisions produce remarks

2021-10-04 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin marked an inline comment as done.
mtrofin added inline comments.



Comment at: llvm/lib/Analysis/InlineAdvisor.cpp:72-89
+  void recordUnsuccessfulInliningImpl(const InlineResult ) override {
+if (IsInliningRecommended)
+  ORE.emit([&]() {
+return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
+   << "'" << NV("Callee", Callee) << "' is not AlwaysInline into '"
+   << NV("Caller", Caller)
+   << "': " << NV("Reason", Result.getFailureReason());

aeubanks wrote:
> mtrofin wrote:
> > aeubanks wrote:
> > > can we add a test for these?
> > I think that would be tricky, because they should not actually happen - the 
> > way we determine whether a site is alwaysinlinable checks (but not 
> > thoroughly) for legality. Let me see if I can find a regression test. It 
> > may be we can synthesize such a case in IR only, though, so not much of a 
> > help for the frontend tests?
> yeah some IR tests is what I was thinking
Done. The 'unattempted' case is really an assert, but got a test for the 
attempted but failed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110891/new/

https://reviews.llvm.org/D110891

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110891: [inliner] Mandatory inlining decisions produce remarks

2021-10-04 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 377091.
mtrofin marked 2 inline comments as done.
mtrofin added a comment.

added test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110891/new/

https://reviews.llvm.org/D110891

Files:
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Transforms/IPO/AlwaysInliner.cpp
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/lib/Transforms/IPO/SampleProfile.cpp
  llvm/test/Transforms/Inline/inline-remark-mandatory.ll

Index: llvm/test/Transforms/Inline/inline-remark-mandatory.ll
===
--- /dev/null
+++ llvm/test/Transforms/Inline/inline-remark-mandatory.ll
@@ -0,0 +1,15 @@
+; RUN: opt -passes="cgscc(inline)" -pass-remarks-missed=inline -S < %s 2>&1 | FileCheck %s
+
+declare void @personalityFn1();
+declare void @personalityFn2();
+
+define i32 @a() personality void ()* @personalityFn1 {
+ret i32 1
+}
+
+define i32 @b() personality void ()* @personalityFn2 {
+%r = call i32 @a() alwaysinline
+ret i32 %r
+}
+
+; CHECK: remark: {{.*}} 'a' is not AlwaysInline into 'b': incompatible personality
\ No newline at end of file
Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1204,8 +1204,8 @@
*CalledFunction);
 
 // The call to InlineFunction erases I, so we can't pass it here.
-emitInlinedInto(*ORE, DLoc, BB, *CalledFunction, *BB->getParent(), Cost,
-true, CSINLINE_DEBUG);
+emitInlinedIntoBasedOnCost(*ORE, DLoc, BB, *CalledFunction,
+   *BB->getParent(), Cost, true, CSINLINE_DEBUG);
 
 // Now populate the list of newly exposed call sites.
 if (InlinedCallSites) {
Index: llvm/lib/Transforms/IPO/Inliner.cpp
===
--- llvm/lib/Transforms/IPO/Inliner.cpp
+++ llvm/lib/Transforms/IPO/Inliner.cpp
@@ -464,7 +464,7 @@
 }
 ++NumInlined;
 
-emitInlinedInto(ORE, DLoc, Block, *Callee, *Caller, *OIC);
+emitInlinedIntoBasedOnCost(ORE, DLoc, Block, *Callee, *Caller, *OIC);
 
 // If inlining this function gave us any new call sites, throw them
 // onto our worklist to process.  They are useful inline candidates.
Index: llvm/lib/Transforms/IPO/AlwaysInliner.cpp
===
--- llvm/lib/Transforms/IPO/AlwaysInliner.cpp
+++ llvm/lib/Transforms/IPO/AlwaysInliner.cpp
@@ -73,8 +73,8 @@
 },
 ORE);
 assert(OIC);
-emitInlinedInto(ORE, CB->getDebugLoc(), CB->getParent(), F, *Caller,
-*OIC, false, DEBUG_TYPE);
+emitInlinedIntoBasedOnCost(ORE, CB->getDebugLoc(), CB->getParent(), F,
+   *Caller, *OIC, false, DEBUG_TYPE);
 
 InlineFunctionInfo IFI(
 /*cg=*/nullptr, GetAssumptionCache, ,
Index: llvm/lib/Analysis/InlineAdvisor.cpp
===
--- llvm/lib/Analysis/InlineAdvisor.cpp
+++ llvm/lib/Analysis/InlineAdvisor.cpp
@@ -49,6 +49,42 @@
 
 extern cl::opt InlinerFunctionImportStats;
 
+namespace {
+using namespace llvm::ore;
+class MandatoryInlineAdvice : public InlineAdvice {
+public:
+  MandatoryInlineAdvice(InlineAdvisor *Advisor, CallBase ,
+OptimizationRemarkEmitter ,
+bool IsInliningMandatory)
+  : InlineAdvice(Advisor, CB, ORE, IsInliningMandatory) {}
+
+private:
+  void recordInliningWithCalleeDeletedImpl() override { recordInliningImpl(); }
+
+  void recordInliningImpl() override {
+if (IsInliningRecommended)
+  emitInlinedInto(ORE, DLoc, Block, *Callee, *Caller, IsInliningRecommended,
+  [&](OptimizationRemark ) {
+Remark << ": always inline attribute";
+  });
+  }
+
+  void recordUnsuccessfulInliningImpl(const InlineResult ) override {
+if (IsInliningRecommended)
+  ORE.emit([&]() {
+return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
+   << "'" << NV("Callee", Callee) << "' is not AlwaysInline into '"
+   << NV("Caller", Caller)
+   << "': " << NV("Reason", Result.getFailureReason());
+  });
+  }
+
+  void recordUnattemptedInliningImpl() override {
+assert(!IsInliningRecommended && "Expected to attempt inlining");
+  }
+};
+} // namespace
+
 void DefaultInlineAdvice::recordUnsuccessfulInliningImpl(
 const 

[PATCH] D110891: [inliner] Mandatory inlining decisions produce remarks

2021-10-01 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin marked 3 inline comments as done.
mtrofin added inline comments.



Comment at: llvm/lib/Analysis/InlineAdvisor.cpp:52
 
+namespace {
+using namespace llvm::ore;

wenlei wrote:
> mtrofin wrote:
> > wenlei wrote:
> > > curious why do we need anonymous namespace here?
> > iiuc it's preferred we place file-local types inside an anonymous 
> > namespace. 
> > 
> > Looking now at the [[ 
> > https://llvm.org/docs/CodingStandards.html#anonymous-namespaces | style 
> > guideline ]], it touts their benefits but also says I should have only 
> > placed de decl there and the impl of those members out... but the members 
> > are quite trivial. Happy to move them out though.
> Thanks for the pointer. I don't have a strong opinion but slightly leaning 
> towards moving out of anonymous namespace be consistent with how other 
> InlineAdvice is organized (DefaultInlineAdvice, MLInlineAdvice not in 
> anonymous namespace).
Ah, those are public (i.e. in a .h file)



Comment at: llvm/lib/Analysis/InlineAdvisor.cpp:72-89
+  void recordUnsuccessfulInliningImpl(const InlineResult ) override {
+if (IsInliningRecommended)
+  ORE.emit([&]() {
+return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
+   << "'" << NV("Callee", Callee) << "' is not AlwaysInline into '"
+   << NV("Caller", Caller)
+   << "': " << NV("Reason", Result.getFailureReason());

aeubanks wrote:
> can we add a test for these?
I think that would be tricky, because they should not actually happen - the way 
we determine whether a site is alwaysinlinable checks (but not thoroughly) for 
legality. Let me see if I can find a regression test. It may be we can 
synthesize such a case in IR only, though, so not much of a help for the 
frontend tests?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110891/new/

https://reviews.llvm.org/D110891

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110891: [inliner] Mandatory inlining decisions produce remarks

2021-10-01 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin marked an inline comment as done.
mtrofin added inline comments.



Comment at: llvm/lib/Analysis/InlineAdvisor.cpp:52
 
+namespace {
+using namespace llvm::ore;

wenlei wrote:
> curious why do we need anonymous namespace here?
iiuc it's preferred we place file-local types inside an anonymous namespace. 

Looking now at the [[ 
https://llvm.org/docs/CodingStandards.html#anonymous-namespaces | style 
guideline ]], it touts their benefits but also says I should have only placed 
de decl there and the impl of those members out... but the members are quite 
trivial. Happy to move them out though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110891/new/

https://reviews.llvm.org/D110891

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D110891: [inliner] Mandatory inlining decisions produce remarks

2021-09-30 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin added a reviewer: aeubanks.
Herald added subscribers: ormris, wenlei, hiraditya, eraman.
mtrofin requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This also removes the need to disable the mandatory inlining phase in
tests.

In a departure from the previous remark, we don't output a 'cost' in
this case, because there's no such thing. We just report that inlining
happened because of the attribute.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110891

Files:
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Transforms/IPO/AlwaysInliner.cpp
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/lib/Transforms/IPO/SampleProfile.cpp

Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1204,8 +1204,8 @@
*CalledFunction);
 
 // The call to InlineFunction erases I, so we can't pass it here.
-emitInlinedInto(*ORE, DLoc, BB, *CalledFunction, *BB->getParent(), Cost,
-true, CSINLINE_DEBUG);
+emitInlinedIntoBasedOnCost(*ORE, DLoc, BB, *CalledFunction,
+   *BB->getParent(), Cost, true, CSINLINE_DEBUG);
 
 // Now populate the list of newly exposed call sites.
 if (InlinedCallSites) {
Index: llvm/lib/Transforms/IPO/Inliner.cpp
===
--- llvm/lib/Transforms/IPO/Inliner.cpp
+++ llvm/lib/Transforms/IPO/Inliner.cpp
@@ -464,7 +464,7 @@
 }
 ++NumInlined;
 
-emitInlinedInto(ORE, DLoc, Block, *Callee, *Caller, *OIC);
+emitInlinedIntoBasedOnCost(ORE, DLoc, Block, *Callee, *Caller, *OIC);
 
 // If inlining this function gave us any new call sites, throw them
 // onto our worklist to process.  They are useful inline candidates.
Index: llvm/lib/Transforms/IPO/AlwaysInliner.cpp
===
--- llvm/lib/Transforms/IPO/AlwaysInliner.cpp
+++ llvm/lib/Transforms/IPO/AlwaysInliner.cpp
@@ -73,8 +73,8 @@
 },
 ORE);
 assert(OIC);
-emitInlinedInto(ORE, CB->getDebugLoc(), CB->getParent(), F, *Caller,
-*OIC, false, DEBUG_TYPE);
+emitInlinedIntoBasedOnCost(ORE, CB->getDebugLoc(), CB->getParent(), F,
+   *Caller, *OIC, false, DEBUG_TYPE);
 
 InlineFunctionInfo IFI(
 /*cg=*/nullptr, GetAssumptionCache, ,
Index: llvm/lib/Analysis/InlineAdvisor.cpp
===
--- llvm/lib/Analysis/InlineAdvisor.cpp
+++ llvm/lib/Analysis/InlineAdvisor.cpp
@@ -49,6 +49,48 @@
 
 extern cl::opt InlinerFunctionImportStats;
 
+namespace {
+using namespace llvm::ore;
+class MandatoryInlineAdvice : public InlineAdvice {
+public:
+  MandatoryInlineAdvice(InlineAdvisor *Advisor, CallBase ,
+OptimizationRemarkEmitter ,
+bool IsInliningMandatory)
+  : InlineAdvice(Advisor, CB, ORE, IsInliningMandatory) {}
+
+private:
+  void recordInliningWithCalleeDeletedImpl() override { recordInliningImpl(); }
+
+  void recordInliningImpl() override {
+if (IsInliningRecommended)
+  emitInlinedInto(ORE, DLoc, Block, *Callee, *Caller, IsInliningRecommended,
+  [&](OptimizationRemark ) {
+Remark << ": always inline attribute";
+  });
+  }
+
+  void recordUnsuccessfulInliningImpl(const InlineResult ) override {
+if (IsInliningRecommended)
+  ORE.emit([&]() {
+return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
+   << "'" << NV("Callee", Callee) << "' is not AlwaysInline into '"
+   << NV("Caller", Caller)
+   << "': " << NV("Reason", Result.getFailureReason());
+  });
+  }
+
+  void recordUnattemptedInliningImpl() override {
+if (IsInliningRecommended)
+  ORE.emit([&]() {
+return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
+   << "'" << NV("Callee", Callee)
+   << "' did not attempt AlwaysInline into '"
+   << NV("Caller", Caller);
+  });
+  }
+};
+} // namespace
+
 void DefaultInlineAdvice::recordUnsuccessfulInliningImpl(
 const InlineResult ) {
   using namespace ore;
@@ -64,12 +106,12 @@
 
 void DefaultInlineAdvice::recordInliningWithCalleeDeletedImpl() {
   if (EmitRemarks)
-emitInlinedInto(ORE, DLoc, Block, *Callee, 

[PATCH] D107025: Take OptimizationLevel class out of Pass Builder

2021-07-29 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7a797b290299: Take OptimizationLevel class out of Pass 
Builder (authored by tarinduj, committed by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107025/new/

https://reviews.llvm.org/D107025

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/examples/Bye/Bye.cpp
  llvm/include/llvm/Passes/OptimizationLevel.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/LTO/ThinLTOCodeGenerator.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  llvm/lib/Target/BPF/BPFTargetMachine.cpp
  llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
  llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
  llvm/tools/opt/NewPMDriver.cpp
  polly/include/polly/Canonicalization.h
  polly/lib/Support/RegisterPasses.cpp
  polly/lib/Transform/Canonicalization.cpp

Index: polly/lib/Transform/Canonicalization.cpp
===
--- polly/lib/Transform/Canonicalization.cpp
+++ polly/lib/Transform/Canonicalization.cpp
@@ -64,7 +64,7 @@
 
 /// Adapted from llvm::PassBuilder::buildInlinerPipeline
 static ModuleInlinerWrapperPass
-buildInlinePasses(llvm::PassBuilder::OptimizationLevel Level) {
+buildInlinePasses(llvm::OptimizationLevel Level) {
   InlineParams IP = getInlineParams(200);
   ModuleInlinerWrapperPass MIWP(IP);
 
@@ -92,8 +92,9 @@
   return MIWP;
 }
 
-FunctionPassManager polly::buildCanonicalicationPassesForNPM(
-llvm::ModulePassManager , llvm::PassBuilder::OptimizationLevel Level) {
+FunctionPassManager
+polly::buildCanonicalicationPassesForNPM(llvm::ModulePassManager ,
+ llvm::OptimizationLevel Level) {
   FunctionPassManager FPM;
 
   bool UseMemSSA = true;
@@ -107,7 +108,7 @@
   FPM.addPass(ReassociatePass());
   {
 LoopPassManager LPM;
-LPM.addPass(LoopRotatePass(Level != PassBuilder::OptimizationLevel::Oz));
+LPM.addPass(LoopRotatePass(Level != OptimizationLevel::Oz));
 FPM.addPass(createFunctionToLoopPassAdaptor(
 std::move(LPM), /*UseMemorySSA=*/false,
 /*UseBlockFrequencyInfo=*/false));
Index: polly/lib/Support/RegisterPasses.cpp
===
--- polly/lib/Support/RegisterPasses.cpp
+++ polly/lib/Support/RegisterPasses.cpp
@@ -474,7 +474,7 @@
 /// the analysis passes are added, skipping Polly itself.
 /// The IR may still be modified.
 static void buildCommonPollyPipeline(FunctionPassManager ,
- PassBuilder::OptimizationLevel Level,
+ OptimizationLevel Level,
  bool EnableForOpt) {
   PassBuilder PB;
   ScopPassManager SPM;
@@ -574,7 +574,7 @@
 }
 
 static void buildEarlyPollyPipeline(ModulePassManager ,
-PassBuilder::OptimizationLevel Level) {
+OptimizationLevel Level) {
   bool EnableForOpt =
   shouldEnablePollyForOptimization() && Level.isOptimizingForSpeed();
   if (!shouldEnablePollyForDiagnostic() && !EnableForOpt)
@@ -603,7 +603,7 @@
 }
 
 static void buildLatePollyPipeline(FunctionPassManager ,
-   PassBuilder::OptimizationLevel Level) {
+   OptimizationLevel Level) {
   bool EnableForOpt =
   shouldEnablePollyForOptimization() && Level.isOptimizingForSpeed();
   if (!shouldEnablePollyForDiagnostic() && !EnableForOpt)
Index: polly/include/polly/Canonicalization.h
===
--- polly/include/polly/Canonicalization.h
+++ polly/include/polly/Canonicalization.h
@@ -30,7 +30,7 @@
 
 llvm::FunctionPassManager
 buildCanonicalicationPassesForNPM(llvm::ModulePassManager ,
-  llvm::PassBuilder::OptimizationLevel Level);
+  llvm::OptimizationLevel Level);
 
 } // namespace polly
 
Index: llvm/tools/opt/NewPMDriver.cpp
===
--- llvm/tools/opt/NewPMDriver.cpp
+++ llvm/tools/opt/NewPMDriver.cpp
@@ -173,58 +173,58 @@
 static void registerEPCallbacks(PassBuilder ) {
   if (tryParsePipelineText(PB, PeepholeEPPipeline))
 PB.registerPeepholeEPCallback(
-[](FunctionPassManager , PassBuilder::OptimizationLevel Level) {
+[](FunctionPassManager , OptimizationLevel Level) {
   ExitOnError Err("Unable to parse PeepholeEP pipeline: ");
   Err(PB.parsePassPipeline(PM, PeepholeEPPipeline));
 });
   if (tryParsePipelineText(PB,
 LateLoopOptimizationsEPPipeline))
 PB.registerLateLoopOptimizationsEPCallback(
-[](LoopPassManager , 

[PATCH] D107025: Take OptimizationLevel class out of Pass Builder

2021-07-29 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin accepted this revision.
mtrofin added inline comments.
This revision is now accepted and ready to land.



Comment at: llvm/include/llvm/Passes/OptimizationLevel.h:128
+#endif
\ No newline at end of file


add a newline here (it helps diff tools)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107025/new/

https://reviews.llvm.org/D107025

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107025: Take OptimizationLevel class out of Pass Builder

2021-07-28 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added inline comments.



Comment at: llvm/include/llvm/Passes/OptimizationLevel.h:14
+//===--===//
+
+class OptimizationLevel final {

this should be in the llvm namespace



Comment at: llvm/include/llvm/Passes/OptimizationLevel.h:15
+
+class OptimizationLevel final {
+  unsigned SpeedLevel = 2;

Make sure this has a header guard - i.e. a 
#ifndef LLVM_PASSES_OPTIMIZATIONLEVEL_H
#define LLVM_PASSES_OPTIMIZATIONLEVEL_H
... the file
#endif 



Comment at: llvm/include/llvm/Passes/OptimizationLevel.h:21
+// Check that only valid combinations are passed.
+assert(SpeedLevel <= 3 &&
+   "Optimization level for speed should be 0, 1, 2, or 3");

you're probably missing some #include; for assert, it's 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107025/new/

https://reviews.llvm.org/D107025

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D100917: [NewPM] Only invalidate modified functions' analyses in CGSCC passes

2021-05-04 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D100917#2736702 , @aeubanks wrote:

> In D100917#2735651 , @nikic wrote:
>
>> An unfortunate side-effect of this change is that NewPM uses even more 
>> memory. tramp3d-v4 is up 20% in max-rss 
>> (https://llvm-compile-time-tracker.com/compare.php?from=4ef1f90e4d564b872e3598ccef45adb740eb0f0d=d14d84af2f5ebb8ae2188ce6884a29a586dc0a40=max-rss)
>
> Hmm that is a concern. I'm not sure how we want to balance memory vs compile 
> times. Any thoughts?

(Drive-by thought) - maybe this is because a bunch of analyses that are needed 
during function simplification aren't needed anymore after. We could quickly 
check by adding a pass at the end of all function simplification, module-wide, 
that clears all fct analyses, and see if the memory overhead is still there?

If that's the case, we could identify what's not needed after function 
simplification and scope it somehow in a less hacky way than my above 
suggestion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100917/new/

https://reviews.llvm.org/D100917

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98440: [NPM][CGSCC] FunctionAnalysisManagerCGSCCProxy: do not clear immutable function passes

2021-03-11 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5eaeb0fa67e5: [NPM][CGSCC] 
FunctionAnalysisManagerCGSCCProxy: do not clear immutable function… (authored 
by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98440/new/

https://reviews.llvm.org/D98440

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  llvm/lib/Analysis/CGSCCPassManager.cpp
  llvm/unittests/Analysis/CGSCCPassManagerTest.cpp


Index: llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
===
--- llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
+++ llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
@@ -1942,5 +1942,30 @@
   ASSERT_TRUE(Ran);
 }
 
+TEST_F(CGSCCPassManagerTest, TestFunctionPassesAreQueriedForInvalidation) {
+  std::unique_ptr M = parseIR("define void @f() { ret void }");
+  CGSCCPassManager CGPM;
+  bool SCCCalled = false;
+  FunctionPassManager FPM;
+  int ImmRuns = 0;
+  FAM.registerPass([&] { return TestImmutableFunctionAnalysis(ImmRuns); });
+  FPM.addPass(RequireAnalysisPass());
+  CGPM.addPass(
+  LambdaSCCPass([&](LazyCallGraph::SCC , CGSCCAnalysisManager ,
+LazyCallGraph , CGSCCUpdateResult ) {
+SCCCalled = true;
+return PreservedAnalyses::none();
+  }));
+  CGPM.addPass(createCGSCCToFunctionPassAdaptor(
+  RequireAnalysisPass()));
+  ModulePassManager MPM;
+
+  MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
+  MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
+  MPM.run(*M, MAM);
+  ASSERT_EQ(ImmRuns, 1);
+  ASSERT_TRUE(SCCCalled);
+}
+
 #endif
 } // namespace
Index: llvm/lib/Analysis/CGSCCPassManager.cpp
===
--- llvm/lib/Analysis/CGSCCPassManager.cpp
+++ llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -720,7 +720,7 @@
   auto PAC = PA.getChecker();
   if (!PAC.preserved() && 
!PAC.preservedSet>()) {
 for (LazyCallGraph::Node  : C)
-  FAM->clear(N.getFunction(), N.getFunction().getName());
+  FAM->invalidate(N.getFunction(), PA);
 
 return false;
   }
Index: clang/test/CodeGen/thinlto-distributed-newpm.ll
===
--- clang/test/CodeGen/thinlto-distributed-newpm.ll
+++ clang/test/CodeGen/thinlto-distributed-newpm.ll
@@ -12,7 +12,7 @@
 ; RUN: %clang -target x86_64-grtev4-linux-gnu \
 ; RUN:   -O2 -fexperimental-new-pass-manager -Xclang -fdebug-pass-manager \
 ; RUN:   -c -fthinlto-index=%t.o.thinlto.bc \
-; RUN:   -o %t.native.o -x ir %t.o 2>&1 | FileCheck 
-check-prefixes=CHECK-O,CHECK-O2 %s --dump-input=fail
+; RUN:   -o %t.native.o -x ir %t.o 2>&1 | FileCheck -check-prefix=CHECK-O %s 
--dump-input=fail
 
 ; RUN: %clang -target x86_64-grtev4-linux-gnu \
 ; RUN:   -O3 -fexperimental-new-pass-manager -Xclang -fdebug-pass-manager \
@@ -70,24 +70,19 @@
 ; CHECK-O: Starting CGSCC pass manager run.
 ; CHECK-O: Running pass: InlinerPass on (main)
 ; CHECK-O: Running pass: PostOrderFunctionAttrsPass on (main)
-; CHECK-O: Clearing all analysis results for: main
+; CHECK-O: Invalidating analysis: DominatorTreeAnalysis on main
+; CHECK-O: Invalidating analysis: BasicAA on main
+; CHECK-O: Invalidating analysis: AAManager on main
 ; CHECK-O3: Running pass: ArgumentPromotionPass on (main)
-; CHECK-O3: Running analysis: TargetIRAnalysis on main
 ; CHECK-O: Starting {{.*}}Function pass manager run.
 ; CHECK-O: Running pass: SROA on main
 ; These next two can appear in any order since they are accessed as parameters
 ; on the same call to SROA::runImpl
 ; CHECK-O-DAG: Running analysis: DominatorTreeAnalysis on main
-; CHECK-O-DAG: Running analysis: AssumptionAnalysis on main
 ; CHECK-O: Running pass: EarlyCSEPass on main
-; CHECK-O: Running analysis: TargetLibraryAnalysis on main
-; CHECK-O2: Running analysis: TargetIRAnalysis on main
 ; CHECK-O: Running analysis: MemorySSAAnalysis on main
 ; CHECK-O: Running analysis: AAManager on main
 ; CHECK-O: Running analysis: BasicAA on main
-; CHECK-O: Running analysis: ScopedNoAliasAA on main
-; CHECK-O: Running analysis: TypeBasedAA on main
-; CHECK-O: Running analysis: OuterAnalysisManagerProxy
 ; CHECK-O: Running pass: SpeculativeExecutionPass on main
 ; CHECK-O: Running pass: JumpThreadingPass on main
 ; CHECK-O: Running analysis: LazyValueAnalysis on main
@@ -96,7 +91,6 @@
 ; CHECK-O: Running pass: SimplifyCFGPass on main
 ; CHECK-O3: Running pass: AggressiveInstCombinePass on main
 ; CHECK-O: Running pass: InstCombinePass on main
-; CHECK-O: Running analysis: OptimizationRemarkEmitterAnalysis on main
 ; CHECK-O: Running pass: LibCallsShrinkWrapPass on main
 ; CHECK-O: Running pass: TailCallElimPass on main
 ; CHECK-O: Running pass: SimplifyCFGPass on main


Index: llvm/unittests/Analysis/CGSCCPassManagerTest.cpp

[PATCH] D98440: [NPM][CGSCC] FunctionAnalysisManagerCGSCCProxy: do not clear immutable function passes

2021-03-11 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D98440#2620437 , @aeubanks wrote:

> This doesn't break the pipeline tests in llvm/test/Other?
> Running check-llvm with expensive checks is probably a good idea to see if 
> there are any weird issues.

Done - nothing else broke, indeed.

> Otherwise seems fine to me.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98440/new/

https://reviews.llvm.org/D98440

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D98440: [NPM][CGSCC] FunctionAnalysisManagerCGSCCProxy: do not clear immutable function passes

2021-03-11 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 330057.
mtrofin marked an inline comment as done.
mtrofin added a comment.

feedback


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98440/new/

https://reviews.llvm.org/D98440

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  llvm/lib/Analysis/CGSCCPassManager.cpp
  llvm/unittests/Analysis/CGSCCPassManagerTest.cpp


Index: llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
===
--- llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
+++ llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
@@ -1942,5 +1942,30 @@
   ASSERT_TRUE(Ran);
 }
 
+TEST_F(CGSCCPassManagerTest, TestFunctionPassesAreQueriedForInvalidation) {
+  std::unique_ptr M = parseIR("define void @f() { ret void }");
+  CGSCCPassManager CGPM;
+  bool SCCCalled = false;
+  FunctionPassManager FPM;
+  int ImmRuns = 0;
+  FAM.registerPass([&] { return TestImmutableFunctionAnalysis(ImmRuns); });
+  FPM.addPass(RequireAnalysisPass());
+  CGPM.addPass(
+  LambdaSCCPass([&](LazyCallGraph::SCC , CGSCCAnalysisManager ,
+LazyCallGraph , CGSCCUpdateResult ) {
+SCCCalled = true;
+return PreservedAnalyses::none();
+  }));
+  CGPM.addPass(createCGSCCToFunctionPassAdaptor(
+  RequireAnalysisPass()));
+  ModulePassManager MPM;
+
+  MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
+  MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
+  MPM.run(*M, MAM);
+  ASSERT_EQ(ImmRuns, 1);
+  ASSERT_TRUE(SCCCalled);
+}
+
 #endif
 } // namespace
Index: llvm/lib/Analysis/CGSCCPassManager.cpp
===
--- llvm/lib/Analysis/CGSCCPassManager.cpp
+++ llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -720,7 +720,7 @@
   auto PAC = PA.getChecker();
   if (!PAC.preserved() && 
!PAC.preservedSet>()) {
 for (LazyCallGraph::Node  : C)
-  FAM->clear(N.getFunction(), N.getFunction().getName());
+  FAM->invalidate(N.getFunction(), PA);
 
 return false;
   }
Index: clang/test/CodeGen/thinlto-distributed-newpm.ll
===
--- clang/test/CodeGen/thinlto-distributed-newpm.ll
+++ clang/test/CodeGen/thinlto-distributed-newpm.ll
@@ -12,7 +12,7 @@
 ; RUN: %clang -target x86_64-grtev4-linux-gnu \
 ; RUN:   -O2 -fexperimental-new-pass-manager -Xclang -fdebug-pass-manager \
 ; RUN:   -c -fthinlto-index=%t.o.thinlto.bc \
-; RUN:   -o %t.native.o -x ir %t.o 2>&1 | FileCheck 
-check-prefixes=CHECK-O,CHECK-O2 %s --dump-input=fail
+; RUN:   -o %t.native.o -x ir %t.o 2>&1 | FileCheck -check-prefix=CHECK-O %s 
--dump-input=fail
 
 ; RUN: %clang -target x86_64-grtev4-linux-gnu \
 ; RUN:   -O3 -fexperimental-new-pass-manager -Xclang -fdebug-pass-manager \
@@ -70,24 +70,19 @@
 ; CHECK-O: Starting CGSCC pass manager run.
 ; CHECK-O: Running pass: InlinerPass on (main)
 ; CHECK-O: Running pass: PostOrderFunctionAttrsPass on (main)
-; CHECK-O: Clearing all analysis results for: main
+; CHECK-O: Invalidating analysis: DominatorTreeAnalysis on main
+; CHECK-O: Invalidating analysis: BasicAA on main
+; CHECK-O: Invalidating analysis: AAManager on main
 ; CHECK-O3: Running pass: ArgumentPromotionPass on (main)
-; CHECK-O3: Running analysis: TargetIRAnalysis on main
 ; CHECK-O: Starting {{.*}}Function pass manager run.
 ; CHECK-O: Running pass: SROA on main
 ; These next two can appear in any order since they are accessed as parameters
 ; on the same call to SROA::runImpl
 ; CHECK-O-DAG: Running analysis: DominatorTreeAnalysis on main
-; CHECK-O-DAG: Running analysis: AssumptionAnalysis on main
 ; CHECK-O: Running pass: EarlyCSEPass on main
-; CHECK-O: Running analysis: TargetLibraryAnalysis on main
-; CHECK-O2: Running analysis: TargetIRAnalysis on main
 ; CHECK-O: Running analysis: MemorySSAAnalysis on main
 ; CHECK-O: Running analysis: AAManager on main
 ; CHECK-O: Running analysis: BasicAA on main
-; CHECK-O: Running analysis: ScopedNoAliasAA on main
-; CHECK-O: Running analysis: TypeBasedAA on main
-; CHECK-O: Running analysis: OuterAnalysisManagerProxy
 ; CHECK-O: Running pass: SpeculativeExecutionPass on main
 ; CHECK-O: Running pass: JumpThreadingPass on main
 ; CHECK-O: Running analysis: LazyValueAnalysis on main
@@ -96,7 +91,6 @@
 ; CHECK-O: Running pass: SimplifyCFGPass on main
 ; CHECK-O3: Running pass: AggressiveInstCombinePass on main
 ; CHECK-O: Running pass: InstCombinePass on main
-; CHECK-O: Running analysis: OptimizationRemarkEmitterAnalysis on main
 ; CHECK-O: Running pass: LibCallsShrinkWrapPass on main
 ; CHECK-O: Running pass: TailCallElimPass on main
 ; CHECK-O: Running pass: SimplifyCFGPass on main


Index: llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
===
--- llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
+++ llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
@@ 

[PATCH] D98440: [NPM][CGSCC] FunctionAnalysisManagerCGSCCProxy: do not clear immutable function passes

2021-03-11 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin added reviewers: asbirlea, aeubanks.
Herald added subscribers: steven_wu, hiraditya.
mtrofin requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Check with the analysis result by calling invalidate instead of clear on
the analysis manager.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98440

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  llvm/lib/Analysis/CGSCCPassManager.cpp
  llvm/unittests/Analysis/CGSCCPassManagerTest.cpp


Index: llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
===
--- llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
+++ llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
@@ -1942,5 +1942,29 @@
   ASSERT_TRUE(Ran);
 }
 
+TEST_F(CGSCCPassManagerTest, TestFunctionPassesAreQueriedForInvalidation) {
+  std::unique_ptr M = parseIR("define void @f() { ret void }");
+  CGSCCPassManager CGPM;
+  bool SCCCalled = false;
+  FunctionPassManager FPM;
+  int ImmRuns = 0;
+  FAM.registerPass([&] { return TestImmutableFunctionAnalysis(ImmRuns); });
+  FPM.addPass(RequireAnalysisPass());
+  CGPM.addPass(
+  LambdaSCCPass([&](LazyCallGraph::SCC , CGSCCAnalysisManager ,
+LazyCallGraph , CGSCCUpdateResult ) {
+SCCCalled = true;
+return PreservedAnalyses::none();
+  }));
+  CGPM.addPass(createCGSCCToFunctionPassAdaptor(
+  RequireAnalysisPass()));
+  ModulePassManager MPM;
+
+  MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
+  MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(std::move(CGPM)));
+  MPM.run(*M, MAM);
+  ASSERT_EQ(ImmRuns, 1);
+}
+
 #endif
 } // namespace
Index: llvm/lib/Analysis/CGSCCPassManager.cpp
===
--- llvm/lib/Analysis/CGSCCPassManager.cpp
+++ llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -720,7 +720,7 @@
   auto PAC = PA.getChecker();
   if (!PAC.preserved() && 
!PAC.preservedSet>()) {
 for (LazyCallGraph::Node  : C)
-  FAM->clear(N.getFunction(), N.getFunction().getName());
+  FAM->invalidate(N.getFunction(), PA);
 
 return false;
   }
Index: clang/test/CodeGen/thinlto-distributed-newpm.ll
===
--- clang/test/CodeGen/thinlto-distributed-newpm.ll
+++ clang/test/CodeGen/thinlto-distributed-newpm.ll
@@ -12,7 +12,7 @@
 ; RUN: %clang -target x86_64-grtev4-linux-gnu \
 ; RUN:   -O2 -fexperimental-new-pass-manager -Xclang -fdebug-pass-manager \
 ; RUN:   -c -fthinlto-index=%t.o.thinlto.bc \
-; RUN:   -o %t.native.o -x ir %t.o 2>&1 | FileCheck 
-check-prefixes=CHECK-O,CHECK-O2 %s --dump-input=fail
+; RUN:   -o %t.native.o -x ir %t.o 2>&1 | FileCheck -check-prefix=CHECK-O %s 
--dump-input=fail
 
 ; RUN: %clang -target x86_64-grtev4-linux-gnu \
 ; RUN:   -O3 -fexperimental-new-pass-manager -Xclang -fdebug-pass-manager \
@@ -70,24 +70,19 @@
 ; CHECK-O: Starting CGSCC pass manager run.
 ; CHECK-O: Running pass: InlinerPass on (main)
 ; CHECK-O: Running pass: PostOrderFunctionAttrsPass on (main)
-; CHECK-O: Clearing all analysis results for: main
+; CHECK-O: Invalidating analysis: DominatorTreeAnalysis on main
+; CHECK-O: Invalidating analysis: BasicAA on main
+; CHECK-O: Invalidating analysis: AAManager on main
 ; CHECK-O3: Running pass: ArgumentPromotionPass on (main)
-; CHECK-O3: Running analysis: TargetIRAnalysis on main
 ; CHECK-O: Starting {{.*}}Function pass manager run.
 ; CHECK-O: Running pass: SROA on main
 ; These next two can appear in any order since they are accessed as parameters
 ; on the same call to SROA::runImpl
 ; CHECK-O-DAG: Running analysis: DominatorTreeAnalysis on main
-; CHECK-O-DAG: Running analysis: AssumptionAnalysis on main
 ; CHECK-O: Running pass: EarlyCSEPass on main
-; CHECK-O: Running analysis: TargetLibraryAnalysis on main
-; CHECK-O2: Running analysis: TargetIRAnalysis on main
 ; CHECK-O: Running analysis: MemorySSAAnalysis on main
 ; CHECK-O: Running analysis: AAManager on main
 ; CHECK-O: Running analysis: BasicAA on main
-; CHECK-O: Running analysis: ScopedNoAliasAA on main
-; CHECK-O: Running analysis: TypeBasedAA on main
-; CHECK-O: Running analysis: OuterAnalysisManagerProxy
 ; CHECK-O: Running pass: SpeculativeExecutionPass on main
 ; CHECK-O: Running pass: JumpThreadingPass on main
 ; CHECK-O: Running analysis: LazyValueAnalysis on main
@@ -96,7 +91,6 @@
 ; CHECK-O: Running pass: SimplifyCFGPass on main
 ; CHECK-O3: Running pass: AggressiveInstCombinePass on main
 ; CHECK-O: Running pass: InstCombinePass on main
-; CHECK-O: Running analysis: OptimizationRemarkEmitterAnalysis on main
 ; CHECK-O: Running pass: LibCallsShrinkWrapPass on main
 ; CHECK-O: Running pass: TailCallElimPass on main
 ; CHECK-O: Running pass: SimplifyCFGPass on main


Index: llvm/unittests/Analysis/CGSCCPassManagerTest.cpp

[PATCH] D95849: [FileCheck] Default --allow-unused-prefixes to false

2021-02-02 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D95849#2535939 , @jhenderson wrote:

> I assume this now runs cleanly. If so, LGTM. Probably worth mentioning on the 
> mailing list thread too, so wrap up that conversation. By the way, did we 
> ever figure out how many of the failures were genuine bugs versus deliberate 
> isntances?

Except for the tests under  llvm/test/Transforms/Attributor/, which D94744 
 explicitly opts into allowing unused prefixes 
(and which @jdoerfert described as intentionally so), the rest (~1300) were 
bugs: i.e. unintentionally unused prefixes.

Out of them, a small handful were spelling mistakes (identified as such during 
code review by their authors) and fixed rather than removed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95849/new/

https://reviews.llvm.org/D95849

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95842: [NFC] Remove unused prefixes under clang/test/OpenMP

2021-02-01 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin added a reviewer: jdoerfert.
Herald added subscribers: guansong, yaxunl.
mtrofin requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

The full list of pertinent tests is larger, so chunking the changes.
This is the first such chunk.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95842

Files:
  clang/test/OpenMP/declare_mapper_codegen.cpp
  clang/test/OpenMP/declare_reduction_codegen.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/irbuilder_nested_openmp_parallel_empty.c

Index: clang/test/OpenMP/irbuilder_nested_openmp_parallel_empty.c
===
--- clang/test/OpenMP/irbuilder_nested_openmp_parallel_empty.c
+++ clang/test/OpenMP/irbuilder_nested_openmp_parallel_empty.c
@@ -1,5 +1,5 @@
 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -x c++ -emit-llvm %s -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -o - | FileCheck %s --check-prefixes=ALL,IRBUILDER
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -x c++ -emit-llvm %s -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -o - | FileCheck %s --check-prefix=ALL
 //  %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o /tmp/t1 %s
 //  %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch /tmp/t1 -verify %s -emit-llvm -o - | FileCheck --check-prefixes=ALL-DEBUG,IRBUILDER-DEBUG %s
 
@@ -12,10 +12,10 @@
 
 // ALL-LABEL: @_Z17nested_parallel_0v(
 // ALL-NEXT:  entry:
-// ALL-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @1)
+// ALL-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* [[GLOB1:@.*]])
 // ALL-NEXT:br label [[OMP_PARALLEL:%.*]]
 // ALL:   omp_parallel:
-// ALL-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* @1, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @_Z17nested_parallel_0v..omp_par.1 to void (i32*, i32*, ...)*))
+// ALL-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* [[GLOB1]], i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* @_Z17nested_parallel_0v..omp_par.1 to void (i32*, i32*, ...)*))
 // ALL-NEXT:br label [[OMP_PAR_OUTLINED_EXIT12:%.*]]
 // ALL:   omp.par.outlined.exit12:
 // ALL-NEXT:br label [[OMP_PAR_EXIT_SPLIT:%.*]]
@@ -39,10 +39,10 @@
 // ALL-NEXT:store float* [[R:%.*]], float** [[R_ADDR]], align 8
 // ALL-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
 // ALL-NEXT:store double [[B:%.*]], double* [[B_ADDR]], align 8
-// ALL-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @1)
+// ALL-NEXT:[[OMP_GLOBAL_THREAD_NUM:%.*]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* [[GLOB1]])
 // ALL-NEXT:br label [[OMP_PARALLEL:%.*]]
 // ALL:   omp_parallel:
-// ALL-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* @1, i32 3, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, i32*, double*, float**)* @_Z17nested_parallel_1Pfid..omp_par.2 to void (i32*, i32*, ...)*), i32* [[A_ADDR]], double* [[B_ADDR]], float** [[R_ADDR]])
+// ALL-NEXT:call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* [[GLOB1]], i32 3, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, i32*, double*, float**)* @_Z17nested_parallel_1Pfid..omp_par.2 to void (i32*, i32*, ...)*), i32* [[A_ADDR]], double* [[B_ADDR]], float** [[R_ADDR]])
 // ALL-NEXT:br label [[OMP_PAR_OUTLINED_EXIT13:%.*]]
 // ALL:   omp.par.outlined.exit13:
 // ALL-NEXT:br label [[OMP_PAR_EXIT_SPLIT:%.*]]
@@ -67,10 +67,10 @@
 // ALL-NEXT:store float* [[R:%.*]], float** [[R_ADDR]], align 8
 // ALL-NEXT:store i32 [[A:%.*]], i32* [[A_ADDR]], align 4
 // ALL-NEXT:store double [[B:%.*]], double* [[B_ADDR]], align 8
-// 

[PATCH] D95660: [NFC] Disallow unused prefixes under clang/test/Driver

2021-02-01 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc4d6f2707a1e: [NFC] Disallow unused prefixes under 
clang/test/Driver (authored by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95660/new/

https://reviews.llvm.org/D95660

Files:
  clang/test/Driver/amdgpu-macros.cl
  clang/test/Driver/cuda-detect.cu
  clang/test/Driver/fsanitize.c
  clang/test/Driver/lit.local.cfg
  clang/test/Driver/ps4-visibility-dllstorageclass.c
  clang/test/Driver/rocm-device-libs.cl

Index: clang/test/Driver/rocm-device-libs.cl
===
--- clang/test/Driver/rocm-device-libs.cl
+++ clang/test/Driver/rocm-device-libs.cl
@@ -78,46 +78,46 @@
 // RUN:   -x cl -mcpu=gfx803 \
 // RUN:   -cl-unsafe-math-optimizations \
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-UNSAFE,GFX803,WAVE64 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefixes=COMMON,GFX803,WAVE64 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010\
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefix=WAVE32 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1011\
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1011,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefix=WAVE32 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1012\
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1012,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefix=WAVE32 %s
 
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE64 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefix=WAVE64 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64 -mno-wavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefix=WAVE32 %s
 
 // Ignore -mno-wavefrontsize64 without wave32 support
 // RUN: %clang -### -target amdgcn-amd-amdhsa   \
 // RUN:   -x cl -mcpu=gfx803  -mno-wavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm\
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX803,WAVE64 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefixes=GFX803,WAVE64 %s
 
 
 
Index: clang/test/Driver/ps4-visibility-dllstorageclass.c
===
--- clang/test/Driver/ps4-visibility-dllstorageclass.c
+++ clang/test/Driver/ps4-visibility-dllstorageclass.c
@@ -1,7 +1,7 @@
 // Check behaviour of -fvisibility-from-dllstorageclass options for PS4
 
 // RUN: %clang -### -target x86_64-scei-ps4 %s -Werror -o - 2>&1 | \
-// RUN:   FileCheck %s -check-prefixes=DEFAULTS,DEFAULTS1 \
+// RUN:   FileCheck %s --check-prefix=DEFAULTS \
 // RUN: --implicit-check-not=-fvisibility-from-dllstorageclass \
 // RUN: --implicit-check-not=-fvisibility-dllexport \
 // RUN: --implicit-check-not=-fvisibility-nodllstorageclass \
@@ -13,7 +13,7 @@
 // RUN: -fvisibility-from-dllstorageclass \
 // RUN: -Werror \
 // RUN: %s -o - 2>&1 | \
-// RUN:   FileCheck %s -check-prefixes=DEFAULTS,DEFAULTS2 \
+// RUN:   FileCheck %s --check-prefix=DEFAULTS \
 // RUN: --implicit-check-not=-fvisibility-from-dllstorageclass \
 // RUN: --implicit-check-not=-fvisibility-dllexport \
 // RUN: --implicit-check-not=-fvisibility-nodllstorageclass \
Index: clang/test/Driver/lit.local.cfg
===
--- clang/test/Driver/lit.local.cfg
+++ clang/test/Driver/lit.local.cfg
@@ -1,3 +1,11 @@
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
+
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.F90', '.f95',
'.cu', '.rs', '.cl', '.hip']
 config.substitutions = 

[PATCH] D95660: [NFC] Disallow unused prefixes under clang/test/Driver

2021-01-29 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 320256.
mtrofin added a comment.

indent


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95660/new/

https://reviews.llvm.org/D95660

Files:
  clang/test/Driver/amdgpu-macros.cl
  clang/test/Driver/cuda-detect.cu
  clang/test/Driver/fsanitize.c
  clang/test/Driver/lit.local.cfg
  clang/test/Driver/ps4-visibility-dllstorageclass.c
  clang/test/Driver/rocm-device-libs.cl

Index: clang/test/Driver/rocm-device-libs.cl
===
--- clang/test/Driver/rocm-device-libs.cl
+++ clang/test/Driver/rocm-device-libs.cl
@@ -78,46 +78,46 @@
 // RUN:   -x cl -mcpu=gfx803 \
 // RUN:   -cl-unsafe-math-optimizations \
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-UNSAFE,GFX803,WAVE64 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefixes=COMMON,GFX803,WAVE64 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010\
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefix=WAVE32 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1011\
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1011,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefix=WAVE32 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1012\
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1012,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefix=WAVE32 %s
 
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE64 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefix=WAVE64 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64 -mno-wavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefix=WAVE32 %s
 
 // Ignore -mno-wavefrontsize64 without wave32 support
 // RUN: %clang -### -target amdgcn-amd-amdhsa   \
 // RUN:   -x cl -mcpu=gfx803  -mno-wavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm\
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX803,WAVE64 %s
+// RUN:   %s 2>&1 | \
+// RUN:   FileCheck  --check-prefixes=GFX803,WAVE64 %s
 
 
 
Index: clang/test/Driver/ps4-visibility-dllstorageclass.c
===
--- clang/test/Driver/ps4-visibility-dllstorageclass.c
+++ clang/test/Driver/ps4-visibility-dllstorageclass.c
@@ -1,7 +1,7 @@
 // Check behaviour of -fvisibility-from-dllstorageclass options for PS4
 
 // RUN: %clang -### -target x86_64-scei-ps4 %s -Werror -o - 2>&1 | \
-// RUN:   FileCheck %s -check-prefixes=DEFAULTS,DEFAULTS1 \
+// RUN:   FileCheck %s --check-prefix=DEFAULTS \
 // RUN: --implicit-check-not=-fvisibility-from-dllstorageclass \
 // RUN: --implicit-check-not=-fvisibility-dllexport \
 // RUN: --implicit-check-not=-fvisibility-nodllstorageclass \
@@ -13,7 +13,7 @@
 // RUN: -fvisibility-from-dllstorageclass \
 // RUN: -Werror \
 // RUN: %s -o - 2>&1 | \
-// RUN:   FileCheck %s -check-prefixes=DEFAULTS,DEFAULTS2 \
+// RUN:   FileCheck %s --check-prefix=DEFAULTS \
 // RUN: --implicit-check-not=-fvisibility-from-dllstorageclass \
 // RUN: --implicit-check-not=-fvisibility-dllexport \
 // RUN: --implicit-check-not=-fvisibility-nodllstorageclass \
Index: clang/test/Driver/lit.local.cfg
===
--- clang/test/Driver/lit.local.cfg
+++ clang/test/Driver/lit.local.cfg
@@ -1,3 +1,11 @@
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
+
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.F90', '.f95',
'.cu', '.rs', '.cl', '.hip']
 config.substitutions = list(config.substitutions)
Index: clang/test/Driver/fsanitize.c
===
--- clang/test/Driver/fsanitize.c
+++ clang/test/Driver/fsanitize.c
@@ -15,11 +15,11 @@
 // RUN: %clang -target 

[PATCH] D95660: [NFC] Disallow unused prefixes under clang/test/Driver

2021-01-29 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added inline comments.



Comment at: clang/test/Driver/rocm-device-libs.cl:82
 // RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-UNSAFE,GFX803,WAVE64 
%s
+// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,GFX803,WAVE64 %s
 

MaskRay wrote:
> Since you changing the lines, consider indenting `2>&1`
> 
> The most common style is to place `2>&1 | \` on the previous line.
done


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95660/new/

https://reviews.llvm.org/D95660

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D95660: [NFC] Disallow unused prefixes under clang/test/Driver

2021-01-29 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 320246.
mtrofin marked an inline comment as done.
mtrofin added a comment.

cleaned up the RUN line for rocm


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95660/new/

https://reviews.llvm.org/D95660

Files:
  clang/test/Driver/amdgpu-macros.cl
  clang/test/Driver/cuda-detect.cu
  clang/test/Driver/fsanitize.c
  clang/test/Driver/lit.local.cfg
  clang/test/Driver/ps4-visibility-dllstorageclass.c
  clang/test/Driver/rocm-device-libs.cl

Index: clang/test/Driver/rocm-device-libs.cl
===
--- clang/test/Driver/rocm-device-libs.cl
+++ clang/test/Driver/rocm-device-libs.cl
@@ -78,46 +78,46 @@
 // RUN:   -x cl -mcpu=gfx803 \
 // RUN:   -cl-unsafe-math-optimizations \
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-UNSAFE,GFX803,WAVE64 %s
+// RUN:   %s 2>&1 | \
+// RUN: FileCheck  --check-prefixes=COMMON,GFX803,WAVE64 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010\
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN: FileCheck  --check-prefix=WAVE32 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1011\
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1011,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN: FileCheck  --check-prefix=WAVE32 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1012\
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1012,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN: FileCheck  --check-prefix=WAVE32 %s
 
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE64 %s
+// RUN:   %s 2>&1 | \
+// RUN: FileCheck  --check-prefix=WAVE64 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64 -mno-wavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm \
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE32 %s
+// RUN:   %s 2>&1 | \
+// RUN: FileCheck  --check-prefix=WAVE32 %s
 
 // Ignore -mno-wavefrontsize64 without wave32 support
 // RUN: %clang -### -target amdgcn-amd-amdhsa   \
 // RUN:   -x cl -mcpu=gfx803  -mno-wavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm\
-// RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX803,WAVE64 %s
+// RUN:   %s 2>&1 | \
+// RUN: FileCheck  --check-prefixes=GFX803,WAVE64 %s
 
 
 
Index: clang/test/Driver/ps4-visibility-dllstorageclass.c
===
--- clang/test/Driver/ps4-visibility-dllstorageclass.c
+++ clang/test/Driver/ps4-visibility-dllstorageclass.c
@@ -1,7 +1,7 @@
 // Check behaviour of -fvisibility-from-dllstorageclass options for PS4
 
 // RUN: %clang -### -target x86_64-scei-ps4 %s -Werror -o - 2>&1 | \
-// RUN:   FileCheck %s -check-prefixes=DEFAULTS,DEFAULTS1 \
+// RUN:   FileCheck %s --check-prefix=DEFAULTS \
 // RUN: --implicit-check-not=-fvisibility-from-dllstorageclass \
 // RUN: --implicit-check-not=-fvisibility-dllexport \
 // RUN: --implicit-check-not=-fvisibility-nodllstorageclass \
@@ -13,7 +13,7 @@
 // RUN: -fvisibility-from-dllstorageclass \
 // RUN: -Werror \
 // RUN: %s -o - 2>&1 | \
-// RUN:   FileCheck %s -check-prefixes=DEFAULTS,DEFAULTS2 \
+// RUN:   FileCheck %s --check-prefix=DEFAULTS \
 // RUN: --implicit-check-not=-fvisibility-from-dllstorageclass \
 // RUN: --implicit-check-not=-fvisibility-dllexport \
 // RUN: --implicit-check-not=-fvisibility-nodllstorageclass \
Index: clang/test/Driver/lit.local.cfg
===
--- clang/test/Driver/lit.local.cfg
+++ clang/test/Driver/lit.local.cfg
@@ -1,3 +1,11 @@
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
+
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.F90', '.f95',
'.cu', '.rs', '.cl', '.hip']
 config.substitutions = list(config.substitutions)
Index: clang/test/Driver/fsanitize.c
===
--- clang/test/Driver/fsanitize.c
+++ clang/test/Driver/fsanitize.c
@@ 

[PATCH] D95660: [NFC] Disallow unused prefixes under clang/test/Driver

2021-01-28 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
Herald added subscribers: kerbowa, mstorsjo, nhaehnle, jvesely.
mtrofin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95660

Files:
  clang/test/Driver/amdgpu-macros.cl
  clang/test/Driver/cuda-detect.cu
  clang/test/Driver/fsanitize.c
  clang/test/Driver/lit.local.cfg
  clang/test/Driver/ps4-visibility-dllstorageclass.c
  clang/test/Driver/rocm-device-libs.cl

Index: clang/test/Driver/rocm-device-libs.cl
===
--- clang/test/Driver/rocm-device-libs.cl
+++ clang/test/Driver/rocm-device-libs.cl
@@ -79,45 +79,45 @@
 // RUN:   -cl-unsafe-math-optimizations \
 // RUN:   --rocm-path=%S/Inputs/rocm \
 // RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,COMMON-UNSAFE,GFX803,WAVE64 %s
+// RUN: 2>&1 | FileCheck  --check-prefixes=COMMON,GFX803,WAVE64 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010\
 // RUN:   --rocm-path=%S/Inputs/rocm \
 // RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE32 %s
+// RUN: 2>&1 | FileCheck  --check-prefix=WAVE32 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1011\
 // RUN:   --rocm-path=%S/Inputs/rocm \
 // RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1011,WAVE32 %s
+// RUN: 2>&1 | FileCheck  --check-prefix=WAVE32 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1012\
 // RUN:   --rocm-path=%S/Inputs/rocm \
 // RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1012,WAVE32 %s
+// RUN: 2>&1 | FileCheck  --check-prefix=WAVE32 %s
 
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm \
 // RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE64 %s
+// RUN: 2>&1 | FileCheck  --check-prefix=WAVE64 %s
 
 // RUN: %clang -### -target amdgcn-amd-amdhsa\
 // RUN:   -x cl -mcpu=gfx1010 -mwavefrontsize64 -mno-wavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm \
 // RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX1010,WAVE32 %s
+// RUN: 2>&1 | FileCheck  --check-prefix=WAVE32 %s
 
 // Ignore -mno-wavefrontsize64 without wave32 support
 // RUN: %clang -### -target amdgcn-amd-amdhsa   \
 // RUN:   -x cl -mcpu=gfx803  -mno-wavefrontsize64  \
 // RUN:   --rocm-path=%S/Inputs/rocm\
 // RUN:   %s \
-// RUN: 2>&1 | FileCheck  --check-prefixes=COMMMON,GFX803,WAVE64 %s
+// RUN: 2>&1 | FileCheck  --check-prefixes=GFX803,WAVE64 %s
 
 
 
Index: clang/test/Driver/ps4-visibility-dllstorageclass.c
===
--- clang/test/Driver/ps4-visibility-dllstorageclass.c
+++ clang/test/Driver/ps4-visibility-dllstorageclass.c
@@ -1,7 +1,7 @@
 // Check behaviour of -fvisibility-from-dllstorageclass options for PS4
 
 // RUN: %clang -### -target x86_64-scei-ps4 %s -Werror -o - 2>&1 | \
-// RUN:   FileCheck %s -check-prefixes=DEFAULTS,DEFAULTS1 \
+// RUN:   FileCheck %s --check-prefix=DEFAULTS \
 // RUN: --implicit-check-not=-fvisibility-from-dllstorageclass \
 // RUN: --implicit-check-not=-fvisibility-dllexport \
 // RUN: --implicit-check-not=-fvisibility-nodllstorageclass \
@@ -13,7 +13,7 @@
 // RUN: -fvisibility-from-dllstorageclass \
 // RUN: -Werror \
 // RUN: %s -o - 2>&1 | \
-// RUN:   FileCheck %s -check-prefixes=DEFAULTS,DEFAULTS2 \
+// RUN:   FileCheck %s --check-prefix=DEFAULTS \
 // RUN: --implicit-check-not=-fvisibility-from-dllstorageclass \
 // RUN: --implicit-check-not=-fvisibility-dllexport \
 // RUN: --implicit-check-not=-fvisibility-nodllstorageclass \
Index: clang/test/Driver/lit.local.cfg
===
--- clang/test/Driver/lit.local.cfg
+++ clang/test/Driver/lit.local.cfg
@@ -1,3 +1,11 @@
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
+
 config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.F90', '.f95',
'.cu', '.rs', '.cl', '.hip']
 config.substitutions = list(config.substitutions)
Index: clang/test/Driver/fsanitize.c
===
--- clang/test/Driver/fsanitize.c
+++ clang/test/Driver/fsanitize.c
@@ -15,11 +15,11 @@
 // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-DARWIN
 // 

[PATCH] D95499: [NFC] Disallow unused prefixes under clang/test/CodeGenCXX

2021-01-28 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcfcc1110d773: [NFC] Disallow unused prefixes under 
clang/test/CodeGenCXX (authored by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95499/new/

https://reviews.llvm.org/D95499

Files:
  clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
  clang/test/CodeGenCXX/lit.local.cfg


Index: clang/test/CodeGenCXX/lit.local.cfg
===
--- /dev/null
+++ clang/test/CodeGenCXX/lit.local.cfg
@@ -0,0 +1,9 @@
+# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; 
then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
+
Index: clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
===
--- clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
+++ clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
@@ -1,19 +1,19 @@
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN:FileCheck %s --check-prefixes=CHECK,UNQUAL
 // RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview 
-emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
 // RUN:grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=QUAL
+// RUN:FileCheck %s
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++11 | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN:FileCheck %s --check-prefixes=CHECK,UNQUAL
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN:FileCheck %s --check-prefixes=CHECK,UNQUAL
 
 void freefunc() { }
 // CHECK-DAG: "freefunc"


Index: clang/test/CodeGenCXX/lit.local.cfg
===
--- /dev/null
+++ clang/test/CodeGenCXX/lit.local.cfg
@@ -0,0 +1,9 @@
+# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
+
Index: clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
===
--- clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
+++ clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
@@ -1,19 +1,19 @@
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN:FileCheck %s --check-prefixes=CHECK,UNQUAL
 // RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
 // RUN:grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=QUAL
+// RUN:FileCheck %s
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++11 | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN:FileCheck %s --check-prefixes=CHECK,UNQUAL
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null | \
 

[PATCH] D95499: [NFC] Disallow unused prefixes under clang/test/CodeGenCXX

2021-01-26 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin added a reviewer: rnk.
mtrofin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The only test that needed change had 'QUAL' as an unused prefix. The
rest of the changes are to simplify the prefix lists.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95499

Files:
  clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
  clang/test/CodeGenCXX/lit.local.cfg


Index: clang/test/CodeGenCXX/lit.local.cfg
===
--- /dev/null
+++ clang/test/CodeGenCXX/lit.local.cfg
@@ -0,0 +1,9 @@
+# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; 
then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
+
Index: clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
===
--- clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
+++ clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
@@ -1,19 +1,19 @@
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN:FileCheck %s --check-prefixes=CHECK,UNQUAL
 // RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview 
-emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
 // RUN:grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=QUAL
+// RUN:FileCheck %s
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++11 | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN:FileCheck %s --check-prefixes=CHECK,UNQUAL
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN:FileCheck %s --check-prefixes=CHECK,UNQUAL
 
 void freefunc() { }
 // CHECK-DAG: "freefunc"


Index: clang/test/CodeGenCXX/lit.local.cfg
===
--- /dev/null
+++ clang/test/CodeGenCXX/lit.local.cfg
@@ -0,0 +1,9 @@
+# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
+
Index: clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
===
--- clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
+++ clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
@@ -1,19 +1,19 @@
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN:FileCheck %s --check-prefixes=CHECK,UNQUAL
 // RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
 // RUN:grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=QUAL
+// RUN:FileCheck %s
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++11 | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
-// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN:FileCheck %s --check-prefixes=CHECK,UNQUAL
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
 // RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null | \
 // RUN:

[PATCH] D95417: [NFC] Disallow unused prefixes under clang/test/CodeGen

2021-01-26 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0c0d009a88f2: [NFC] Disallow unused prefixes under 
clang/test/CodeGen (authored by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95417/new/

https://reviews.llvm.org/D95417

Files:
  
clang/test/CodeGen/catch-alignment-assumption-attribute-align_value-on-lvalue.cpp
  
clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function-variable.cpp
  
clang/test/CodeGen/catch-alignment-assumption-attribute-assume_aligned-on-function-two-params.cpp
  
clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params-variable.cpp
  
clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params.cpp
  
clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-two-params.cpp
  clang/test/CodeGen/catch-alignment-assumption-openmp.cpp
  clang/test/CodeGen/catch-implicit-integer-sign-changes-incdec.c
  clang/test/CodeGen/catch-implicit-integer-sign-changes-true-negatives.c
  clang/test/CodeGen/catch-implicit-signed-integer-truncations-incdec.c
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset-blacklist.c
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset-when-nullptr-is-defined.c
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
  clang/test/CodeGen/catch-pointer-overflow-volatile.c
  clang/test/CodeGen/catch-pointer-overflow.c
  clang/test/CodeGen/cmse-clear-return.c
  clang/test/CodeGen/lit.local.cfg

Index: clang/test/CodeGen/lit.local.cfg
===
--- /dev/null
+++ clang/test/CodeGen/lit.local.cfg
@@ -0,0 +1,9 @@
+# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
+
Index: clang/test/CodeGen/cmse-clear-return.c
===
--- clang/test/CodeGen/cmse-clear-return.c
+++ clang/test/CodeGen/cmse-clear-return.c
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -triple thumbv8m.main   -O0 -mcmse -S -emit-llvm %s -o - | \
 // RUN:FileCheck %s --check-prefixes=CHECK,CHECK-LE,CHECK-LE-NOPT,CHECK-SOFT
 // RUN: %clang_cc1 -triple thumbebv8m.main -O0 -mcmse -S -emit-llvm %s -o - | \
-// RUN:FileCheck %s --check-prefixes=CHECK,CHECK-BE,CHECK-BE-NOPT,CHECK-SOFT
+// RUN:FileCheck %s --check-prefixes=CHECK,CHECK-BE,CHECK-SOFT
 // RUN: %clang_cc1 -triple thumbv8m.main   -O2 -mcmse -S -emit-llvm %s -o - | \
 // RUN:FileCheck %s --check-prefixes=CHECK,CHECK-LE,CHECK-LE-OPT,CHECK-SOFT
 // RUN: %clang_cc1 -triple thumbebv8m.main -O2 -mcmse -S -emit-llvm %s -o - | \
Index: clang/test/CodeGen/catch-pointer-overflow.c
===
--- clang/test/CodeGen/catch-pointer-overflow.c
+++ clang/test/CodeGen/catch-pointer-overflow.c
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -x c -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-NOSANITIZE
+// RUN: %clang_cc1 -x c -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
 // RUN: %clang_cc1 -x c -fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-C,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-NORECOVER,CHECK-SANITIZE-UNREACHABLE
 // RUN: %clang_cc1 -x c -fsanitize=pointer-overflow -fsanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-C,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-RECOVER
 // RUN: %clang_cc1 -x c -fsanitize=pointer-overflow -fsanitize-trap=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-C,CHECK-SANITIZE-TRAP,CHECK-SANITIZE-UNREACHABLE
 
-// RUN: %clang_cc1 -x c++ -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-NOSANITIZE
+// RUN: %clang_cc1 -x c++ -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
 // RUN: %clang_cc1 -x c++ -fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-CPP,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-NORECOVER,CHECK-SANITIZE-UNREACHABLE
 // RUN: %clang_cc1 -x c++ 

[PATCH] D95417: [NFC] Disallow unused prefixes under clang/test/CodeGen

2021-01-25 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin added a reviewer: MaskRay.
mtrofin requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95417

Files:
  
clang/test/CodeGen/catch-alignment-assumption-attribute-align_value-on-lvalue.cpp
  
clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function-variable.cpp
  
clang/test/CodeGen/catch-alignment-assumption-attribute-assume_aligned-on-function-two-params.cpp
  
clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params-variable.cpp
  
clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params.cpp
  
clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-two-params.cpp
  clang/test/CodeGen/catch-alignment-assumption-openmp.cpp
  clang/test/CodeGen/catch-implicit-integer-sign-changes-incdec.c
  clang/test/CodeGen/catch-implicit-integer-sign-changes-true-negatives.c
  clang/test/CodeGen/catch-implicit-signed-integer-truncations-incdec.c
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset-blacklist.c
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset-when-nullptr-is-defined.c
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
  clang/test/CodeGen/catch-pointer-overflow-volatile.c
  clang/test/CodeGen/catch-pointer-overflow.c
  clang/test/CodeGen/cmse-clear-return.c
  clang/test/CodeGen/lit.local.cfg

Index: clang/test/CodeGen/lit.local.cfg
===
--- /dev/null
+++ clang/test/CodeGen/lit.local.cfg
@@ -0,0 +1,9 @@
+# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
+from lit.llvm.subst import ToolSubst
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
+
Index: clang/test/CodeGen/cmse-clear-return.c
===
--- clang/test/CodeGen/cmse-clear-return.c
+++ clang/test/CodeGen/cmse-clear-return.c
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -triple thumbv8m.main   -O0 -mcmse -S -emit-llvm %s -o - | \
 // RUN:FileCheck %s --check-prefixes=CHECK,CHECK-LE,CHECK-LE-NOPT,CHECK-SOFT
 // RUN: %clang_cc1 -triple thumbebv8m.main -O0 -mcmse -S -emit-llvm %s -o - | \
-// RUN:FileCheck %s --check-prefixes=CHECK,CHECK-BE,CHECK-BE-NOPT,CHECK-SOFT
+// RUN:FileCheck %s --check-prefixes=CHECK,CHECK-BE,CHECK-SOFT
 // RUN: %clang_cc1 -triple thumbv8m.main   -O2 -mcmse -S -emit-llvm %s -o - | \
 // RUN:FileCheck %s --check-prefixes=CHECK,CHECK-LE,CHECK-LE-OPT,CHECK-SOFT
 // RUN: %clang_cc1 -triple thumbebv8m.main -O2 -mcmse -S -emit-llvm %s -o - | \
Index: clang/test/CodeGen/catch-pointer-overflow.c
===
--- clang/test/CodeGen/catch-pointer-overflow.c
+++ clang/test/CodeGen/catch-pointer-overflow.c
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -x c -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-NOSANITIZE
+// RUN: %clang_cc1 -x c -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
 // RUN: %clang_cc1 -x c -fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-C,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-NORECOVER,CHECK-SANITIZE-UNREACHABLE
 // RUN: %clang_cc1 -x c -fsanitize=pointer-overflow -fsanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-C,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-RECOVER
 // RUN: %clang_cc1 -x c -fsanitize=pointer-overflow -fsanitize-trap=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-C,CHECK-SANITIZE-TRAP,CHECK-SANITIZE-UNREACHABLE
 
-// RUN: %clang_cc1 -x c++ -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-NOSANITIZE
+// RUN: %clang_cc1 -x c++ -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s
 // RUN: %clang_cc1 -x c++ -fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_pointer_overflow" --check-prefixes=CHECK,CHECK-SANITIZE,CHECK-SANITIZE-CPP,CHECK-SANITIZE-ANYRECOVER,CHECK-SANITIZE-NORECOVER,CHECK-SANITIZE-UNREACHABLE
 // RUN: %clang_cc1 -x c++ -fsanitize=pointer-overflow 

[PATCH] D95249: [NFC] Disallow unused prefixes in clang/test/Analysis

2021-01-25 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG91b61abafb5a: [NFC] Disallow unused prefixes in 
clang/test/Analysis (authored by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95249/new/

https://reviews.llvm.org/D95249

Files:
  clang/test/Analysis/auto-obj-dtors-cfg-output.cpp
  clang/test/Analysis/cfg-rich-constructors.cpp
  clang/test/Analysis/cfg-rich-constructors.mm
  clang/test/Analysis/cfg.c
  clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
  clang/test/Analysis/lit.local.cfg

Index: clang/test/Analysis/lit.local.cfg
===
--- clang/test/Analysis/lit.local.cfg
+++ clang/test/Analysis/lit.local.cfg
@@ -1,5 +1,5 @@
 # -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
-
+from lit.llvm.subst import ToolSubst
 import site
 
 # Load the custom analyzer test format, which runs the test again with Z3 if it
@@ -26,3 +26,9 @@
 
 if not config.root.clang_staticanalyzer:
 config.unsupported = True
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
Index: clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
===
--- clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
+++ clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
@@ -1,17 +1,17 @@
 // RUN: %exploded_graph_rewriter %s \
 // RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,FOUR
 // RUN: %exploded_graph_rewriter -s %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,FOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTTHREE,FOUR
 // RUN: %exploded_graph_rewriter --to=0x2 %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,NOFOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTTHREE,NOTFOUR
 // RUN: %exploded_graph_rewriter --to 2 %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,NOFOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTTHREE,NOTFOUR
 // RUN: %exploded_graph_rewriter --to 2,3 %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,NOFOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,NOTFOUR
 // RUN: %exploded_graph_rewriter --to 4 %s \
 // RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,FOUR
 // RUN: %exploded_graph_rewriter --to 4 -s %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,FOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTTHREE,FOUR
 
 Node0x1 [shape=record,label=
  "{{ "state_id": 0, "program_state": null, "program_points": [
Index: clang/test/Analysis/cfg.c
===
--- clang/test/Analysis/cfg.c
+++ clang/test/Analysis/cfg.c
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -fheinous-gnu-extensions %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,WARNINGS %s
+// RUN: FileCheck --input-file=%t --check-prefix=CHECK %s
 
 // This file is the C version of cfg.cpp.
 // Tests that are C-specific should go into this file.
Index: clang/test/Analysis/cfg-rich-constructors.mm
===
--- clang/test/Analysis/cfg-rich-constructors.mm
+++ clang/test/Analysis/cfg-rich-constructors.mm
@@ -1,11 +1,11 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++11 -w %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,ELIDE,CXX11-ELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,CXX11-ELIDE %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++17 -w %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17,ELIDE,CXX17-ELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17 %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++11 -w -analyzer-config elide-constructors=false %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,NOELIDE,CXX11-NOELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,CXX11-NOELIDE %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++17 -w -analyzer-config elide-constructors=false %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17,NOELIDE,CXX17-NOELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17 %s
 
 class D {
 public:
Index: clang/test/Analysis/cfg-rich-constructors.cpp
===
--- 

[PATCH] D95249: [NFC] Disallow unused prefixes in clang/test/Analysis

2021-01-25 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 319024.
mtrofin added a comment.

fixed trimmers.dot


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95249/new/

https://reviews.llvm.org/D95249

Files:
  clang/test/Analysis/auto-obj-dtors-cfg-output.cpp
  clang/test/Analysis/cfg-rich-constructors.cpp
  clang/test/Analysis/cfg-rich-constructors.mm
  clang/test/Analysis/cfg.c
  clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
  clang/test/Analysis/lit.local.cfg

Index: clang/test/Analysis/lit.local.cfg
===
--- clang/test/Analysis/lit.local.cfg
+++ clang/test/Analysis/lit.local.cfg
@@ -1,5 +1,5 @@
 # -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
-
+from lit.llvm.subst import ToolSubst
 import site
 
 # Load the custom analyzer test format, which runs the test again with Z3 if it
@@ -26,3 +26,9 @@
 
 if not config.root.clang_staticanalyzer:
 config.unsupported = True
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
Index: clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
===
--- clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
+++ clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
@@ -1,17 +1,17 @@
 // RUN: %exploded_graph_rewriter %s \
 // RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,FOUR
 // RUN: %exploded_graph_rewriter -s %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,FOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTTHREE,FOUR
 // RUN: %exploded_graph_rewriter --to=0x2 %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,NOFOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTTHREE,NOTFOUR
 // RUN: %exploded_graph_rewriter --to 2 %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,NOFOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTTHREE,NOTFOUR
 // RUN: %exploded_graph_rewriter --to 2,3 %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,NOFOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,NOTFOUR
 // RUN: %exploded_graph_rewriter --to 4 %s \
 // RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,FOUR
 // RUN: %exploded_graph_rewriter --to 4 -s %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,FOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTTHREE,FOUR
 
 Node0x1 [shape=record,label=
  "{{ "state_id": 0, "program_state": null, "program_points": [
Index: clang/test/Analysis/cfg.c
===
--- clang/test/Analysis/cfg.c
+++ clang/test/Analysis/cfg.c
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -fheinous-gnu-extensions %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,WARNINGS %s
+// RUN: FileCheck --input-file=%t --check-prefix=CHECK %s
 
 // This file is the C version of cfg.cpp.
 // Tests that are C-specific should go into this file.
Index: clang/test/Analysis/cfg-rich-constructors.mm
===
--- clang/test/Analysis/cfg-rich-constructors.mm
+++ clang/test/Analysis/cfg-rich-constructors.mm
@@ -1,11 +1,11 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++11 -w %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,ELIDE,CXX11-ELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,CXX11-ELIDE %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++17 -w %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17,ELIDE,CXX17-ELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17 %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++11 -w -analyzer-config elide-constructors=false %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,NOELIDE,CXX11-NOELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,CXX11-NOELIDE %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++17 -w -analyzer-config elide-constructors=false %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17,NOELIDE,CXX17-NOELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17 %s
 
 class D {
 public:
Index: clang/test/Analysis/cfg-rich-constructors.cpp
===
--- clang/test/Analysis/cfg-rich-constructors.cpp
+++ clang/test/Analysis/cfg-rich-constructors.cpp
@@ -1,11 +1,11 @@
 

[PATCH] D95249: [NFC] Disallow unused prefixes in clang/test/Analysis

2021-01-22 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95249

Files:
  clang/test/Analysis/auto-obj-dtors-cfg-output.cpp
  clang/test/Analysis/cfg-rich-constructors.cpp
  clang/test/Analysis/cfg-rich-constructors.mm
  clang/test/Analysis/cfg.c
  clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
  clang/test/Analysis/lit.local.cfg

Index: clang/test/Analysis/lit.local.cfg
===
--- clang/test/Analysis/lit.local.cfg
+++ clang/test/Analysis/lit.local.cfg
@@ -1,5 +1,5 @@
 # -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
-
+from lit.llvm.subst import ToolSubst
 import site
 
 # Load the custom analyzer test format, which runs the test again with Z3 if it
@@ -26,3 +26,9 @@
 
 if not config.root.clang_staticanalyzer:
 config.unsupported = True
+
+fc = ToolSubst('FileCheck', unresolved='fatal')
+# Insert this first. Then, we'll first update the blank FileCheck command; then,
+# the default substitution of FileCheck will replace it to its full path.
+config.substitutions.insert(0, (fc.regex,
+'FileCheck --allow-unused-prefixes=false'))
Index: clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
===
--- clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
+++ clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
@@ -1,17 +1,17 @@
 // RUN: %exploded_graph_rewriter %s \
 // RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,FOUR
 // RUN: %exploded_graph_rewriter -s %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,FOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,FOUR
 // RUN: %exploded_graph_rewriter --to=0x2 %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,NOFOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO
 // RUN: %exploded_graph_rewriter --to 2 %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,NOFOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO
 // RUN: %exploded_graph_rewriter --to 2,3 %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,NOFOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE
 // RUN: %exploded_graph_rewriter --to 4 %s \
 // RUN: | FileCheck %s -check-prefixes=ONE,TWO,THREE,FOUR
 // RUN: %exploded_graph_rewriter --to 4 -s %s \
-// RUN: | FileCheck %s -check-prefixes=ONE,TWO,NOTHREE,FOUR
+// RUN: | FileCheck %s -check-prefixes=ONE,TWO,FOUR
 
 Node0x1 [shape=record,label=
  "{{ "state_id": 0, "program_state": null, "program_points": [
Index: clang/test/Analysis/cfg.c
===
--- clang/test/Analysis/cfg.c
+++ clang/test/Analysis/cfg.c
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -fheinous-gnu-extensions %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,WARNINGS %s
+// RUN: FileCheck --input-file=%t --check-prefix=CHECK %s
 
 // This file is the C version of cfg.cpp.
 // Tests that are C-specific should go into this file.
Index: clang/test/Analysis/cfg-rich-constructors.mm
===
--- clang/test/Analysis/cfg-rich-constructors.mm
+++ clang/test/Analysis/cfg-rich-constructors.mm
@@ -1,11 +1,11 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++11 -w %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,ELIDE,CXX11-ELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,CXX11-ELIDE %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++17 -w %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17,ELIDE,CXX17-ELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17 %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++11 -w -analyzer-config elide-constructors=false %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,NOELIDE,CXX11-NOELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,CXX11-NOELIDE %s
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple x86_64-apple-darwin12 -std=c++17 -w -analyzer-config elide-constructors=false %s > %t 2>&1
-// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17,NOELIDE,CXX17-NOELIDE %s
+// RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX17 %s
 
 class D {
 public:
Index: clang/test/Analysis/cfg-rich-constructors.cpp
===
--- clang/test/Analysis/cfg-rich-constructors.cpp
+++ clang/test/Analysis/cfg-rich-constructors.cpp
@@ -1,11 +1,11 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG -triple 

[PATCH] D94825: [NewPM][Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular' inliner

2021-01-15 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe8049dc3c8a4: [NewPM][Inliner] Move the always 
inliner case in the same CGSCC pass as… (authored by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94825/new/

https://reviews.llvm.org/D94825

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Analysis/MLInlineAdvisor.h
  llvm/include/llvm/Analysis/ReplayInlineAdvisor.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/include/llvm/Transforms/IPO/Inliner.h
  llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Analysis/ReplayInlineAdvisor.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-module-inliner-wrapper.ll
  llvm/test/Other/new-pm-pgo-preinline.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/Inline/inline_stats.ll
  llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
  llvm/test/Transforms/Inline/optimization-remarks.ll
  llvm/test/Transforms/Inline/pr46945.ll

Index: llvm/test/Transforms/Inline/pr46945.ll
===
--- llvm/test/Transforms/Inline/pr46945.ll
+++ llvm/test/Transforms/Inline/pr46945.ll
@@ -1,12 +1,6 @@
-; RUN: opt %s -o - -S -passes=always-inliner-wrapper | FileCheck %s
 ; RUN: opt %s -o - -S -passes='default' | FileCheck %s
-; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s -check-prefix=BASELINE
+; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s
 
-; In the baseline case, a will be first inlined into b, which makes c recursive,
-; and, thus, un-inlinable. We need a baseline case to make sure intra-SCC order
-; is as expected: b first, then a.
-
-; BASELINE: call void @b()
 ; CHECK-NOT: call void @b()
 define void @b() alwaysinline {
 entry:
Index: llvm/test/Transforms/Inline/optimization-remarks.ll
===
--- llvm/test/Transforms/Inline/optimization-remarks.ll
+++ llvm/test/Transforms/Inline/optimization-remarks.ll
@@ -19,10 +19,10 @@
 ; RUN:   -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
 ; RUN:   FileCheck -check-prefixes=CHECK,HOTNESS,ALWAYS %s
 
-; RUN: opt < %s -passes=inliner-wrapper -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN:   -pass-remarks-analysis=inline -S 2>&1 | \
 ; RUN:   FileCheck -check-prefixes=CHECK,NO_HOTNESS,ALWAYS %s
-; RUN: opt < %s -passes=inliner-wrapper -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN:   -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
 ; RUN:   FileCheck -check-prefixes=CHECK,HOTNESS,ALWAYS %s
 
Index: llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
===
--- llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
+++ llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
@@ -4,7 +4,7 @@
 ; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
 ; RUN: | FileCheck %s
-; RUN: opt < %s -passes=inliner-wrapper -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
 ; RUN: | FileCheck %s
 
Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -6,11 +6,11 @@
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s 

[PATCH] D94825: [NewPM][Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular' inliner

2021-01-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 317133.
mtrofin added a comment.
Herald added subscribers: wenlei, steven_wu.

updated with all tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94825/new/

https://reviews.llvm.org/D94825

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Analysis/MLInlineAdvisor.h
  llvm/include/llvm/Analysis/ReplayInlineAdvisor.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/include/llvm/Transforms/IPO/Inliner.h
  llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Analysis/ReplayInlineAdvisor.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-module-inliner-wrapper.ll
  llvm/test/Other/new-pm-pgo-preinline.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/Inline/inline_stats.ll
  llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
  llvm/test/Transforms/Inline/optimization-remarks.ll
  llvm/test/Transforms/Inline/pr46945.ll

Index: llvm/test/Transforms/Inline/pr46945.ll
===
--- llvm/test/Transforms/Inline/pr46945.ll
+++ llvm/test/Transforms/Inline/pr46945.ll
@@ -1,12 +1,6 @@
-; RUN: opt %s -o - -S -passes=always-inliner-wrapper | FileCheck %s
 ; RUN: opt %s -o - -S -passes='default' | FileCheck %s
-; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s -check-prefix=BASELINE
+; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s
 
-; In the baseline case, a will be first inlined into b, which makes c recursive,
-; and, thus, un-inlinable. We need a baseline case to make sure intra-SCC order
-; is as expected: b first, then a.
-
-; BASELINE: call void @b()
 ; CHECK-NOT: call void @b()
 define void @b() alwaysinline {
 entry:
Index: llvm/test/Transforms/Inline/optimization-remarks.ll
===
--- llvm/test/Transforms/Inline/optimization-remarks.ll
+++ llvm/test/Transforms/Inline/optimization-remarks.ll
@@ -19,10 +19,10 @@
 ; RUN:   -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
 ; RUN:   FileCheck -check-prefixes=CHECK,HOTNESS,ALWAYS %s
 
-; RUN: opt < %s -passes=inliner-wrapper -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN:   -pass-remarks-analysis=inline -S 2>&1 | \
 ; RUN:   FileCheck -check-prefixes=CHECK,NO_HOTNESS,ALWAYS %s
-; RUN: opt < %s -passes=inliner-wrapper -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN:   -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
 ; RUN:   FileCheck -check-prefixes=CHECK,HOTNESS,ALWAYS %s
 
Index: llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
===
--- llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
+++ llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
@@ -4,7 +4,7 @@
 ; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
 ; RUN: | FileCheck %s
-; RUN: opt < %s -passes=inliner-wrapper -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
 ; RUN: | FileCheck %s
 
Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -6,11 +6,11 @@
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK
 
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s 

[PATCH] D94825: [NewPM][Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular' inliner

2021-01-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin marked 2 inline comments as done.
mtrofin added inline comments.



Comment at: llvm/lib/Analysis/InlineAdvisor.cpp:463
+return getAdviceImpl(CB);
+  bool Advice = CB.getCaller() != CB.getCalledFunction() &&
+MandatoryInliningKind::Always ==

aeubanks wrote:
> mtrofin wrote:
> > aeubanks wrote:
> > > I see this check a lot, should this be handled in some common place 
> > > instead? Like `getMandatoryKind()`?
> > this is the recursion avoidance test. it's separate from mandatory - I 
> > suppose we can factor it upfront.
> We don't inline self-recursive CallBases right? Seems like we should always 
> get a `Never` in that case. But not super important to factor that out right 
> now.
right - I kept going back and forth between letting advisors handle that - you 
could, for example, imagine one that handled recursion and tracked 
caller/callee to allow a max number of recursive inlinings. But also something 
that can be factored now, and we deal with it when we get there.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94825/new/

https://reviews.llvm.org/D94825

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94825: [NewPM][Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular' inliner

2021-01-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin marked 2 inline comments as done.
mtrofin added inline comments.



Comment at: llvm/lib/Analysis/InlineAdvisor.cpp:463
+return getAdviceImpl(CB);
+  bool Advice = CB.getCaller() != CB.getCalledFunction() &&
+MandatoryInliningKind::Always ==

aeubanks wrote:
> I see this check a lot, should this be handled in some common place instead? 
> Like `getMandatoryKind()`?
this is the recursion avoidance test. it's separate from mandatory - I suppose 
we can factor it upfront.



Comment at: llvm/lib/Analysis/MLInlineAdvisor.cpp:254
+  bool Advice) 
{
+  // Make sure we track inlinings in all cases - mandatory or not.
+  if (Advice && !ForceStop)

aeubanks wrote:
> Is there a reason to track mandatory inlines? Seems like extra noise
yes, they change the stats that this inline advisor is tracking (currently nr 
edges, nodes, stuff like that)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94825/new/

https://reviews.llvm.org/D94825

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94825: [NewPM]i[Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular' inliner

2021-01-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 317085.
mtrofin added a comment.

patched tests other than Other/ ones.

We want to rationalize emitting remarks, see also D94334 
; I'd prefer first landing the always inlining 
refactoring, because that would impact the remarks refactoring more than 
vice-versa (I think).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94825/new/

https://reviews.llvm.org/D94825

Files:
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Analysis/MLInlineAdvisor.h
  llvm/include/llvm/Analysis/ReplayInlineAdvisor.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/include/llvm/Transforms/IPO/Inliner.h
  llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Analysis/ReplayInlineAdvisor.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/new-pm-module-inliner-wrapper.ll
  llvm/test/Transforms/Inline/inline_stats.ll
  llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
  llvm/test/Transforms/Inline/optimization-remarks.ll
  llvm/test/Transforms/Inline/pr46945.ll

Index: llvm/test/Transforms/Inline/pr46945.ll
===
--- llvm/test/Transforms/Inline/pr46945.ll
+++ llvm/test/Transforms/Inline/pr46945.ll
@@ -1,12 +1,6 @@
-; RUN: opt %s -o - -S -passes=always-inliner-wrapper | FileCheck %s
 ; RUN: opt %s -o - -S -passes='default' | FileCheck %s
-; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s -check-prefix=BASELINE
+; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s
 
-; In the baseline case, a will be first inlined into b, which makes c recursive,
-; and, thus, un-inlinable. We need a baseline case to make sure intra-SCC order
-; is as expected: b first, then a.
-
-; BASELINE: call void @b()
 ; CHECK-NOT: call void @b()
 define void @b() alwaysinline {
 entry:
Index: llvm/test/Transforms/Inline/optimization-remarks.ll
===
--- llvm/test/Transforms/Inline/optimization-remarks.ll
+++ llvm/test/Transforms/Inline/optimization-remarks.ll
@@ -19,10 +19,10 @@
 ; RUN:   -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
 ; RUN:   FileCheck -check-prefixes=CHECK,HOTNESS,ALWAYS %s
 
-; RUN: opt < %s -passes=inliner-wrapper -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN:   -pass-remarks-analysis=inline -S 2>&1 | \
 ; RUN:   FileCheck -check-prefixes=CHECK,NO_HOTNESS,ALWAYS %s
-; RUN: opt < %s -passes=inliner-wrapper -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN:   -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 | \
 ; RUN:   FileCheck -check-prefixes=CHECK,HOTNESS,ALWAYS %s
 
Index: llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
===
--- llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
+++ llvm/test/Transforms/Inline/optimization-remarks-with-hotness.ll
@@ -4,7 +4,7 @@
 ; RUN: opt < %s -passes=inline -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
 ; RUN: | FileCheck %s
-; RUN: opt < %s -passes=inliner-wrapper -pass-remarks=inline -pass-remarks-missed=inline \
+; RUN: opt < %s -passes=inliner-wrapper-no-mandatory-first -pass-remarks=inline -pass-remarks-missed=inline \
 ; RUN: -pass-remarks-analysis=inline -pass-remarks-with-hotness -S 2>&1 \
 ; RUN: | FileCheck %s
 
Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -6,11 +6,11 @@
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK
 
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK
+; RUN: opt -S -passes=inliner-wrapper-no-mandatory-first 

[PATCH] D94825: [NewPM]i[Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular' inliner

2021-01-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin added a reviewer: aeubanks.
Herald added subscribers: hiraditya, eraman.
mtrofin requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

Expanding from D94808  - we ensure the same 
InlineAdvisor is used by both
InlinerPass instances. The notion of mandatory inlining is moved into
the core InlineAdvisor: advisors anyway have to handle that case, so
this change also factors out that a bit better.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94825

Files:
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Analysis/MLInlineAdvisor.h
  llvm/include/llvm/Analysis/ReplayInlineAdvisor.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/include/llvm/Transforms/IPO/Inliner.h
  llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Analysis/ReplayInlineAdvisor.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/new-pm-module-inliner-wrapper.ll
  llvm/test/Transforms/Inline/inline_stats.ll
  llvm/test/Transforms/Inline/pr46945.ll

Index: llvm/test/Transforms/Inline/pr46945.ll
===
--- llvm/test/Transforms/Inline/pr46945.ll
+++ llvm/test/Transforms/Inline/pr46945.ll
@@ -1,12 +1,6 @@
-; RUN: opt %s -o - -S -passes=always-inliner-wrapper | FileCheck %s
 ; RUN: opt %s -o - -S -passes='default' | FileCheck %s
-; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s -check-prefix=BASELINE
+; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s
 
-; In the baseline case, a will be first inlined into b, which makes c recursive,
-; and, thus, un-inlinable. We need a baseline case to make sure intra-SCC order
-; is as expected: b first, then a.
-
-; BASELINE: call void @b()
 ; CHECK-NOT: call void @b()
 define void @b() alwaysinline {
 entry:
Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -6,11 +6,11 @@
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK
 
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK
+; RUN: opt -S -passes=inliner-wrapper-no-mandatory-first -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefixes=CHECK-BASIC,CHECK
+; RUN: opt -S -passes=inliner-wrapper-no-mandatory-first -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes="CHECK-VERBOSE",CHECK
 
-; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER
-; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefixes=WRAPPER-VERBOSE,WRAPPER
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s --check-prefix=MANDATORY-FIRST
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s --check-prefix=MANDATORY-FIRST
 
 ; CHECK: --- Dumping inliner stats for [] ---
 ; CHECK-BASIC-NOT: -- List of inlined functions:
@@ -30,15 +30,20 @@
 ; CHECK: non-imported functions inlined anywhere: 1 [33.33% of non-imported functions]
 ; CHECK: non-imported functions inlined into importing module: 1 [33.33% of non-imported functions]
 
-; WRAPPER-VERBOSE: -- List of inlined functions:
-; WRAPPER-VERBOSE: Inlined imported function [external5]: #inlines = 1, #inlines_to_importing_module = 1
-; WRAPPER: -- Summary:
-; WRAPPER: All functions: 10, imported functions: 7
-; WRAPPER: inlined functions: 1 [10% of all functions]
-; WRAPPER: imported functions inlined anywhere: 1 [14.29% of imported functions]
-; WRAPPER: imported functions inlined into importing module: 1 [14.29% of imported functions], remaining: 6 [85.71% of imported functions]
-; WRAPPER: non-imported functions inlined anywhere: 0 [0% of non-imported functions]
-; WRAPPER: non-imported functions inlined into importing module: 0 [0% of non-imported functions]
+; MANDATORY-FIRST: - Summary:
+; 

[PATCH] D94808: [NewPM][Inliner] Move mandatory inliner inside function simplification pipeline

2021-01-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

I think InlineAdvisor::getAdvice needs to take a bool MandatoryOnly, which 
Inliner then passes. This allows us to then use the same advisor for both the 
always case and the policy-driven inliner instances, which allows that advisor 
to correctly book-keep any module wide state it may want to.




Comment at: llvm/include/llvm/Transforms/IPO/Inliner.h:111
+  std::unique_ptr OwnedAdvisor;
+  bool Mandatory;
 };

Nit: const bool



Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:661
 FunctionAnalysisManager , Module ) {
+  if (Mandatory) {
+OwnedAdvisor = std::make_unique(FAM);

This should move to line 675: if we have installed an advisor, we use it, and 
the inliner pass passes to getAdvice() whether it only needs mandatory advice. 
All advisors need to support the mandatory case anyway.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94808/new/

https://reviews.llvm.org/D94808

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2021-01-14 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D93078#2500124 , @jdoerfert wrote:

> In D93078#2500122 , @mtrofin wrote:
>
>> In D93078#2500114 , @jdoerfert 
>> wrote:
>>
>>> In D93078#2500040 , @mtrofin wrote:
>>>
 In D93078#2500032 , @jdoerfert 
 wrote:

> In D93078#246 , @mtrofin 
> wrote:
>
>> In D93078#245 , @jdoerfert 
>> wrote:
>>
>>> I'm not sure how this is more helpful. What is the use case where this 
>>> way of warning helps?
>>
>> For tests other than attributor, that explicitly set FileCheck 
>> --allow-unused-prefixes=true, these warnings mean that there will be 
>> unused prefixes (those listed)
>
> Should not we check for that flag in the RUN line then and only warn for 
> unused prefixes when it is set. If there is no prefix we should obviously 
> always warn.

 That's a good idea. Probably we'd need to also make sure that the unused 
 prefixes are all on RUN lines with --allow-unused-prefixes=true.

 I'm also not sure how lit.local.cfg interacts with the test prefix 
 updater: currently, the only cases where we bulk-want to allow unused 
 prefixes is the Attributor tests. If you were going to add the flag 
 explicitly, that'd also work. Or just the option to the update_test_prefix 
 that says "ok with duplicates, don't warn"
>>>
>>> I can add the option explicitly (D94744 ). 
>>> We should look for the filecheck one if possible, two options means double 
>>> the hassle. That said, why are we warning in both FileCheck and 
>>> update_test_check, it seems to be unnecessary to do the latter.
>>
>> update_test_prefix.py's role is temporary: once we flip FileCheck to 
>> disallow unused prefixes by default, we don't need to keep it around. At 
>> that point, it becomes important for the update__test_check scripts to 
>> warn.
>
> I don't follow. I would assume it's the opposite. If FileCheck doesn't allow 
> unused prefixes why warn in the update script as well. Anyway, there should 
> be a way to opt-out.



In D93078#2500124 , @jdoerfert wrote:

> In D93078#2500122 , @mtrofin wrote:
>
>> In D93078#2500114 , @jdoerfert 
>> wrote:
>>
>>> In D93078#2500040 , @mtrofin wrote:
>>>
 In D93078#2500032 , @jdoerfert 
 wrote:

> In D93078#246 , @mtrofin 
> wrote:
>
>> In D93078#245 , @jdoerfert 
>> wrote:
>>
>>> I'm not sure how this is more helpful. What is the use case where this 
>>> way of warning helps?
>>
>> For tests other than attributor, that explicitly set FileCheck 
>> --allow-unused-prefixes=true, these warnings mean that there will be 
>> unused prefixes (those listed)
>
> Should not we check for that flag in the RUN line then and only warn for 
> unused prefixes when it is set. If there is no prefix we should obviously 
> always warn.

 That's a good idea. Probably we'd need to also make sure that the unused 
 prefixes are all on RUN lines with --allow-unused-prefixes=true.

 I'm also not sure how lit.local.cfg interacts with the test prefix 
 updater: currently, the only cases where we bulk-want to allow unused 
 prefixes is the Attributor tests. If you were going to add the flag 
 explicitly, that'd also work. Or just the option to the update_test_prefix 
 that says "ok with duplicates, don't warn"
>>>
>>> I can add the option explicitly (D94744 ). 
>>> We should look for the filecheck one if possible, two options means double 
>>> the hassle. That said, why are we warning in both FileCheck and 
>>> update_test_check, it seems to be unnecessary to do the latter.
>>
>> update_test_prefix.py's role is temporary: once we flip FileCheck to 
>> disallow unused prefixes by default, we don't need to keep it around. At 
>> that point, it becomes important for the update__test_check scripts to 
>> warn.
>
> I don't follow. I would assume it's the opposite. If FileCheck doesn't allow 
> unused prefixes why warn in the update script as well. Anyway, there should 
> be a way to opt-out.

There's an earlier comment in this patch about that, anchored to line 296 of 
common.py. IIUC, a developer: 1) updates their test by adding new RUN lines, 
maybe adding prefixes to existing RUN lines, 2) runs the appropriate 
update_xyz_checks.py. Then, indeed, they 

[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2021-01-14 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D93078#2500114 , @jdoerfert wrote:

> In D93078#2500040 , @mtrofin wrote:
>
>> In D93078#2500032 , @jdoerfert 
>> wrote:
>>
>>> In D93078#246 , @mtrofin wrote:
>>>
 In D93078#245 , @jdoerfert 
 wrote:

> I'm not sure how this is more helpful. What is the use case where this 
> way of warning helps?

 For tests other than attributor, that explicitly set FileCheck 
 --allow-unused-prefixes=true, these warnings mean that there will be 
 unused prefixes (those listed)
>>>
>>> Should not we check for that flag in the RUN line then and only warn for 
>>> unused prefixes when it is set. If there is no prefix we should obviously 
>>> always warn.
>>
>> That's a good idea. Probably we'd need to also make sure that the unused 
>> prefixes are all on RUN lines with --allow-unused-prefixes=true.
>>
>> I'm also not sure how lit.local.cfg interacts with the test prefix updater: 
>> currently, the only cases where we bulk-want to allow unused prefixes is the 
>> Attributor tests. If you were going to add the flag explicitly, that'd also 
>> work. Or just the option to the update_test_prefix that says "ok with 
>> duplicates, don't warn"
>
> I can add the option explicitly (D94744 ). 
> We should look for the filecheck one if possible, two options means double 
> the hassle. That said, why are we warning in both FileCheck and 
> update_test_check, it seems to be unnecessary to do the latter.

update_test_prefix.py's role is temporary: once we flip FileCheck to disallow 
unused prefixes by default, we don't need to keep it around. At that point, it 
becomes important for the update__test_check scripts to warn.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2021-01-14 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D93078#2500032 , @jdoerfert wrote:

> In D93078#246 , @mtrofin wrote:
>
>> In D93078#245 , @jdoerfert 
>> wrote:
>>
>>> In D93078#2499982 , @mtrofin wrote:
>>>
 In D93078#2499666 , @jdoerfert 
 wrote:

> I think this caused a lot of problems for the Attributor tests. I get the 
> "conflict output" warning all the time now :(
>
> These two `UpdateTestChecks` tests also generate the warning. I would 
> think that they haven't before.
>
>   LLVM :: tools/UpdateTestChecks/update_test_checks/check_attrs.test
>   LLVM :: 
> tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
>
> I suspect the `--check-attributes` flag effect are not taken into account 
> somewhere but I might be wrong.

 The warnings are correct, but their purpose is to inform. For example, 
 take check_attrs. The third and fourth opt run produce different function 
 attributes from those produced by the first two, so the function is 
 different insofar as update_test_prefix is concerned. The warnings are 
 there to indicate that the listed prefixes end up not being used. But, 
 that's 'by design' for the attributor tests, IIRC.

 If the warnings are noise for you, we could add a flag to quiet them down, 
 which you'd flip when regenerating attributor tests?
>>>
>>> TBH, before, the warnings meant there is a problem that needs fixing. Now 
>>> they mean, there might be one or not. So, depending on your setup it's just 
>>> noise while it was pure signal before.
>>> I'm not sure how this is more helpful. What is the use case where this way 
>>> of warning helps?
>>
>> For tests other than attributor, that explicitly set FileCheck 
>> --allow-unused-prefixes=true, these warnings mean that there will be unused 
>> prefixes (those listed)
>
> Should not we check for that flag in the RUN line then and only warn for 
> unused prefixes when it is set. If there is no prefix we should obviously 
> always warn.

That's a good idea. Probably we'd need to also make sure that the unused 
prefixes are all on RUN lines with --allow-unused-prefixes=true.

I'm also not sure how lit.local.cfg interacts with the test prefix updater: 
currently, the only cases where we bulk-want to allow unused prefixes is the 
Attributor tests. If you were going to add the flag explicitly, that'd also 
work. Or just the option to the update_test_prefix that says "ok with 
duplicates, don't warn"


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2021-01-14 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D93078#245 , @jdoerfert wrote:

> In D93078#2499982 , @mtrofin wrote:
>
>> In D93078#2499666 , @jdoerfert 
>> wrote:
>>
>>> I think this caused a lot of problems for the Attributor tests. I get the 
>>> "conflict output" warning all the time now :(
>>>
>>> These two `UpdateTestChecks` tests also generate the warning. I would think 
>>> that they haven't before.
>>>
>>>   LLVM :: tools/UpdateTestChecks/update_test_checks/check_attrs.test
>>>   LLVM :: 
>>> tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
>>>
>>> I suspect the `--check-attributes` flag effect are not taken into account 
>>> somewhere but I might be wrong.
>>
>> The warnings are correct, but their purpose is to inform. For example, take 
>> check_attrs. The third and fourth opt run produce different function 
>> attributes from those produced by the first two, so the function is 
>> different insofar as update_test_prefix is concerned. The warnings are there 
>> to indicate that the listed prefixes end up not being used. But, that's 'by 
>> design' for the attributor tests, IIRC.
>>
>> If the warnings are noise for you, we could add a flag to quiet them down, 
>> which you'd flip when regenerating attributor tests?
>
> TBH, before, the warnings meant there is a problem that needs fixing. Now 
> they mean, there might be one or not. So, depending on your setup it's just 
> noise while it was pure signal before.
> I'm not sure how this is more helpful. What is the use case where this way of 
> warning helps?

For tests other than attributor, that explicitly set FileCheck 
--allow-unused-prefixes=true, these warnings mean that there will be unused 
prefixes (those listed)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2021-01-14 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D93078#2499666 , @jdoerfert wrote:

> I think this caused a lot of problems for the Attributor tests. I get the 
> "conflict output" warning all the time now :(
>
> These two `UpdateTestChecks` tests also generate the warning. I would think 
> that they haven't before.
>
>   LLVM :: tools/UpdateTestChecks/update_test_checks/check_attrs.test
>   LLVM :: tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
>
> I suspect the `--check-attributes` flag effect are not taken into account 
> somewhere but I might be wrong.

The warnings are correct, but their purpose is to inform. For example, take 
check_attrs. The third and fourth opt run produce different function attributes 
from those produced by the first two, so the function is different insofar as 
update_test_prefix is concerned. The warnings are there to indicate that the 
listed prefixes end up not being used. But, that's 'by design' for the 
attributor tests, IIRC.

If the warnings are noise for you, we could add a flag to quiet them down, 
which you'd flip when regenerating attributor tests?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94644: [Inliner] Inline alwaysinline calls first

2021-01-14 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D94644#2498638 , @aeubanks wrote:

> It's not an emergency.
> The issue with InlineAdvisorAnalysis is that the ModuleInlineWrapperPass 
> presets the InliningAdvisorMode of the InlineAdvisorAnalysis. We could force 
> override it, but then what's the point of InlineAdvisorAnalysis? Can't we 
> just create an InlineAdvisor in the pass itself rather than using a wrapper 
> like InlineAdvisorAnalysis?

We need to have the advisor module-wide, because its goal is to track 
module-wide stats, which we leverage in the ML advisor.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94644/new/

https://reviews.llvm.org/D94644

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94644: [Inliner] Inline alwaysinline calls first

2021-01-13 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D94644#2497180 , @aeubanks wrote:

> An alternative is to run the mandatory inliner in the same CGSCC pipeline as 
> everything else, but the way InlineAdvisorAnalysis is setup made it hard to 
> implement

I don't remember there being a particular challenge with the advisor - it was 
more that there was the other value of having a more accurate 'view' of the 
overall shape of the functions, if we want to include more context in inlining 
decision making. My preference would be to have a robust solution that 
addresses both this and the previous problem.

So I make sure I understand it correctly: it sounds like in PR48734, the callee 
wasn't first optimized through the function simplification pipeline, is that 
correct?

Let's try the mandatory inliner in the same CGSCC - happy to do that. Is 
PR48734 an emergency (I can take a look at this tomorrow morning PST)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94644/new/

https://reviews.llvm.org/D94644

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D94644: [Inliner] Inline alwaysinline calls first

2021-01-13 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

Would running the function simplification pipeline after the always inline pass 
address the issue?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94644/new/

https://reviews.llvm.org/D94644

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2020-12-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added inline comments.



Comment at: llvm/utils/update_analyze_test_checks.py:129
+
+common.warn_on_failed_prefixes(func_dict)
 is_in_function = False

pengfei wrote:
> Can we move these warn to common.py?
Come to think of it, maybe moving it to common.py was not quite ideal:
- once a warning is issued in the middle of the list of RUN lines, it'll just 
be re-issued next time around; we could warn and exit, but that'd be annoying 
if there's another failure later in the RUN list.
- if we do it at the end, we can additionally distinguish the case where a 
prefix has an empty dict of funcs associated with it -> and the warning would 
be "there are unused prefixes - please remove %s'. This is more discoverable 
than llvm-lit -a, and also than relying on the user knowing to run 
uplate_test_prefix.

I think that the benefits (discoverability, better, more concise warnings) make 
the extra 2-3 lines worth it; and we already have tests for these other tools - 
wdyt?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2020-12-15 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe2dc306b1ac7: [utils] Fix UpdateTestChecks case where 2 runs 
differ for last label (authored by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

Files:
  clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp
  clang/test/utils/update_cc_test_checks/prefix-never-matches.test
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-1.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-2.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-3.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/prefix-never-matches.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll
  llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_test_prefix.py

Index: llvm/utils/update_test_prefix.py
===
--- llvm/utils/update_test_prefix.py
+++ llvm/utils/update_test_prefix.py
@@ -31,7 +31,7 @@
 t = re.search('Assertions have been autogenerated by (.*)', s)
 if t:
 s = os.popen('llvm/' + t.group(1) + ' ' + i + ' 2>&1').read()
-if 'Found conflicting' in s:
+if 'had conflicting output from different RUN lines for all functions' in s:
 return -1
 s = os.popen('git diff ' + i).read()
 if re.search('\n(?:-+)\n', s) or re.search('\n[+-].*(?&1 | FileCheck %s
+# RUN: FileCheck --input-file=%t.ll %s --check-prefix=OUTPUT
+
+# CHECK: WARNING: Prefix A had conflicting output
+# OUTPUT-NOT: A:
\ No newline at end of file
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll
===
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll
@@ -0,0 +1,7 @@
+; RUN: opt -O0 -S < %s  | FileCheck %s -check-prefix=A
+; RUN: opt -O3 -S < %s  | FileCheck %s -check-prefix=A
+
+define i32 @foo(i32 %i) {
+%r = add i32 1, 1
+ret i32 %r
+}
\ No newline at end of file
Index: llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
===
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
@@ -0,0 +1,8 @@
+# REQUIRES: x86-registered-target
+
+# RUN: cp -f %S/Inputs/prefix-never-matches.ll %t.ll
+# RUN: %update_llc_test_checks %t.ll 2>&1 | FileCheck %s
+# RUN: FileCheck --input-file=%t.ll %s --check-prefix=OUTPUT
+
+# CHECK: WARNING: Prefix A had conflicting output
+# OUTPUT-NOT: A:
\ No newline at end of file
Index: llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
===
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
@@ -0,0 +1,14 @@
+# REQUIRES: x86-registered-target
+
+# RUN: cp -f %S/Inputs/common-label-different-bodies-1.ll %t-1.ll
+# RUN: cp -f %S/Inputs/common-label-different-bodies-2.ll %t-2.ll
+# RUN: cp -f %S/Inputs/common-label-different-bodies-3.ll %t-3.ll
+# RUN: %update_llc_test_checks %t-1.ll
+# RUN: %update_llc_test_checks %t-2.ll
+# RUN: %update_llc_test_checks %t-3.ll
+# RUN: FileCheck --input-file=%t-1.ll %s
+# RUN: FileCheck --input-file=%t-2.ll %s
+# RUN: FileCheck --input-file=%t-3.ll %s
+
+# CHECK: B-LABEL: fold_v2i64
+# CHECK-NOT: A-LABEL: fold_v2i64
\ No newline at end of file
Index: llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/prefix-never-matches.ll
===
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/prefix-never-matches.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -mattr=+sse2 | FileCheck %s --check-prefixes=A
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=A
+
+declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
+
+define <2 x i64> @fold_v2i64() {
+entry:
+  %r = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> )
+  ret <2 x i64> %r
+}
Index: llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-3.ll
===
--- /dev/null
+++ 

[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2020-12-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 311896.
mtrofin added a comment.

update_test_prefix.py change


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

Files:
  clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp
  clang/test/utils/update_cc_test_checks/prefix-never-matches.test
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-1.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-2.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-3.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/prefix-never-matches.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll
  llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_test_prefix.py

Index: llvm/utils/update_test_prefix.py
===
--- llvm/utils/update_test_prefix.py
+++ llvm/utils/update_test_prefix.py
@@ -31,7 +31,7 @@
 t = re.search('Assertions have been autogenerated by (.*)', s)
 if t:
 s = os.popen('llvm/' + t.group(1) + ' ' + i + ' 2>&1').read()
-if 'Found conflicting' in s:
+if 'had conflicting output from different RUN lines for all functions' in s:
 return -1
 s = os.popen('git diff ' + i).read()
 if re.search('\n(?:-+)\n', s) or re.search('\n[+-].*(?&1 | FileCheck %s
+# RUN: FileCheck --input-file=%t.ll %s --check-prefix=OUTPUT
+
+# CHECK: WARNING: Prefix A had conflicting output
+# OUTPUT-NOT: A:
\ No newline at end of file
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll
===
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll
@@ -0,0 +1,7 @@
+; RUN: opt -O0 -S < %s  | FileCheck %s -check-prefix=A
+; RUN: opt -O3 -S < %s  | FileCheck %s -check-prefix=A
+
+define i32 @foo(i32 %i) {
+%r = add i32 1, 1
+ret i32 %r
+}
\ No newline at end of file
Index: llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
===
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
@@ -0,0 +1,8 @@
+# REQUIRES: x86-registered-target
+
+# RUN: cp -f %S/Inputs/prefix-never-matches.ll %t.ll
+# RUN: %update_llc_test_checks %t.ll 2>&1 | FileCheck %s
+# RUN: FileCheck --input-file=%t.ll %s --check-prefix=OUTPUT
+
+# CHECK: WARNING: Prefix A had conflicting output
+# OUTPUT-NOT: A:
\ No newline at end of file
Index: llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
===
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
@@ -0,0 +1,14 @@
+# REQUIRES: x86-registered-target
+
+# RUN: cp -f %S/Inputs/common-label-different-bodies-1.ll %t-1.ll
+# RUN: cp -f %S/Inputs/common-label-different-bodies-2.ll %t-2.ll
+# RUN: cp -f %S/Inputs/common-label-different-bodies-3.ll %t-3.ll
+# RUN: %update_llc_test_checks %t-1.ll
+# RUN: %update_llc_test_checks %t-2.ll
+# RUN: %update_llc_test_checks %t-3.ll
+# RUN: FileCheck --input-file=%t-1.ll %s
+# RUN: FileCheck --input-file=%t-2.ll %s
+# RUN: FileCheck --input-file=%t-3.ll %s
+
+# CHECK: B-LABEL: fold_v2i64
+# CHECK-NOT: A-LABEL: fold_v2i64
\ No newline at end of file
Index: llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/prefix-never-matches.ll
===
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/prefix-never-matches.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -mattr=+sse2 | FileCheck %s --check-prefixes=A
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=A
+
+declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
+
+define <2 x i64> @fold_v2i64() {
+entry:
+  %r = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> )
+  ret <2 x i64> %r
+}
Index: llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-3.ll
===
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-3.ll
@@ -0,0 +1,11 @@
+; RUN: llc < %s -mtriple=i686-unknown-linux-gnu -mattr=+sse2 | FileCheck %s --check-prefixes=A,B

[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2020-12-15 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D93078#2453891 , @pengfei wrote:

> LGTM. Thanks.
> `update_test_prefix.py` assumes the conflicting output. You may need to 
> change the expection of it as well.

oh yes - made it check the new warning. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2020-12-14 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

cleanup


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2020-12-14 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 311593.
mtrofin marked 3 inline comments as done.
mtrofin added a comment.

fix


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

Files:
  clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp
  clang/test/utils/update_cc_test_checks/prefix-never-matches.test
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-1.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-2.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-3.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/prefix-never-matches.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll
  llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
  llvm/utils/UpdateTestChecks/common.py

Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -258,6 +258,20 @@
   def __str__(self):
 return self.scrub
 
+def get_failed_prefixes(func_dict):
+  # This returns the list of those prefixes that failed to match any function,
+  # because there were conflicting bodies produced by different RUN lines, in
+  # all instances of the prefix. Effectivelly, this prefix is unused and should
+  # be removed.
+  for prefix in func_dict:
+if (not [fct for fct in func_dict[prefix] 
+ if func_dict[prefix][fct] is not None]):
+  yield prefix
+
+def warn_on_failed_prefixes(func_dict):
+  for prefix in get_failed_prefixes(func_dict):
+  warn('Prefix %s had conflicting output from different RUN lines for all functions' % (prefix,))
+
 def build_function_body_dictionary(function_re, scrubber, scrubber_args, raw_tool_output, prefixes, func_dict, func_order, verbose, record_args, check_attributes):
   for m in function_re.finditer(raw_tool_output):
 if not m:
@@ -287,20 +301,28 @@
 print('  ' + l, file=sys.stderr)
 for prefix in prefixes:
   if func in func_dict[prefix]:
-if str(func_dict[prefix][func]) != scrubbed_body or (func_dict[prefix][func] and (func_dict[prefix][func].args_and_sig != args_and_sig or func_dict[prefix][func].attrs != attrs)):
-  if func_dict[prefix][func] and func_dict[prefix][func].is_same_except_arg_names(scrubbed_extra, args_and_sig, attrs):
+if (func_dict[prefix][func] is None or
+str(func_dict[prefix][func]) != scrubbed_body or
+func_dict[prefix][func].args_and_sig != args_and_sig or
+func_dict[prefix][func].attrs != attrs):
+  if (func_dict[prefix][func] is not None and
+  func_dict[prefix][func].is_same_except_arg_names(scrubbed_extra,
+   args_and_sig,
+   attrs)):
 func_dict[prefix][func].scrub = scrubbed_extra
 func_dict[prefix][func].args_and_sig = args_and_sig
 continue
   else:
-if prefix == prefixes[-1]:
-  warn('Found conflicting asm under the same prefix: %r!' % (prefix,))
-else:
-  func_dict[prefix][func] = None
-  continue
+# This means a previous RUN line produced a body for this function
+# that is different from the one produced by this current RUN line,
+# so the body can't be common accross RUN lines. We use None to
+# indicate that.
+func_dict[prefix][func] = None
+continue
 
   func_dict[prefix][func] = function_body(scrubbed_body, scrubbed_extra, args_and_sig, attrs)
   func_order[prefix].append(func)
+  warn_on_failed_prefixes(func_dict)
 
 # Generator of LLVM IR CHECK lines
 
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
===
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
@@ -0,0 +1,6 @@
+# RUN: cp -f %S/Inputs/prefix-never-matches.ll %t.ll
+# RUN: %update_test_checks %t.ll 2>&1 | FileCheck %s
+# RUN: FileCheck --input-file=%t.ll %s --check-prefix=OUTPUT
+
+# CHECK: WARNING: Prefix A had conflicting output
+# OUTPUT-NOT: A:
\ No newline at end of file
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll
===
--- /dev/null
+++ 

[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2020-12-14 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin marked an inline comment as done.
mtrofin added a comment.

In D93078#2451747 , @pengfei wrote:

> What's the difference with the existing code? It looks to me that you just 
> brought the warning out of loop, right?

Oh true! we can just do the check in build_function_body_dictionary_for_triple 
at the end.

I'll leave the additional tests, though, more tests never hurt.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D93078: [utils] Fix UpdateTestChecks case where 2 runs differ for last label

2020-12-11 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 311359.
mtrofin marked an inline comment as done.
mtrofin added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

added check for when a prefix has conflicts for all functions


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93078/new/

https://reviews.llvm.org/D93078

Files:
  clang/test/utils/update_cc_test_checks/Inputs/prefix-never-matches.cpp
  clang/test/utils/update_cc_test_checks/prefix-never-matches.test
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-1.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-2.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/common-label-different-bodies-3.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/prefix-never-matches.ll
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
  
llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
  
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/prefix-never-matches.ll
  llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_analyze_test_checks.py
  llvm/utils/update_cc_test_checks.py
  llvm/utils/update_llc_test_checks.py
  llvm/utils/update_test_checks.py

Index: llvm/utils/update_test_checks.py
===
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -117,7 +117,8 @@
   common.OPT_FUNCTION_RE, common.scrub_body, [],
   raw_tool_output, prefixes, func_dict, func_order, ti.args.verbose,
   ti.args.function_signature, ti.args.check_attributes)
-
+
+common.warn_on_failed_prefixes(func_dict)
 is_in_function = False
 is_in_function_start = False
 prefix_set = set([prefix for prefixes, _ in prefix_list for prefix in prefixes])
Index: llvm/utils/update_llc_test_checks.py
===
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -118,6 +118,8 @@
   asm.build_function_body_dictionary_for_triple(ti.args, raw_tool_output,
   triple, prefixes, func_dict, func_order)
 
+common.warn_on_failed_prefixes(func_dict)
+
 is_in_function = False
 is_in_function_start = False
 func_name = None
Index: llvm/utils/update_cc_test_checks.py
===
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -266,7 +266,8 @@
   # mangled names. Forward all clang args for now.
   for k, v in get_line2spell_and_mangled(ti.args, clang_args).items():
 line2spell_and_mangled_list[k].append(v)
-
+
+common.warn_on_failed_prefixes(func_dict)
 global_vars_seen_dict = {}
 prefix_set = set([prefix for p in run_list for prefix in p[0]])
 output_lines = []
Index: llvm/utils/update_analyze_test_checks.py
===
--- llvm/utils/update_analyze_test_checks.py
+++ llvm/utils/update_analyze_test_checks.py
@@ -125,7 +125,8 @@
 common.build_function_body_dictionary(
   common.ANALYZE_FUNCTION_RE, common.scrub_body, [],
   raw_tool_output, prefixes, func_dict, func_order, args.verbose, False, False)
-
+
+common.warn_on_failed_prefixes(func_dict)
 is_in_function = False
 is_in_function_start = False
 prefix_set = set([prefix for prefixes, _ in prefix_list for prefix in prefixes])
Index: llvm/utils/UpdateTestChecks/common.py
===
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -258,6 +258,20 @@
   def __str__(self):
 return self.scrub
 
+def get_failed_prefixes(func_dict):
+  # This returns the list of those prefixes that failed to match any function,
+  # because there were conflicting bodies produced by different RUN lines, in
+  # all instances of the prefix. Effectivelly, this prefix is unused and should
+  # be removed.
+  for prefix in func_dict:
+if (not [fct for fct in func_dict[prefix] 
+ if func_dict[prefix][fct] is not None]):
+  yield prefix
+
+def warn_on_failed_prefixes(func_dict):
+  for prefix in get_failed_prefixes(func_dict):
+  warn('Prefix %s had conflicting output from different RUN lines for all functions' % (prefix,))
+
 def build_function_body_dictionary(function_re, scrubber, scrubber_args, raw_tool_output, prefixes, func_dict, func_order, verbose, record_args, check_attributes):
   for m in function_re.finditer(raw_tool_output):
 if not m:
@@ -287,17 +301,24 @@
 print('  ' + l, file=sys.stderr)
 for prefix in prefixes:
  

[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-30 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5fe10263ab39: [llvm][inliner] Reuse the inliner pass to 
implement always inliner (authored by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-module-inliner-wrapper.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
  llvm/test/Transforms/Inline/ML/bounds-checks.ll
  llvm/test/Transforms/Inline/inline_stats.ll
  llvm/test/Transforms/Inline/pr46945.ll

Index: llvm/test/Transforms/Inline/pr46945.ll
===
--- llvm/test/Transforms/Inline/pr46945.ll
+++ llvm/test/Transforms/Inline/pr46945.ll
@@ -1,12 +1,13 @@
-; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s
+; RUN: opt %s -o - -S -passes=always-inliner-wrapper | FileCheck %s
+; RUN: opt %s -o - -S -passes='default' | FileCheck %s
+; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s -check-prefix=BASELINE
 
-; CHECK-NOT: call void @b()
-define void @a() {
-entry:
-  call void @b()
-  ret void
-}
+; In the baseline case, a will be first inlined into b, which makes c recursive,
+; and, thus, un-inlinable. We need a baseline case to make sure intra-SCC order
+; is as expected: b first, then a.
 
+; BASELINE: call void @b()
+; CHECK-NOT: call void @b()
 define void @b() alwaysinline {
 entry:
   br label %for.cond
@@ -16,3 +17,8 @@
   br label %for.cond
 }
 
+define void @a() {
+entry:
+  call void @b()
+  ret void
+}
Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -6,8 +6,11 @@
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
 
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
+
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
 
 ; CHECK: --- Dumping inliner stats for [] ---
 ; CHECK-BASIC-NOT: -- List of inlined functions:
Index: llvm/test/Transforms/Inline/ML/bounds-checks.ll
===
--- llvm/test/Transforms/Inline/ML/bounds-checks.ll
+++ llvm/test/Transforms/Inline/ML/bounds-checks.ll
@@ -4,7 +4,7 @@
 ; factor, we don't inline anymore.
 ; REQUIRES: have_tf_aot
 ; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
-; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -disable-always-inliner-in-module-wrapper -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
+; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -S < %s 2>&1 | FileCheck %s 

[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-30 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added inline comments.



Comment at: llvm/include/llvm/Analysis/InlineAdvisor.h:27
 
 /// There are 3 scenarios we can use the InlineAdvisor:
 /// - Default - use manual heuristics.

aeubanks wrote:
> aeubanks wrote:
> > 4
> ping
sorry - done


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-30 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 308441.
mtrofin marked 5 inline comments as done.
mtrofin added a comment.

fixes


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-module-inliner-wrapper.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
  llvm/test/Transforms/Inline/ML/bounds-checks.ll
  llvm/test/Transforms/Inline/inline_stats.ll
  llvm/test/Transforms/Inline/pr46945.ll

Index: llvm/test/Transforms/Inline/pr46945.ll
===
--- llvm/test/Transforms/Inline/pr46945.ll
+++ llvm/test/Transforms/Inline/pr46945.ll
@@ -1,12 +1,13 @@
-; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s
+; RUN: opt %s -o - -S -passes=always-inliner-wrapper | FileCheck %s
+; RUN: opt %s -o - -S -passes='default' | FileCheck %s
+; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s -check-prefix=BASELINE
 
-; CHECK-NOT: call void @b()
-define void @a() {
-entry:
-  call void @b()
-  ret void
-}
+; In the baseline case, a will be first inlined into b, which makes c recursive,
+; and, thus, un-inlinable. We need a baseline case to make sure intra-SCC order
+; is as expected: b first, then a.
 
+; BASELINE: call void @b()
+; CHECK-NOT: call void @b()
 define void @b() alwaysinline {
 entry:
   br label %for.cond
@@ -16,3 +17,8 @@
   br label %for.cond
 }
 
+define void @a() {
+entry:
+  call void @b()
+  ret void
+}
Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -6,8 +6,11 @@
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
 
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
+
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
 
 ; CHECK: --- Dumping inliner stats for [] ---
 ; CHECK-BASIC-NOT: -- List of inlined functions:
Index: llvm/test/Transforms/Inline/ML/bounds-checks.ll
===
--- llvm/test/Transforms/Inline/ML/bounds-checks.ll
+++ llvm/test/Transforms/Inline/ML/bounds-checks.ll
@@ -4,7 +4,7 @@
 ; factor, we don't inline anymore.
 ; REQUIRES: have_tf_aot
 ; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
-; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -disable-always-inliner-in-module-wrapper -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
+; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 

[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-30 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 308422.
mtrofin added a comment.

Fixed the LTO case.

Also fixed the p46945 test, which, post - D90566 
, was passing without the need of a 
preliminary always-inlier pass.
The reason is that the order of the traversal of the functions in a SCC 
changed. The test requies that the 'alwaysinline'
function be processed first (to render it recursive and, thus, uninlinable).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-module-inliner-wrapper.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
  llvm/test/Transforms/Inline/ML/bounds-checks.ll
  llvm/test/Transforms/Inline/inline_stats.ll
  llvm/test/Transforms/Inline/pr46945.ll

Index: llvm/test/Transforms/Inline/pr46945.ll
===
--- llvm/test/Transforms/Inline/pr46945.ll
+++ llvm/test/Transforms/Inline/pr46945.ll
@@ -1,12 +1,12 @@
-; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s
+; RUN: opt %s -o - -S -passes=always-inliner-wrapper | FileCheck %s
+; RUN: opt %s -o - -S -passes=inliner-wrapper | FileCheck %s -check-prefix=BASELINE
 
-; CHECK-NOT: call void @b()
-define void @a() {
-entry:
-  call void @b()
-  ret void
-}
+; In the baseline case, a will be first inlined into b, which makes c recursive,
+; and, thus, un-inlinable. We need a baseline case to make sure intra-SCC order
+; is as expected: b first, then a.
 
+; BASELINE: call void @b()
+; CHECK-NOT: call void @b()
 define void @b() alwaysinline {
 entry:
   br label %for.cond
@@ -16,3 +16,8 @@
   br label %for.cond
 }
 
+define void @a() {
+entry:
+  call void @b()
+  ret void
+}
Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -6,8 +6,11 @@
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
 
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
+
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
 
 ; CHECK: --- Dumping inliner stats for [] ---
 ; CHECK-BASIC-NOT: -- List of inlined functions:
Index: llvm/test/Transforms/Inline/ML/bounds-checks.ll
===
--- llvm/test/Transforms/Inline/ML/bounds-checks.ll
+++ llvm/test/Transforms/Inline/ML/bounds-checks.ll
@@ -4,7 +4,7 @@
 ; factor, we don't inline anymore.
 ; REQUIRES: have_tf_aot
 ; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
-; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -disable-always-inliner-in-module-wrapper -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
+; RUN: 

[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-19 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 306593.
mtrofin added a comment.
Herald added subscribers: wenlei, steven_wu.

patched up tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  clang/test/Frontend/optimization-remark-line-directive.c
  clang/test/Frontend/optimization-remark-new-pm.c
  clang/test/Frontend/optimization-remark-with-hotness-new-pm.c
  clang/test/Frontend/optimization-remark.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-module-inliner-wrapper.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
  llvm/test/Transforms/Inline/ML/bounds-checks.ll
  llvm/test/Transforms/Inline/inline_stats.ll

Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -6,8 +6,11 @@
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
 
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
+
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
 
 ; CHECK: --- Dumping inliner stats for [] ---
 ; CHECK-BASIC-NOT: -- List of inlined functions:
Index: llvm/test/Transforms/Inline/ML/bounds-checks.ll
===
--- llvm/test/Transforms/Inline/ML/bounds-checks.ll
+++ llvm/test/Transforms/Inline/ML/bounds-checks.ll
@@ -4,7 +4,7 @@
 ; factor, we don't inline anymore.
 ; REQUIRES: have_tf_aot
 ; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
-; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -disable-always-inliner-in-module-wrapper -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
+; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-grtev4-linux-gnu"
Index: llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
===
--- llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
+++ llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
@@ -7,18 +7,18 @@
 ; REQUIRES: have_tf_api
 ;
 ; When the bounds are very wide ("no bounds"), all inlinings happen.
-; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner -training-log=- -enable-ml-inliner=development -ml-advisor-size-increase-threshold=10.0 -disable-always-inliner-in-module-wrapper -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
+; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner 

[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-18 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D91567#2403544 , @aeubanks wrote:

> In D91567#2403252 , @mtrofin wrote:
>
>> In D91567#2403236 , @aeubanks wrote:
>>
>>> One thing that would be nice would be to have both inliners in the same 
>>> CGSCC pass manager to avoid doing SCC construction twice, but that would 
>>> require some shuffling of module/cgscc passes in ModuleInlinerWrapperPass. 
>>> Maybe as a future cleanup.
>>
>> There's that benefit to simplifying the module with the always inliner 
>> before doing inlining "in earnest" I was pointing earlier at: for the ML 
>> policies work, we plan on capturing (sub)graph information. Using the same 
>> SCC would not help because the "higher" (callers) parts of the graph would 
>> have these mandatory inlinings not completed yet, and thus offer a less 
>> accurate picture of the problem space.
>
> Oh I see, caller information is useful.
>
> For compile times: 
> http://llvm-compile-time-tracker.com/?config=O3=instructions=aeubanks.
> The previous version of this patch (perf/npmalways) running a couple passes 
> has some small but measurable overhead on some benchmarks, 0.5%.
> The version of running everything (perf/npmalways2) hugely increases compile 
> times, almost by 50% in one case.

Thanks for doing this! Really good to have this data.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-18 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D91567#2403236 , @aeubanks wrote:

> One thing that would be nice would be to have both inliners in the same CGSCC 
> pass manager to avoid doing SCC construction twice, but that would require 
> some shuffling of module/cgscc passes in ModuleInlinerWrapperPass. Maybe as a 
> future cleanup.

There's that benefit to simplifying the module with the always inliner before 
doing inlining "in earnest" I was pointing earlier at: for the ML policies 
work, we plan on capturing (sub)graph information. Using the same SCC would not 
help because the "higher" (callers) parts of the graph would have these 
mandatory inlinings not completed yet, and thus offer a less accurate picture 
of the problem space.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-18 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D91567#2403216 , @aeubanks wrote:

>>> I'll run this through llvm-compile-time-tracker to see what the compile 
>>> time implications are.
>>
>> You mean for the variant where we ran some of the function passes, or you'd 
>> try running all of them? Probably the latter would be quite interesting as a 
>> 'worst case'.
>
> I was trying the previous patch, but will also try running all function 
> passes, definitely would be interesting.

Awesome! Thanks!

If the rest of the (now NFC) patch seems reasonable, I'll go through those 
pesky pass manager tests to finish it up.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-18 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D91567#2403173 , @aeubanks wrote:

> In D91567#2400699 , @mtrofin wrote:
>
>> In D91567#2400207 , @aeubanks wrote:
>>
>>> What about removing the existing AlwaysInlinerPass and replacing it with 
>>> this one? Or is that something you were planning to do in a follow-up 
>>> change?
>>
>> That's the plan, yes.
>>
 open the opportunity to help the full inliner by performing additional 
 function passes after the mandatory inlinings, but before the full inliner
>>>
>>> This change doesn't run the function simplification pipeline between the 
>>> mandatory and full inliner though, only
>>>
>>>   if (AttributorRun & AttributorRunOption::CGSCC)
>>> MainCGPipeline.addPass(AttributorCGSCCPass());
>>>   
>>>   if (PTO.Coroutines)
>>> MainCGPipeline.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
>>>   
>>>   // Now deduce any function attributes based in the current code.
>>>   MainCGPipeline.addPass(PostOrderFunctionAttrsPass());
>>
>> Right - my point was that we could more easily explore doing so by having 
>> this new AlwaysInliner separate. In this patch I included those additional 
>> passes because I thought they may be necessary or beneficial, but I can 
>> remove them as a first step if they are not necessary. @jdoerfert - should 
>> the Attributor be run post-always inlining, or is it fine to not be run?
>
> I'd say start off without running any passes and keeping the status quo (i.e. 
> an NFC patch), then explore adding passes between the inliners in a future 
> patch.

Done

>>> And is there any evidence that running the function simplification pipeline 
>>> between the mandatory and full inliner is helpful? It could affect compile 
>>> times.
>>
>> In the ML-driven -Oz case, we saw some marginal improvement. I haven't in 
>> -O3 cases using the "non-ml" inliner. I suspect that it helps in the ML 
>> policy case (both -Oz and -O3, on which we're currently working), because: 
>> 1) the current -Oz takes some global (module-wide) features, so probably 
>> simplifying out the trivial cases helps; and 2) we plan on taking into 
>> consideration regions of the call graph, and the intuition is that 
>> eliminating the trivial cases (mandatory cases) would rise the visibility 
>> (for a training algorithm) of the non-trivial cases.
>>
>>> I'd think that adding the mandatory inliner right before the full inliner 
>>> in the same CGSCC pass manager would do the job. e.g. add it in 
>>> `ModuleInlinerWrapperPass::ModuleInlinerWrapperPass()` right before 
>>> `PM.addPass(InlinerPass());`
>>
>> It would, and what I'm proposing here is equivalent to that, but the 
>> proposal here helps with these other explorations, with (arguably) not much 
>> of a  difference cost-wise in itself (meaning, of course, if we discover 
>> there's benefit in running those additional passes, we pay with compile 
>> time, but in of itself, factoring the always inliner in its own wrapper, or 
>> in the same wrapper as the inliner, doesn't really come at much of a cost).
>>
>> Now, if we determine there is no value, we can bring it back easily - wdyt?
>
> I'll run this through llvm-compile-time-tracker to see what the compile time 
> implications are.

You mean for the variant where we ran some of the function passes, or you'd try 
running all of them? Probably the latter would be quite interesting as a 'worst 
case'.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-18 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 306141.
mtrofin added a comment.

Running just the always inliner variant, without other passes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

Files:
  clang/test/Frontend/optimization-remark-line-directive.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
  llvm/test/Transforms/Inline/ML/bounds-checks.ll
  llvm/test/Transforms/Inline/inline_stats.ll

Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -6,8 +6,11 @@
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
 
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
+
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
 
 ; CHECK: --- Dumping inliner stats for [] ---
 ; CHECK-BASIC-NOT: -- List of inlined functions:
Index: llvm/test/Transforms/Inline/ML/bounds-checks.ll
===
--- llvm/test/Transforms/Inline/ML/bounds-checks.ll
+++ llvm/test/Transforms/Inline/ML/bounds-checks.ll
@@ -4,7 +4,7 @@
 ; factor, we don't inline anymore.
 ; REQUIRES: have_tf_aot
 ; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
-; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -disable-always-inliner-in-module-wrapper -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
+; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-grtev4-linux-gnu"
Index: llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
===
--- llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
+++ llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
@@ -7,18 +7,18 @@
 ; REQUIRES: have_tf_api
 ;
 ; When the bounds are very wide ("no bounds"), all inlinings happen.
-; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner -training-log=- -enable-ml-inliner=development -ml-advisor-size-increase-threshold=10.0 -disable-always-inliner-in-module-wrapper -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
+; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner -training-log=- -enable-ml-inliner=development -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
 ;
 ; When the bounds are very restrictive, the first inlining happens but it's
 ; considered as "bad" (since it trips over the bounds) and its reward is a
 ; penalty. However, the mandatory inlining, which is considered next, happens.
 ; No other inlinings happend.
-; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model 

[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-17 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D91567#2401021 , @dblaikie wrote:

> In D91567#2398637 , @mtrofin wrote:
>
>> In D91567#2398623 , @dblaikie wrote:
>>
>>> In D91567#2398461 , @mtrofin wrote:
>>>
 In D91567#2398440 , @dblaikie 
 wrote:

>> Performing the mandatory inlinings first simplifies the problem the full 
>> inliner needs to solve
>
> That confuses me a bit - is that suggesting that we don't run the 
> AlwaysInliner when we are running the Inliner (ie: we only run the 
> AlwaysInliner at -O0, and use the Inliner at higher optimization levels 
> and let the Inliner do always inlining too)?
> & sounds like this is suggesting that would change? That we would now 
> perform always inlining separately from inlining? Maybe that's an 
> orthogonal/separate change from one implementing the always inlining 
> using the Inliner being run in a separate mode?

 In the NPM, we didn't run the AlwaysInliner until D86988 
 . See also the discussion there. The 
 normal inliner pass was, and still is, taking care of the mandatory 
 inlinings if it finds them. Of course, if we completely upfronted those 
 (which this patch can do), then the normal inliner wouldn't need to. I'm 
 not suggesting changing that - meaning, it's straightforward for the 
 normal inliner to take care of mandatory and policy-driven inlinings. The 
 idea, though, is that if we upfront the mandatory inlinings, the shape of 
 the call graph the inliner operates over is simpler and the effects of 
 inlining probably more easy to glean by the decision making policy. There 
 are trade-offs, though - we can increase that "ease of gleaning" by 
 performing more function simplification passes between the mandatory 
 inlinings and the full inliner.
>>>
>>> OK, so if I understand correctly with the old Pass Manager there were two 
>>> separate passes (always inliner and inliner - they share some code though, 
>>> yeah?)
>>
>> AlwaysInlinerLegacyPass does, yes. The NPM variant doesn't.
>
> The NPM always inliner doesn't share any code with the NPM non-always 
> inliner? (though this ( https://reviews.llvm.org/D86988 ) is the patch that 
> added a separate always inliner to the NPM, right? And that patch doesn't 
> look like it adds a whole new pass implementation - so looks like it's 
> sharing some code with something?)

There was already an AlwaysInliner for the NPM, just wasn't used. So D86966 
 hooked that up in the NPM, basically. The 
implementation of that AlwaysInliner is separate from the Inliner pass. See 
Transforms/IPO/AlwaysInliner.cpp lines 36 - 114, vs Inliner.cpp, from 687 
onwards.

>>> and they were run in the pass pipeline but potentially (definitely?) not 
>>> adjacent?
>>
>> From what I can see, the legacy one was used only in the O0/O1 
>>  cases, see 
>> clang/lib/CodeGen/BackendUtil,cpp:643. The full inliner isn't.
>
> The full inliner isn't.. isn't run at -O0/-O1? So with the Legacy Pass 
> Manager one inliner (always or non-always) was used in a given compilation, 
> not both? (so I guess then the non-always inliner did the always-inlining in 
> -O2 and above in the old pass manager? But didn't have the same recursive 
> always inlining miss that the NPM non-always inliner had?)

Yup, see BackendUtil.cpp:634. Can't comment on the latter problem.

>> New pass manager survived for quite a while with only one inlining pass, 
>> that included a mandatorily strong preference for inlining always-inline 
>> functions? But still missed some recursive cases. So D86988 
>>  made the always inliner run right next 
>> to/before the inliner in the NPM.
>>
>>> Now there's tihs patch, to implement the AlwaysInliner using the inliner - 
>>> but is also changing the order of passes to improve optimization 
>>> opportunities by doing some cleanup after always inlining?
>>
>> It doesn't quite change the order D86988  
>> introduced. Specifically, D86988  ran 
>> AlwaysInliner (a module pass) first, then let the Inliner and function 
>> optimizations happen.
>> This patch keeps the order between doing mandatory inlinings and inlinings. 
>> But, in addition, if in the future we want to also perform some of the 
>> function passes that happen in the inliner case, to help the full inliner, 
>> we can more easily do so.
>
> I'm still a bit confused/trying to understand better - am I understanding 
> correctly when I say: D86988  added always 
> inlining (for the NPM) as a separate process within the 

[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-17 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D91567#2400207 , @aeubanks wrote:

> What about removing the existing AlwaysInlinerPass and replacing it with this 
> one? Or is that something you were planning to do in a follow-up change?

That's the plan, yes.

>> open the opportunity to help the full inliner by performing additional 
>> function passes after the mandatory inlinings, but before the full inliner
>
> This change doesn't run the function simplification pipeline between the 
> mandatory and full inliner though, only
>
>   if (AttributorRun & AttributorRunOption::CGSCC)
> MainCGPipeline.addPass(AttributorCGSCCPass());
>   
>   if (PTO.Coroutines)
> MainCGPipeline.addPass(CoroSplitPass(Level != OptimizationLevel::O0));
>   
>   // Now deduce any function attributes based in the current code.
>   MainCGPipeline.addPass(PostOrderFunctionAttrsPass());

Right - my point was that we could more easily explore doing so by having this 
new AlwaysInliner separate. In this patch I included those additional passes 
because I thought they may be necessary or beneficial, but I can remove them as 
a first step if they are not necessary. @jdoerfert - should the Attributor be 
run post-always inlining, or is it fine to not be run?

> And is there any evidence that running the function simplification pipeline 
> between the mandatory and full inliner is helpful? It could affect compile 
> times.

In the ML-driven -Oz case, we saw some marginal improvement. I haven't in -O3 
cases using the "non-ml" inliner. I suspect that it helps in the ML policy case 
(both -Oz and -O3, on which we're currently working), because: 1) the current 
-Oz takes some global (module-wide) features, so probably simplifying out the 
trivial cases helps; and 2) we plan on taking into consideration regions of the 
call graph, and the intuition is that eliminating the trivial cases (mandatory 
cases) would rise the visibility (for a training algorithm) of the non-trivial 
cases.

> I'd think that adding the mandatory inliner right before the full inliner in 
> the same CGSCC pass manager would do the job. e.g. add it in 
> `ModuleInlinerWrapperPass::ModuleInlinerWrapperPass()` right before 
> `PM.addPass(InlinerPass());`

It would, and what I'm proposing here is equivalent to that, but the proposal 
here helps with these other explorations, with (arguably) not much of a  
difference cost-wise in itself (meaning, of course, if we discover there's 
benefit in running those additional passes, we pay with compile time, but in of 
itself, factoring the always inliner in its own wrapper, or in the same wrapper 
as the inliner, doesn't really come at much of a cost).

Now, if we determine there is no value, we can bring it back easily - wdyt?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-16 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D91567#2398623 , @dblaikie wrote:

> In D91567#2398461 , @mtrofin wrote:
>
>> In D91567#2398440 , @dblaikie wrote:
>>
 Performing the mandatory inlinings first simplifies the problem the full 
 inliner needs to solve
>>>
>>> That confuses me a bit - is that suggesting that we don't run the 
>>> AlwaysInliner when we are running the Inliner (ie: we only run the 
>>> AlwaysInliner at -O0, and use the Inliner at higher optimization levels and 
>>> let the Inliner do always inlining too)?
>>> & sounds like this is suggesting that would change? That we would now 
>>> perform always inlining separately from inlining? Maybe that's an 
>>> orthogonal/separate change from one implementing the always inlining using 
>>> the Inliner being run in a separate mode?
>>
>> In the NPM, we didn't run the AlwaysInliner until D86988 
>> . See also the discussion there. The normal 
>> inliner pass was, and still is, taking care of the mandatory inlinings if it 
>> finds them. Of course, if we completely upfronted those (which this patch 
>> can do), then the normal inliner wouldn't need to. I'm not suggesting 
>> changing that - meaning, it's straightforward for the normal inliner to take 
>> care of mandatory and policy-driven inlinings. The idea, though, is that if 
>> we upfront the mandatory inlinings, the shape of the call graph the inliner 
>> operates over is simpler and the effects of inlining probably more easy to 
>> glean by the decision making policy. There are trade-offs, though - we can 
>> increase that "ease of gleaning" by performing more function simplification 
>> passes between the mandatory inlinings and the full inliner.
>
> OK, so if I understand correctly with the old Pass Manager there were two 
> separate passes (always inliner and inliner - they share some code though, 
> yeah?)

AlwaysInlinerLegacyPass does, yes. The NPM variant doesn't.

> and they were run in the pass pipeline but potentially (definitely?) not 
> adjacent?

From what I can see, the legacy one was used only in the O0/O1 
 cases, see 
clang/lib/CodeGen/BackendUtil,cpp:643. The full inliner isn't.

New pass manager survived for quite a while with only one inlining pass, that 
included a mandatorily strong preference for inlining always-inline functions? 
But still missed some recursive cases. So D86988 
 made the always inliner run right next 
to/before the inliner in the NPM.

> Now there's tihs patch, to implement the AlwaysInliner using the inliner - 
> but is also changing the order of passes to improve optimization 
> opportunities by doing some cleanup after always inlining?

It doesn't quite change the order D86988  
introduced. Specifically, D86988  ran 
AlwaysInliner (a module pass) first, then let the Inliner and function 
optimizations happen.
This patch keeps the order between doing mandatory inlinings and inlinings. 
But, in addition, if in the future we want to also perform some of the function 
passes that happen in the inliner case, to help the full inliner, we can more 
easily do so.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-16 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D91567#2398440 , @dblaikie wrote:

>> Performing the mandatory inlinings first simplifies the problem the full 
>> inliner needs to solve
>
> That confuses me a bit - is that suggesting that we don't run the 
> AlwaysInliner when we are running the Inliner (ie: we only run the 
> AlwaysInliner at -O0, and use the Inliner at higher optimization levels and 
> let the Inliner do always inlining too)?
> & sounds like this is suggesting that would change? That we would now perform 
> always inlining separately from inlining? Maybe that's an orthogonal/separate 
> change from one implementing the always inlining using the Inliner being run 
> in a separate mode?

In the NPM, we didn't run the AlwaysInliner until D86988 
. See also the discussion there. The normal 
inliner pass was, and still is, taking care of the mandatory inlinings if it 
finds them. Of course, if we completely upfronted those (which this patch can 
do), then the normal inliner wouldn't need to. I'm not suggesting changing that 
- meaning, it's straightforward for the normal inliner to take care of 
mandatory and policy-driven inlinings. The idea, though, is that if we upfront 
the mandatory inlinings, the shape of the call graph the inliner operates over 
is simpler and the effects of inlining probably more easy to glean by the 
decision making policy. There are trade-offs, though - we can increase that 
"ease of gleaning" by performing more function simplification passes between 
the mandatory inlinings and the full inliner.

In D91567#2398440 , @dblaikie wrote:

>> Performing the mandatory inlinings first simplifies the problem the full 
>> inliner needs to solve
>
> That confuses me a bit - is that suggesting that we don't run the 
> AlwaysInliner when we are running the Inliner (ie: we only run the 
> AlwaysInliner at -O0, and use the Inliner at higher optimization levels and 
> let the Inliner do always inlining too)?
> & sounds like this is suggesting that would change? That we would now perform 
> always inlining separately from inlining? Maybe that's an orthogonal/separate 
> change from one implementing the always inlining using the Inliner being run 
> in a separate mode?




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-16 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

Please note: the patch isn't 100% ready, there are those tests that check how 
the pipeline is composed, which are unpleasant to fix, so I want to defer them 
to after we get agreement over the larger points this patch brings (i.e. 
pre-performing always inlinings, value in further exploring cleanups before 
full inlining, etc)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91567/new/

https://reviews.llvm.org/D91567

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91567: [llvm][inliner] Reuse the inliner pass to implement 'always inliner'

2020-11-16 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin added reviewers: aeubanks, jdoerfert, davidxl, eraman.
Herald added subscribers: llvm-commits, cfe-commits, hiraditya.
Herald added projects: clang, LLVM.
mtrofin requested review of this revision.

Enable performing mandatory inlinings upfront, by reusing the same logic
as the full inliner, instead of the AlwaysInliner. This has the
following benefits:

- reduce code duplication - one inliner codebase
- open the opportunity to help the full inliner by performing additional

function passes after the mandatory inlinings, but before th full
inliner. Performing the mandatory inlinings first simplifies the problem
the full inliner needs to solve: less call sites, more contextualization, and,
depending on the additional function optimization passes run between the
2 inliners, higher accuracy of cost models / decision policies.

Note that this patch does not yet enable much in terms of post-always
inline function optimization.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91567

Files:
  clang/test/Frontend/optimization-remark-line-directive.c
  llvm/include/llvm/Analysis/InlineAdvisor.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/lib/Analysis/InlineAdvisor.cpp
  llvm/lib/Analysis/MLInlineAdvisor.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/Inliner.cpp
  llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
  llvm/test/Transforms/Inline/ML/bounds-checks.ll
  llvm/test/Transforms/Inline/inline_stats.ll

Index: llvm/test/Transforms/Inline/inline_stats.ll
===
--- llvm/test/Transforms/Inline/inline_stats.ll
+++ llvm/test/Transforms/Inline/inline_stats.ll
@@ -6,8 +6,11 @@
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
 ; RUN: opt -S -passes=inline -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
 
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
-; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=CHECK-BASIC -check-prefix=CHECK
+; RUN: opt -S -passes=inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix="CHECK-VERBOSE" -check-prefix=CHECK
+
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=basic < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-BASIC -check-prefix=WRAPPER
+; RUN: opt -S -passes=always-inliner-wrapper,inliner-wrapper -inliner-function-import-stats=verbose < %s 2>&1 | FileCheck %s -check-prefix=WRAPPER-VERBOSE -check-prefix=WRAPPER
 
 ; CHECK: --- Dumping inliner stats for [] ---
 ; CHECK-BASIC-NOT: -- List of inlined functions:
Index: llvm/test/Transforms/Inline/ML/bounds-checks.ll
===
--- llvm/test/Transforms/Inline/ML/bounds-checks.ll
+++ llvm/test/Transforms/Inline/ML/bounds-checks.ll
@@ -4,7 +4,7 @@
 ; factor, we don't inline anymore.
 ; REQUIRES: have_tf_aot
 ; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=10.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
-; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -disable-always-inliner-in-module-wrapper -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
+; RUN: opt -passes=scc-oz-module-inliner -enable-ml-inliner=release -ml-advisor-size-increase-threshold=1.0 -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=BOUNDS
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-grtev4-linux-gnu"
Index: llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
===
--- llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
+++ llvm/test/Transforms/Inline/ML/bounds-checks-rewards.ll
@@ -7,18 +7,18 @@
 ; REQUIRES: have_tf_api
 ;
 ; When the bounds are very wide ("no bounds"), all inlinings happen.
-; RUN: opt -passes=scc-oz-module-inliner -ml-inliner-ir2native-model=%S/../../../../unittests/Analysis/Inputs/ir2native_x86_64_model -ml-inliner-model-under-training=%S/../../../../lib/Analysis/models/inliner -training-log=- -enable-ml-inliner=development -ml-advisor-size-increase-threshold=10.0 -disable-always-inliner-in-module-wrapper -S < %s 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=NOBOUNDS
+; RUN: opt -passes=scc-oz-module-inliner 

[PATCH] D91229: [FileCheck] Flip -allow-unused-prefixes to false by default

2020-11-11 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D91229#2389141 , @dblaikie wrote:

>> because FileCheck won't accept more than one occurrence of 
>> --allow-unused-prefixes
>
> Perhaps this is a fixable issue?

I think I was able to circumvent it in D91275 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91229/new/

https://reviews.llvm.org/D91229

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91229: [FileCheck] Flip -allow-unused-prefixes to false by default

2020-11-11 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D91229#2387923 , @jhenderson wrote:

> Maybe one way to do this is to do what @RKSimon suggests in the D90281 
> , and to enable it on a per-directory basis 
> using lit.local.cfg. That would potentially require changing the "0 or 1" 
> occurrences limitation of the option, in favour of "last one wins" (or first 
> one). Then, you make the change in the lit.local.cfg, flipping the default in 
> each directory as you go. Eventually, once all tests that need it are 
> covered, you can just change the default in FileCheck itself. How does that 
> sound?

I haven't tried that yet. @RKSimon's case was that the folder was fixed, and 
we'd want to stop the bleeding there. Now, thinking more about it: because 
FileCheck won't accept more than one occurrence of --allow-unused-prefixes, if 
a directory has cases where we want to allow duplicates, we'd probably want 
lit.local.cfg to do 2 things:

- set --allow-unused-prefixes to false, to stop the bleeding - this would be 
removed when we switch defaults
- define a %UnusedPrefixesFileCheck (or better name) which is FileCheck with 
the flag set to true, which we'd then use where needed instead of FileCheck. 
This could stay like this even after we switch defaults.

I'm not very versed with lit.local.cfg - does the above capture what you 
imagined? (@RKSimon too)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91229/new/

https://reviews.llvm.org/D91229

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D91229: [FileCheck] Flip -allow-unused-prefixes to false by default

2020-11-11 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin added a reviewer: jhenderson.
Herald added subscribers: llvm-commits, cfe-commits, frasercrmck, nikic, okura, 
jdoerfert, kuter, kerbowa, luismarques, apazos, sameer.abuasal, pzheng, 
pengfei, s.egerton, lenary, dmgreen, Jim, asbirlea, thopre, mstorsjo, jocewei, 
PkmX, jfb, arphaman, the_o, brucehoult, MartinMosbeck, rogfer01, steven_wu, 
atanasyan, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, 
johnrusso, rbar, asb, fedor.sergeev, kbarton, hiraditya, nhaehnle, jvesely, 
nemanjai, sdardis, jyknight, dschuff, qcolombet, jholewinski.
Herald added projects: clang, LLVM.
mtrofin requested review of this revision.
Herald added subscribers: bbn, sstefan1, MaskRay.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.

Automatically inserted --allow-unused-prefixes=true for tests that are
still failing.

Added a FIXME above each line where this was inserted.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91229

Files:
  clang/test/Analysis/auto-obj-dtors-cfg-output.cpp
  clang/test/Analysis/cfg-rich-constructors.cpp
  clang/test/Analysis/cfg-rich-constructors.mm
  clang/test/Analysis/cfg.c
  clang/test/Analysis/exploded-graph-rewriter/trimmers.dot
  clang/test/CodeGen/arm-varargs.c
  clang/test/CodeGen/asan-static-odr.cpp
  
clang/test/CodeGen/catch-alignment-assumption-attribute-align_value-on-lvalue.cpp
  
clang/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function-variable.cpp
  
clang/test/CodeGen/catch-alignment-assumption-attribute-assume_aligned-on-function-two-params.cpp
  
clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params-variable.cpp
  
clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params.cpp
  
clang/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-two-params.cpp
  clang/test/CodeGen/catch-alignment-assumption-openmp.cpp
  clang/test/CodeGen/catch-implicit-integer-sign-changes-incdec.c
  clang/test/CodeGen/catch-implicit-integer-sign-changes-true-negatives.c
  clang/test/CodeGen/catch-implicit-signed-integer-truncations-incdec.c
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset-blacklist.c
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset-when-nullptr-is-defined.c
  clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c
  clang/test/CodeGen/catch-pointer-overflow-volatile.c
  clang/test/CodeGen/catch-pointer-overflow.c
  clang/test/CodeGen/cmse-clear-return.c
  clang/test/CodeGen/ms-barriers-intrinsics.c
  clang/test/CodeGen/ms-mixed-ptr-sizes.c
  clang/test/CodeGen/neon-immediate-ubsan.c
  clang/test/CodeGen/ppc-smmintrin.c
  clang/test/CodeGenCUDA/device-stub.cu
  clang/test/CodeGenCXX/aix-static-init-debug-info.cpp
  clang/test/CodeGenCXX/attr-cpuspecific.cpp
  clang/test/CodeGenCXX/bitfield-layout.cpp
  clang/test/CodeGenCXX/catch-implicit-integer-sign-changes-true-negatives.cpp
  clang/test/CodeGenCXX/catch-implicit-integer-truncations.cpp
  clang/test/CodeGenCXX/conditional-temporaries.cpp
  clang/test/CodeGenCXX/dllexport.cpp
  clang/test/CodeGenCXX/dllimport.cpp
  clang/test/CodeGenCXX/exceptions-seh-filter-captures.cpp
  clang/test/CodeGenCXX/inheriting-constructor.cpp
  clang/test/CodeGenCXX/lifetime-sanitizer.cpp
  clang/test/CodeGenCXX/mangle-ms-cxx17.cpp
  clang/test/CodeGenCXX/member-function-pointer-calls.cpp
  clang/test/CodeGenCXX/runtime-dllstorage.cpp
  clang/test/CodeGenCXX/ubsan-vtable-checks.cpp
  clang/test/CodeGenObjC/arc-captured-block-var-inlined-layout.m
  clang/test/CodeGenObjC/mrr-captured-block-var-inlined-layout.m
  clang/test/CodeGenOpenCL/convergent.cl
  clang/test/Driver/amdgpu-macros.cl
  clang/test/Driver/cuda-detect.cu
  clang/test/Driver/fsanitize.c
  clang/test/Driver/hip-toolchain-device-only.hip
  clang/test/Driver/ps4-visibility-dllstorageclass.c
  clang/test/Driver/rocm-device-libs.cl
  clang/test/Modules/codegen.test
  clang/test/Modules/preprocess-nested.cpp
  clang/test/OpenMP/declare_mapper_codegen.cpp
  clang/test/OpenMP/declare_reduction_codegen.cpp
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_reduction_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
  clang/test/OpenMP/irbuilder_nested_openmp_parallel_empty.c
  clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
  

[PATCH] D91229: [FileCheck] Flip -allow-unused-prefixes to false by default

2020-11-11 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

FYI - I realize the change is enormous. I don't necessarily mean to land it 
as-is, we can chunk it by directories and iteratively update this as those land.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91229/new/

https://reviews.llvm.org/D91229

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D90430: [clang][NFC] Remove unused FileCheck prefix

2020-10-30 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin accepted this revision.
mtrofin added a comment.

In D90430#2365397 , 
@google-llvm-upstream-contributions wrote:

> lgtm

ugh, sorry, that's an alias I am auto-logged in on my personal account.

Still LGTM :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90430/new/

https://reviews.llvm.org/D90430

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D90366: [ThinLTO] Fix empty .llvmcmd sections

2020-10-29 Thread Mircea Trofin via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG13aee94bc710: [ThinLTO] Fix empty .llvmcmd sections 
(authored by mtrofin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90366/new/

https://reviews.llvm.org/D90366

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/thinlto_embed_bitcode.ll


Index: clang/test/CodeGen/thinlto_embed_bitcode.ll
===
--- clang/test/CodeGen/thinlto_embed_bitcode.ll
+++ clang/test/CodeGen/thinlto_embed_bitcode.ll
@@ -17,12 +17,20 @@
 ; round-trip through compilation and ensure the objects are the same.
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c 
-fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt
 ; RUN: llvm-readelf -S %t.o | FileCheck %s 
--check-prefixes=CHECK-ELF,CHECK-ELF-CMD
+; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null
+; RUN: grep x86_64-unknown-linux-gnu %t-embedded.cmd | count 1
 ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
 ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-NOOPT
 ; We should only need the index and the post-thinlto merged module to generate 
 ; the exact same .o as we originally did.
 ; RUN: rm %t1.bc %t2.bc
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t-redo.o -x ir 
%t-embedded.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm 
-lto-embed-bitcode=post-merge-pre-opt -mllvm -thinlto-assume-merged
+;
+; The resulting .o is almost the same, but the .llvmcmd section would be
+; different because of the extra -thinlto-assume-merged.
+; A simple, meaningful comparison is to just compare the stripped objects.
+; RUN: llvm-strip --strip-all %t-redo.o 
+; RUN: llvm-strip --strip-all %t.o 
 ; RUN: diff %t-redo.o %t.o
 
 ; CHECK-ELF:  .text   PROGBITS  [[#%x,OFF:]] [[#%x,SIZE:]] 
00 AX 0
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1095,23 +1095,21 @@
   // FIXME: For backend options that are not yet recorded as function
   // attributes in the IR, keep track of them so we can embed them in a
   // separate data section and use them when building the bitcode.
-  if (Opts.getEmbedBitcode() == CodeGenOptions::Embed_All) {
-for (const auto  : Args) {
-  // Do not encode output and input.
-  if (A->getOption().getID() == options::OPT_o ||
-  A->getOption().getID() == options::OPT_INPUT ||
-  A->getOption().getID() == options::OPT_x ||
-  A->getOption().getID() == options::OPT_fembed_bitcode ||
-  A->getOption().matches(options::OPT_W_Group))
-continue;
-  ArgStringList ASL;
-  A->render(Args, ASL);
-  for (const auto  : ASL) {
-StringRef ArgStr(arg);
-Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end());
-// using \00 to separate each commandline options.
-Opts.CmdArgs.push_back('\0');
-  }
+  for (const auto  : Args) {
+// Do not encode output and input.
+if (A->getOption().getID() == options::OPT_o ||
+A->getOption().getID() == options::OPT_INPUT ||
+A->getOption().getID() == options::OPT_x ||
+A->getOption().getID() == options::OPT_fembed_bitcode ||
+A->getOption().matches(options::OPT_W_Group))
+  continue;
+ArgStringList ASL;
+A->render(Args, ASL);
+for (const auto  : ASL) {
+  StringRef ArgStr(arg);
+  Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end());
+  // using \00 to separate each commandline options.
+  Opts.CmdArgs.push_back('\0');
 }
   }
 


Index: clang/test/CodeGen/thinlto_embed_bitcode.ll
===
--- clang/test/CodeGen/thinlto_embed_bitcode.ll
+++ clang/test/CodeGen/thinlto_embed_bitcode.ll
@@ -17,12 +17,20 @@
 ; round-trip through compilation and ensure the objects are the same.
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt
 ; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-ELF-CMD
+; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null
+; RUN: grep x86_64-unknown-linux-gnu %t-embedded.cmd | count 1
 ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
 ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOOPT
 ; We should only need the index and the post-thinlto merged module to generate 
 ; the exact same .o as we originally did.
 ; RUN: rm %t1.bc %t2.bc
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o 

[PATCH] D90366: [ThinLTO] Fix empty .llvmcmd sections

2020-10-29 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 301650.
mtrofin marked an inline comment as done.
mtrofin added a comment.

updated description


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90366/new/

https://reviews.llvm.org/D90366

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/thinlto_embed_bitcode.ll


Index: clang/test/CodeGen/thinlto_embed_bitcode.ll
===
--- clang/test/CodeGen/thinlto_embed_bitcode.ll
+++ clang/test/CodeGen/thinlto_embed_bitcode.ll
@@ -17,12 +17,20 @@
 ; round-trip through compilation and ensure the objects are the same.
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c 
-fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt
 ; RUN: llvm-readelf -S %t.o | FileCheck %s 
--check-prefixes=CHECK-ELF,CHECK-ELF-CMD
+; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null
+; RUN: grep x86_64-unknown-linux-gnu %t-embedded.cmd | count 1
 ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
 ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-NOOPT
 ; We should only need the index and the post-thinlto merged module to generate 
 ; the exact same .o as we originally did.
 ; RUN: rm %t1.bc %t2.bc
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t-redo.o -x ir 
%t-embedded.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm 
-lto-embed-bitcode=post-merge-pre-opt -mllvm -thinlto-assume-merged
+;
+; The resulting .o is almost the same, but the .llvmcmd section would be
+; different because of the extra -thinlto-assume-merged.
+; A simple, meaningful comparison is to just compare the stripped objects.
+; RUN: llvm-strip --strip-all %t-redo.o 
+; RUN: llvm-strip --strip-all %t.o 
 ; RUN: diff %t-redo.o %t.o
 
 ; CHECK-ELF:  .text   PROGBITS  [[#%x,OFF:]] [[#%x,SIZE:]] 
00 AX 0
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1095,23 +1095,21 @@
   // FIXME: For backend options that are not yet recorded as function
   // attributes in the IR, keep track of them so we can embed them in a
   // separate data section and use them when building the bitcode.
-  if (Opts.getEmbedBitcode() == CodeGenOptions::Embed_All) {
-for (const auto  : Args) {
-  // Do not encode output and input.
-  if (A->getOption().getID() == options::OPT_o ||
-  A->getOption().getID() == options::OPT_INPUT ||
-  A->getOption().getID() == options::OPT_x ||
-  A->getOption().getID() == options::OPT_fembed_bitcode ||
-  A->getOption().matches(options::OPT_W_Group))
-continue;
-  ArgStringList ASL;
-  A->render(Args, ASL);
-  for (const auto  : ASL) {
-StringRef ArgStr(arg);
-Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end());
-// using \00 to separate each commandline options.
-Opts.CmdArgs.push_back('\0');
-  }
+  for (const auto  : Args) {
+// Do not encode output and input.
+if (A->getOption().getID() == options::OPT_o ||
+A->getOption().getID() == options::OPT_INPUT ||
+A->getOption().getID() == options::OPT_x ||
+A->getOption().getID() == options::OPT_fembed_bitcode ||
+A->getOption().matches(options::OPT_W_Group))
+  continue;
+ArgStringList ASL;
+A->render(Args, ASL);
+for (const auto  : ASL) {
+  StringRef ArgStr(arg);
+  Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end());
+  // using \00 to separate each commandline options.
+  Opts.CmdArgs.push_back('\0');
 }
   }
 


Index: clang/test/CodeGen/thinlto_embed_bitcode.ll
===
--- clang/test/CodeGen/thinlto_embed_bitcode.ll
+++ clang/test/CodeGen/thinlto_embed_bitcode.ll
@@ -17,12 +17,20 @@
 ; round-trip through compilation and ensure the objects are the same.
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt
 ; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-ELF-CMD
+; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null
+; RUN: grep x86_64-unknown-linux-gnu %t-embedded.cmd | count 1
 ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
 ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOOPT
 ; We should only need the index and the post-thinlto merged module to generate 
 ; the exact same .o as we originally did.
 ; RUN: rm %t1.bc %t2.bc
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t-redo.o -x ir %t-embedded.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm 

[PATCH] D90366: [ThinLTO] Strenghten the test for .llvmcmd embedding

2020-10-29 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin updated this revision to Diff 301641.
mtrofin added a comment.

fixed sentence


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90366/new/

https://reviews.llvm.org/D90366

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/thinlto_embed_bitcode.ll


Index: clang/test/CodeGen/thinlto_embed_bitcode.ll
===
--- clang/test/CodeGen/thinlto_embed_bitcode.ll
+++ clang/test/CodeGen/thinlto_embed_bitcode.ll
@@ -17,12 +17,20 @@
 ; round-trip through compilation and ensure the objects are the same.
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c 
-fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt
 ; RUN: llvm-readelf -S %t.o | FileCheck %s 
--check-prefixes=CHECK-ELF,CHECK-ELF-CMD
+; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null
+; RUN: grep x86_64-unknown-linux-gnu %t-embedded.cmd | count 1
 ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
 ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-NOOPT
 ; We should only need the index and the post-thinlto merged module to generate 
 ; the exact same .o as we originally did.
 ; RUN: rm %t1.bc %t2.bc
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t-redo.o -x ir 
%t-embedded.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm 
-lto-embed-bitcode=post-merge-pre-opt -mllvm -thinlto-assume-merged
+;
+; The resulting .o is almost the same, but the .llvmcmd section would be
+; different because of the extra -thinlto-assume-merged.
+; A simple, meaningful comparison is to just compare the stripped objects.
+; RUN: llvm-strip --strip-all %t-redo.o 
+; RUN: llvm-strip --strip-all %t.o 
 ; RUN: diff %t-redo.o %t.o
 
 ; CHECK-ELF:  .text   PROGBITS  [[#%x,OFF:]] [[#%x,SIZE:]] 
00 AX 0
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1095,23 +1095,21 @@
   // FIXME: For backend options that are not yet recorded as function
   // attributes in the IR, keep track of them so we can embed them in a
   // separate data section and use them when building the bitcode.
-  if (Opts.getEmbedBitcode() == CodeGenOptions::Embed_All) {
-for (const auto  : Args) {
-  // Do not encode output and input.
-  if (A->getOption().getID() == options::OPT_o ||
-  A->getOption().getID() == options::OPT_INPUT ||
-  A->getOption().getID() == options::OPT_x ||
-  A->getOption().getID() == options::OPT_fembed_bitcode ||
-  A->getOption().matches(options::OPT_W_Group))
-continue;
-  ArgStringList ASL;
-  A->render(Args, ASL);
-  for (const auto  : ASL) {
-StringRef ArgStr(arg);
-Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end());
-// using \00 to separate each commandline options.
-Opts.CmdArgs.push_back('\0');
-  }
+  for (const auto  : Args) {
+// Do not encode output and input.
+if (A->getOption().getID() == options::OPT_o ||
+A->getOption().getID() == options::OPT_INPUT ||
+A->getOption().getID() == options::OPT_x ||
+A->getOption().getID() == options::OPT_fembed_bitcode ||
+A->getOption().matches(options::OPT_W_Group))
+  continue;
+ArgStringList ASL;
+A->render(Args, ASL);
+for (const auto  : ASL) {
+  StringRef ArgStr(arg);
+  Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end());
+  // using \00 to separate each commandline options.
+  Opts.CmdArgs.push_back('\0');
 }
   }
 


Index: clang/test/CodeGen/thinlto_embed_bitcode.ll
===
--- clang/test/CodeGen/thinlto_embed_bitcode.ll
+++ clang/test/CodeGen/thinlto_embed_bitcode.ll
@@ -17,12 +17,20 @@
 ; round-trip through compilation and ensure the objects are the same.
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt
 ; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-ELF-CMD
+; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null
+; RUN: grep x86_64-unknown-linux-gnu %t-embedded.cmd | count 1
 ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
 ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOOPT
 ; We should only need the index and the post-thinlto merged module to generate 
 ; the exact same .o as we originally did.
 ; RUN: rm %t1.bc %t2.bc
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t-redo.o -x ir %t-embedded.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt -mllvm -thinlto-assume-merged
+;

[PATCH] D90366: [ThinLTO] Strenghten the test for .llvmcmd embedding

2020-10-29 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin added a comment.

In D90366#2362052 , @tejohnson wrote:

> The motivation and effects of the change are unclear to me. Does this mean 
> that the .llvmcmd section is always emitted? Or always emitted whenever any 
> bitcode embedding is requested?

This just means the arguments are captured in memory. Nothing else changes. The 
only penalty is that a char vector (the captured args) are carried around even 
if .llvmcmd wasn't generated.

We could maybe add a test that no explicit optin to emitting .llvmcmd => no 
section (briefly looked, doesn't seem to exist for either non- or thinlto)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90366/new/

https://reviews.llvm.org/D90366

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D90366: [ThinLTO] Strenghten the test for .llvmcmd embedding

2020-10-28 Thread Mircea Trofin via Phabricator via cfe-commits
mtrofin created this revision.
mtrofin added a reviewer: tejohnson.
Herald added subscribers: cfe-commits, steven_wu, hiraditya, inglorion.
Herald added a reviewer: alexshap.
Herald added a project: clang.
mtrofin requested review of this revision.

Always populate the CodeGenOptions::CmdArgs - the overhead is likely
negligible in the grand schema of things, and it keeps the using code
simple.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90366

Files:
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/thinlto_embed_bitcode.ll


Index: clang/test/CodeGen/thinlto_embed_bitcode.ll
===
--- clang/test/CodeGen/thinlto_embed_bitcode.ll
+++ clang/test/CodeGen/thinlto_embed_bitcode.ll
@@ -17,12 +17,17 @@
 ; round-trip through compilation and ensure the objects are the same.
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c 
-fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt
 ; RUN: llvm-readelf -S %t.o | FileCheck %s 
--check-prefixes=CHECK-ELF,CHECK-ELF-CMD
+; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null
+; RUN: grep x86_64-unknown-linux-gnu %t-embedded.cmd | count 1
 ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
 ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-NOOPT
 ; We should only need the index and the post-thinlto merged module to generate 
 ; the exact same .o as we originally did.
 ; RUN: rm %t1.bc %t2.bc
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t-redo.o -x ir 
%t-embedded.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm 
-lto-embed-bitcode=post-merge-pre-opt -mllvm -thinlto-assume-merged
+; The resulting .o is almost the 
+; RUN: llvm-strip --strip-all %t-redo.o 
+; RUN: llvm-strip --strip-all %t.o 
 ; RUN: diff %t-redo.o %t.o
 
 ; CHECK-ELF:  .text   PROGBITS  [[#%x,OFF:]] [[#%x,SIZE:]] 
00 AX 0
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1095,23 +1095,21 @@
   // FIXME: For backend options that are not yet recorded as function
   // attributes in the IR, keep track of them so we can embed them in a
   // separate data section and use them when building the bitcode.
-  if (Opts.getEmbedBitcode() == CodeGenOptions::Embed_All) {
-for (const auto  : Args) {
-  // Do not encode output and input.
-  if (A->getOption().getID() == options::OPT_o ||
-  A->getOption().getID() == options::OPT_INPUT ||
-  A->getOption().getID() == options::OPT_x ||
-  A->getOption().getID() == options::OPT_fembed_bitcode ||
-  A->getOption().matches(options::OPT_W_Group))
-continue;
-  ArgStringList ASL;
-  A->render(Args, ASL);
-  for (const auto  : ASL) {
-StringRef ArgStr(arg);
-Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end());
-// using \00 to separate each commandline options.
-Opts.CmdArgs.push_back('\0');
-  }
+  for (const auto  : Args) {
+// Do not encode output and input.
+if (A->getOption().getID() == options::OPT_o ||
+A->getOption().getID() == options::OPT_INPUT ||
+A->getOption().getID() == options::OPT_x ||
+A->getOption().getID() == options::OPT_fembed_bitcode ||
+A->getOption().matches(options::OPT_W_Group))
+  continue;
+ArgStringList ASL;
+A->render(Args, ASL);
+for (const auto  : ASL) {
+  StringRef ArgStr(arg);
+  Opts.CmdArgs.insert(Opts.CmdArgs.end(), ArgStr.begin(), ArgStr.end());
+  // using \00 to separate each commandline options.
+  Opts.CmdArgs.push_back('\0');
 }
   }
 


Index: clang/test/CodeGen/thinlto_embed_bitcode.ll
===
--- clang/test/CodeGen/thinlto_embed_bitcode.ll
+++ clang/test/CodeGen/thinlto_embed_bitcode.ll
@@ -17,12 +17,17 @@
 ; round-trip through compilation and ensure the objects are the same.
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t.o -x ir %t1.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm -lto-embed-bitcode=post-merge-pre-opt
 ; RUN: llvm-readelf -S %t.o | FileCheck %s --check-prefixes=CHECK-ELF,CHECK-ELF-CMD
+; RUN: llvm-objcopy --dump-section=.llvmcmd=%t-embedded.cmd %t.o /dev/null
+; RUN: grep x86_64-unknown-linux-gnu %t-embedded.cmd | count 1
 ; RUN: llvm-objcopy --dump-section=.llvmbc=%t-embedded.bc %t.o /dev/null
 ; RUN: llvm-dis %t-embedded.bc -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOOPT
 ; We should only need the index and the post-thinlto merged module to generate 
 ; the exact same .o as we originally did.
 ; RUN: rm %t1.bc %t2.bc
 ; RUN: %clang -target x86_64-unknown-linux-gnu -O2 -o %t-redo.o -x ir %t-embedded.bc -c -fthinlto-index=%t.o.thinlto.bc -mllvm 

  1   2   >