From de11de308b6480fc35d901c7104f46918674418c Mon Sep 17 00:00:00 2001 From: Ellis Hoag Date: Fri, 19 Nov 2021 15:44:48 -0800 Subject: [PATCH] [InstrProf] Use i32 for GEP index from lowering llvm.instrprof.increment The `llvm.instrprof.increment` intrinsic uses `i32` for the index. We should use this same type for the index into the GEP instructions. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D114268 --- clang/test/CodeGen/profile-filter.c | 20 +- clang/test/Profile/branch-logical-mixed.cpp | 68 +++--- clang/test/Profile/c-captured.c | 32 +-- clang/test/Profile/c-general.c | 238 ++++++++++----------- clang/test/Profile/c-ternary.c | 10 +- clang/test/Profile/cxx-class.cpp | 24 +-- clang/test/Profile/cxx-lambda.cpp | 17 +- clang/test/Profile/cxx-rangefor.cpp | 10 +- clang/test/Profile/cxx-stmt-initializers.cpp | 12 +- clang/test/Profile/cxx-templates.cpp | 8 +- clang/test/Profile/cxx-throws.cpp | 24 +-- clang/test/Profile/objc-general.m | 18 +- .../Transforms/Instrumentation/InstrProfiling.cpp | 2 +- .../InstrProfiling/atomic-updates.ll | 2 +- .../InstrProfiling/runtime-counter-relocation.ll | 4 +- .../PGOProfile/counter_promo_exit_catchswitch.ll | 16 +- llvm/test/Transforms/PGOProfile/instr_entry_bb.ll | 6 +- 17 files changed, 257 insertions(+), 254 deletions(-) diff --git a/clang/test/CodeGen/profile-filter.c b/clang/test/CodeGen/profile-filter.c index d390970..5d71657 100644 --- a/clang/test/CodeGen/profile-filter.c +++ b/clang/test/CodeGen/profile-filter.c @@ -37,11 +37,11 @@ unsigned i; // EXCLUDE: noprofile // EXCLUDE: @test1 unsigned test1() { - // CHECK: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) - // FUNC: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) - // FILE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) - // SECTION-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) - // EXCLUDE-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) + // CHECK: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i32 0, i32 0) + // FUNC: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i32 0, i32 0) + // FILE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i32 0, i32 0) + // SECTION-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i32 0, i32 0) + // EXCLUDE-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i32 0, i32 0) return i + 1; } @@ -56,10 +56,10 @@ unsigned test1() { // EXCLUDE-NOT: noprofile // EXCLUDE: @test2 unsigned test2() { - // CHECK: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) - // FUNC-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) - // FILE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) - // SECTION: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) - // EXCLUDE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) + // CHECK: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i32 0, i32 0) + // FUNC-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i32 0, i32 0) + // FILE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i32 0, i32 0) + // SECTION: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i32 0, i32 0) + // EXCLUDE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i32 0, i32 0) return i - 1; } diff --git a/clang/test/Profile/branch-logical-mixed.cpp b/clang/test/Profile/branch-logical-mixed.cpp index 04b51d8..cdcee76 100644 --- a/clang/test/Profile/branch-logical-mixed.cpp +++ b/clang/test/Profile/branch-logical-mixed.cpp @@ -23,44 +23,44 @@ bool func() { bool bf5 = false; bool a = bt0 && - bf0 && // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 10 - bt1 && // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 8 - bf1 && // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 6 - bt2 && // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 4 - bf2; // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 2 + bf0 && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 10 + bt1 && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 8 + bf1 && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 6 + bt2 && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 4 + bf2; // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 2 bool b = bt0 || - bf0 || // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 20 - bt1 || // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 18 - bf1 || // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 16 - bt2 || // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 14 - bf2; // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 12 + bf0 || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 20 + bt1 || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 18 + bf1 || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 16 + bt2 || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 14 + bf2; // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 12 - bool c = (bt0 && - bf0) || // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 27 - (bt1 && - bf1) || // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 29 - (bt2 && - bf2) || // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 31 - (bt3 && - bf3) || // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 33 - (bt4 && - bf4) || // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 35 - (bf5 && - bf5); // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 37 + bool c = (bt0 && + bf0) || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 27 + (bt1 && + bf1) || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 29 + (bt2 && + bf2) || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 31 + (bt3 && + bf3) || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 33 + (bt4 && + bf4) || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 35 + (bf5 && + bf5); // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 37 - bool d = (bt0 || - bf0) && // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 44 - (bt1 || - bf1) && // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 46 - (bt2 || - bf2) && // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 48 - (bt3 || - bf3) && // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 50 - (bt4 || - bf4) && // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 52 - (bt5 || - bf5); // CHECK: store {{.*}} @[[FUNC]], i64 0, i64 54 + bool d = (bt0 || + bf0) && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 44 + (bt1 || + bf1) && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 46 + (bt2 || + bf2) && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 48 + (bt3 || + bf3) && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 50 + (bt4 || + bf4) && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 52 + (bt5 || + bf5); // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 54 return a && b && c && d; } diff --git a/clang/test/Profile/c-captured.c b/clang/test/Profile/c-captured.c index bec10e9..f34f0cb 100644 --- a/clang/test/Profile/c-captured.c +++ b/clang/test/Profile/c-captured.c @@ -8,22 +8,22 @@ // PGOGEN: @[[C1C:__profc_c_captured.c___captured_stmt.1]] = private global [3 x i64] zeroinitializer // PGOALL-LABEL: define{{.*}} void @debug_captured() -// PGOGEN: store {{.*}} @[[DCC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[DCC]], i32 0, i32 0 void debug_captured() { int x = 10; - // Check both debug_captured counters, so we can do this all in one pass - // PGOGEN: store {{.*}} @[[DCC]], i64 0, i64 1 - // PGOUSE: br {{.*}} !prof ![[DC1:[0-9]+]] - // PGOGEN: store {{.*}} @[[DCC]], i64 0, i64 2 - // PGOUSE: br {{.*}} !prof ![[DC2:[0-9]+]] - // PGOALL: ret +// Check both debug_captured counters, so we can do this all in one pass +// PGOGEN: store {{.*}} @[[DCC]], i32 0, i32 1 +// PGOUSE: br {{.*}} !prof ![[DC1:[0-9]+]] +// PGOGEN: store {{.*}} @[[DCC]], i32 0, i32 2 +// PGOUSE: br {{.*}} !prof ![[DC2:[0-9]+]] +// PGOALL: ret - // PGOALL-LABEL: define internal void @__captured_stmt( - // PGOGEN: store {{.*}} @[[CSC]], i64 0, i64 0 - #pragma clang __debug captured +// PGOALL-LABEL: define internal void @__captured_stmt( +// PGOGEN: store {{.*}} @[[CSC]], i32 0, i32 0 +#pragma clang __debug captured { - // PGOGEN: store {{.*}} @[[CSC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[CSC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[CS1:[0-9]+]] if (x) {} // PGOALL: ret @@ -31,14 +31,14 @@ void debug_captured() { if (x) {} // This is DC1. Checked above. - // PGOALL-LABEL: define internal void @__captured_stmt.1( - // PGOGEN: store {{.*}} @[[C1C]], i64 0, i64 0 - #pragma clang __debug captured +// PGOALL-LABEL: define internal void @__captured_stmt.1( +// PGOGEN: store {{.*}} @[[C1C]], i32 0, i32 0 +#pragma clang __debug captured { - // PGOGEN: store {{.*}} @[[C1C]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[C1C]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[C11:[0-9]+]] for (int i = 0; i < x; ++i) {} - // PGOGEN: store {{.*}} @[[C1C]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[C1C]], i32 0, i32 2 // PGOUSE: br {{.*}} !prof ![[C12:[0-9]+]] if (x) {} // PGOALL: ret diff --git a/clang/test/Profile/c-general.c b/clang/test/Profile/c-general.c index d77301d..91e5984 100644 --- a/clang/test/Profile/c-general.c +++ b/clang/test/Profile/c-general.c @@ -24,18 +24,18 @@ // PGOGEN-LABEL: @simple_loops() // PGOUSE-LABEL: @simple_loops() -// PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[SLC]], i32 0, i32 0 void simple_loops() { int i; - // PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[SLC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[SL1:[0-9]+]] for (i = 0; i < 100; ++i) { } - // PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[SLC]], i32 0, i32 2 // PGOUSE: br {{.*}} !prof ![[SL2:[0-9]+]] while (i > 0) i--; - // PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 3 + // PGOGEN: store {{.*}} @[[SLC]], i32 0, i32 3 // PGOUSE: br {{.*}} !prof ![[SL3:[0-9]+]] do {} while (i++ < 75); @@ -45,37 +45,37 @@ void simple_loops() { // PGOGEN-LABEL: @conditionals() // PGOUSE-LABEL: @conditionals() -// PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 0 void conditionals() { - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[IF1:[0-9]+]] for (int i = 0; i < 100; ++i) { - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 2 // PGOUSE: br {{.*}} !prof ![[IF2:[0-9]+]] if (i % 2) { - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 3 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 3 // PGOUSE: br {{.*}} !prof ![[IF3:[0-9]+]] if (i) {} - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 4 - // PGOUSE: br {{.*}} !prof ![[IF4:[0-9]+]] + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 4 + // PGOUSE: br {{.*}} !prof ![[IF4:[0-9]+]] } else if (i % 3) { - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 5 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 5 // PGOUSE: br {{.*}} !prof ![[IF5:[0-9]+]] if (i) {} } else { - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 6 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 6 // PGOUSE: br {{.*}} !prof ![[IF6:[0-9]+]] if (i) {} } - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 8 - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 9 - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 7 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 8 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 9 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 7 // PGOUSE: br {{.*}} !prof ![[IF7:[0-9]+]] if (1 && i) {} - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 11 - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 12 - // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 10 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 11 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 12 + // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 10 // PGOUSE: br {{.*}} !prof ![[IF8:[0-9]+]] if (0 || i) {} } @@ -86,35 +86,35 @@ void conditionals() { // PGOGEN-LABEL: @early_exits() // PGOUSE-LABEL: @early_exits() -// PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 0 void early_exits() { int i = 0; - // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[EE1:[0-9]+]] if (i) {} - // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 2 // PGOUSE: br {{.*}} !prof ![[EE2:[0-9]+]] while (i < 100) { i++; - // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 3 + // PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 3 // PGOUSE: br {{.*}} !prof ![[EE3:[0-9]+]] if (i > 50) break; - // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 4 + // PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 4 // PGOUSE: br {{.*}} !prof ![[EE4:[0-9]+]] if (i % 2) continue; } - // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 5 + // PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 5 // PGOUSE: br {{.*}} !prof ![[EE5:[0-9]+]] if (i) {} - // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 6 + // PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 6 do { - // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 7 + // PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 7 // PGOUSE: br {{.*}} !prof ![[EE6:[0-9]+]] if (i > 75) return; @@ -123,7 +123,7 @@ void early_exits() { // PGOUSE: br {{.*}} !prof ![[EE7:[0-9]+]] } while (i < 100); - // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 8 + // PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 8 // Never reached -> no weights if (i) {} @@ -133,78 +133,78 @@ void early_exits() { // PGOGEN-LABEL: @jumps() // PGOUSE-LABEL: @jumps() -// PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 0 void jumps() { int i; - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[JM1:[0-9]+]] for (i = 0; i < 2; ++i) { goto outofloop; // Never reached -> no weights if (i) {} } -// PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 3 +// PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 3 outofloop: - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 4 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 4 // PGOUSE: br {{.*}} !prof ![[JM2:[0-9]+]] if (i) {} goto loop1; - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 5 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 5 // PGOUSE: br {{.*}} !prof ![[JM3:[0-9]+]] while (i) { - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 6 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 6 loop1: - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 7 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 7 // PGOUSE: br {{.*}} !prof ![[JM4:[0-9]+]] if (i) {} } goto loop2; -// PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 8 +// PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 8 first: -// PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 9 +// PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 9 second: -// PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 10 +// PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 10 third: i++; - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 11 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 11 // PGOUSE: br {{.*}} !prof ![[JM5:[0-9]+]] if (i < 3) goto loop2; - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 12 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 12 // PGOUSE: br {{.*}} !prof ![[JM6:[0-9]+]] while (i < 3) { - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 13 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 13 loop2: // PGOUSE: switch {{.*}} [ // PGOUSE: ], !prof ![[JM7:[0-9]+]] switch (i) { - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 15 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 15 case 0: goto first; - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 16 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 16 case 1: goto second; - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 17 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 17 case 2: goto third; } - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 14 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 14 } - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 18 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 18 // PGOUSE: br {{.*}} !prof ![[JM8:[0-9]+]] for (i = 0; i < 10; ++i) { goto withinloop; // never reached -> no weights if (i) {} - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 20 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 20 withinloop: - // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 21 + // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 21 // PGOUSE: br {{.*}} !prof ![[JM9:[0-9]+]] if (i) {} } @@ -215,70 +215,70 @@ third: // PGOGEN-LABEL: @switches() // PGOUSE-LABEL: @switches() -// PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 0 void switches() { static int weights[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5}; // No cases -> no weights switch (weights[0]) { - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 2 default: break; } - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 1 - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 3 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 3 // PGOUSE: br {{.*}} !prof ![[SW1:[0-9]+]] for (int i = 0, len = sizeof(weights) / sizeof(weights[0]); i < len; ++i) { // PGOUSE: switch {{.*}} [ // PGOUSE: ], !prof ![[SW2:[0-9]+]] switch (i[weights]) { - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 5 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 5 case 1: - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 6 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 6 // PGOUSE: br {{.*}} !prof ![[SW3:[0-9]+]] if (i) {} // fallthrough - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 7 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 7 case 2: - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 8 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 8 // PGOUSE: br {{.*}} !prof ![[SW4:[0-9]+]] if (i) {} break; - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 9 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 9 case 3: - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 10 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 10 // PGOUSE: br {{.*}} !prof ![[SW5:[0-9]+]] if (i) {} continue; - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 11 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 11 case 4: - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 12 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 12 // PGOUSE: br {{.*}} !prof ![[SW6:[0-9]+]] if (i) {} // PGOUSE: switch {{.*}} [ // PGOUSE: ], !prof ![[SW7:[0-9]+]] switch (i) { - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 14 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 14 case 6 ... 9: - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 15 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 15 // PGOUSE: br {{.*}} !prof ![[SW8:[0-9]+]] if (i) {} continue; } - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 13 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 13 - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 16 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 16 default: - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 17 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 17 // PGOUSE: br {{.*}} !prof ![[SW9:[0-9]+]] if (i == len - 1) return; } - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 4 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 4 } - // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 18 + // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 18 // Never reached -> no weights if (weights[0]) {} @@ -288,64 +288,64 @@ void switches() { // PGOGEN-LABEL: @big_switch() // PGOUSE-LABEL: @big_switch() -// PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 0 void big_switch() { - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[BS1:[0-9]+]] for (int i = 0; i < 32; ++i) { // PGOUSE: switch {{.*}} [ // PGOUSE: ], !prof ![[BS2:[0-9]+]] switch (1 << i) { - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 3 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 3 case (1 << 0): - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 4 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 4 // PGOUSE: br {{.*}} !prof ![[BS3:[0-9]+]] if (i) {} // fallthrough - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 5 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 5 case (1 << 1): - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 6 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 6 // PGOUSE: br {{.*}} !prof ![[BS4:[0-9]+]] if (i) {} break; - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 7 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 7 case (1 << 2) ... (1 << 12): - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 8 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 8 // PGOUSE: br {{.*}} !prof ![[BS5:[0-9]+]] if (i) {} break; // The branch for the large case range above appears after the case body // PGOUSE: br {{.*}} !prof ![[BS6:[0-9]+]] - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 9 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 9 case (1 << 13): - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 10 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 10 // PGOUSE: br {{.*}} !prof ![[BS7:[0-9]+]] if (i) {} break; - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 11 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 11 case (1 << 14) ... (1 << 28): - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 12 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 12 // PGOUSE: br {{.*}} !prof ![[BS8:[0-9]+]] if (i) {} break; // The branch for the large case range above appears after the case body // PGOUSE: br {{.*}} !prof ![[BS9:[0-9]+]] - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 13 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 13 case (1 << 29) ... ((1 << 29) + 1): - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 14 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 14 // PGOUSE: br {{.*}} !prof ![[BS10:[0-9]+]] if (i) {} break; - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 15 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 15 default: - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 16 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 16 // PGOUSE: br {{.*}} !prof ![[BS11:[0-9]+]] if (i) {} break; } - // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 2 } // PGOGEN-NOT: store {{.*}} @[[BSC]], @@ -355,34 +355,34 @@ void big_switch() { // PGOGEN-LABEL: @boolean_operators() // PGOUSE-LABEL: @boolean_operators() -// PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 0 void boolean_operators() { int v; - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[BO1:[0-9]+]] for (int i = 0; i < 100; ++i) { - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 2 - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 3 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 2 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 3 // PGOUSE: br {{.*}} !prof ![[BO2:[0-9]+]] v = i % 3 || i; - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 4 - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 5 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 4 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 5 // PGOUSE: br {{.*}} !prof ![[BO3:[0-9]+]] v = i % 3 && i; - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 8 - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 9 - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 6 - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 7 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 8 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 9 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 6 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 7 // PGOUSE: br {{.*}} !prof ![[BO4:[0-9]+]] // PGOUSE: br {{.*}} !prof ![[BO5:[0-9]+]] v = i % 3 || i % 2 || i; - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 12 - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 13 - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 10 - // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 11 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 12 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 13 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 10 + // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 11 // PGOUSE: br {{.*}} !prof ![[BO6:[0-9]+]] // PGOUSE: br {{.*}} !prof ![[BO7:[0-9]+]] v = i % 2 && i % 3 && i; @@ -394,36 +394,36 @@ void boolean_operators() { // PGOGEN-LABEL: @boolop_loops() // PGOUSE-LABEL: @boolop_loops() -// PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 0 void boolop_loops() { int i = 100; - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 2 - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 3 - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 2 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 3 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[BL1:[0-9]+]] // PGOUSE: br {{.*}} !prof ![[BL2:[0-9]+]] while (i && i > 50) i--; - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 5 - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 6 - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 4 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 5 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 6 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 4 // PGOUSE: br {{.*}} !prof ![[BL3:[0-9]+]] // PGOUSE: br {{.*}} !prof ![[BL4:[0-9]+]] while ((i % 2) || (i > 0)) i--; - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 8 - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 9 - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 7 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 8 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 9 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 7 // PGOUSE: br {{.*}} !prof ![[BL5:[0-9]+]] // PGOUSE: br {{.*}} !prof ![[BL6:[0-9]+]] for (i = 100; i && i > 50; --i); - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 11 - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 12 - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 10 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 11 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 12 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 10 // PGOUSE: br {{.*}} !prof ![[BL7:[0-9]+]] // PGOUSE: br {{.*}} !prof ![[BL8:[0-9]+]] for (; (i % 2) || (i > 0); --i); @@ -434,15 +434,15 @@ void boolop_loops() { // PGOGEN-LABEL: @conditional_operator() // PGOUSE-LABEL: @conditional_operator() -// PGOGEN: store {{.*}} @[[COC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[COC]], i32 0, i32 0 void conditional_operator() { int i = 100; - // PGOGEN: store {{.*}} @[[COC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[COC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[CO1:[0-9]+]] int j = i < 50 ? i : 1; - // PGOGEN: store {{.*}} @[[COC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[COC]], i32 0, i32 2 // PGOUSE: br {{.*}} !prof ![[CO2:[0-9]+]] int k = i ?: 0; @@ -452,18 +452,18 @@ void conditional_operator() { // PGOGEN-LABEL: @do_fallthrough() // PGOUSE-LABEL: @do_fallthrough() -// PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[DFC]], i32 0, i32 0 void do_fallthrough() { - // PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[DFC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[DF1:[0-9]+]] for (int i = 0; i < 10; ++i) { int j = 0; - // PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[DFC]], i32 0, i32 2 do { // The number of exits out of this do-loop via the break statement // exceeds the counter value for the loop (which does not include the // fallthrough count). Make sure that does not violate any assertions. - // PGOGEN: store {{.*}} @[[DFC]], i64 0, i64 3 + // PGOGEN: store {{.*}} @[[DFC]], i32 0, i32 3 // PGOUSE: br {{.*}} !prof ![[DF3:[0-9]+]] if (i < 8) break; j++; @@ -474,9 +474,9 @@ void do_fallthrough() { // PGOGEN-LABEL: @static_func() // PGOUSE-LABEL: @static_func() -// PGOGEN: store {{.*}} @[[STC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[STC]], i32 0, i32 0 static void static_func() { - // PGOGEN: store {{.*}} @[[STC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[STC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[ST1:[0-9]+]] for (int i = 0; i < 10; ++i) { } diff --git a/clang/test/Profile/c-ternary.c b/clang/test/Profile/c-ternary.c index 7d41b04..c1560be 100644 --- a/clang/test/Profile/c-ternary.c +++ b/clang/test/Profile/c-ternary.c @@ -5,11 +5,11 @@ // condition when the condition evaluates to true. // CHECK-LABEL: define{{.*}} i32 @f1 int f1(int x) { -// CHECK: [[TOBOOL:%.*]] = icmp ne i32 %{{.*}}, 0 -// CHECK-NEXT: [[STEP:%.*]] = zext i1 [[TOBOOL]] to i64 -// CHECK-NEXT: [[COUNTER:%.*]] = load i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @__profc_f1, i64 0, i64 1) -// CHECK-NEXT: add i64 [[COUNTER]], [[STEP]] -// CHECK: [[COND:%.*]] = select i1 [[TOBOOL]], i32 0, i32 1 + // CHECK: [[TOBOOL:%.*]] = icmp ne i32 %{{.*}}, 0 + // CHECK-NEXT: [[STEP:%.*]] = zext i1 [[TOBOOL]] to i64 + // CHECK-NEXT: [[COUNTER:%.*]] = load i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @__profc_f1, i32 0, i32 1) + // CHECK-NEXT: add i64 [[COUNTER]], [[STEP]] + // CHECK: [[COND:%.*]] = select i1 [[TOBOOL]], i32 0, i32 1 return x ? 0 : 1; // CHECK: ret i32 [[COND]] } diff --git a/clang/test/Profile/cxx-class.cpp b/clang/test/Profile/cxx-class.cpp index ab90d19..9fc2e24 100644 --- a/clang/test/Profile/cxx-class.cpp +++ b/clang/test/Profile/cxx-class.cpp @@ -22,9 +22,9 @@ public: int Member; // CTRGEN-LABEL: define {{.*}} @_ZN6SimpleC2Ei( // CTRUSE-LABEL: define {{.*}} @_ZN6SimpleC2Ei( - // CTRGEN: store {{.*}} @[[SCC:__profc__ZN6SimpleC2Ei]], i64 0, i64 0 + // CTRGEN: store {{.*}} @[[SCC:__profc__ZN6SimpleC2Ei]], i32 0, i32 0 explicit Simple(int Member) : Member(Member) { - // CTRGEN: store {{.*}} @[[SCC]], i64 0, i64 1 + // CTRGEN: store {{.*}} @[[SCC]], i32 0, i32 1 // CTRUSE: br {{.*}} !prof ![[SC1:[0-9]+]] if (Member) {} // CTRGEN-NOT: store {{.*}} @[[SCC]], @@ -35,9 +35,9 @@ public: // DTRGEN-LABEL: define {{.*}} @_ZN6SimpleD2Ev( // DTRUSE-LABEL: define {{.*}} @_ZN6SimpleD2Ev( - // DTRGEN: store {{.*}} @[[SDC:__profc__ZN6SimpleD2Ev]], i64 0, i64 0 + // DTRGEN: store {{.*}} @[[SDC:__profc__ZN6SimpleD2Ev]], i32 0, i32 0 ~Simple() { - // DTRGEN: store {{.*}} @[[SDC]], i64 0, i64 1 + // DTRGEN: store {{.*}} @[[SDC]], i32 0, i32 1 // DTRUSE: br {{.*}} !prof ![[SD1:[0-9]+]] if (Member) {} // DTRGEN-NOT: store {{.*}} @[[SDC]], @@ -48,9 +48,9 @@ public: // MTHGEN-LABEL: define {{.*}} @_ZN6Simple6methodEv( // MTHUSE-LABEL: define {{.*}} @_ZN6Simple6methodEv( - // MTHGEN: store {{.*}} @[[SMC:__profc__ZN6Simple6methodEv]], i64 0, i64 0 + // MTHGEN: store {{.*}} @[[SMC:__profc__ZN6Simple6methodEv]], i32 0, i32 0 void method() { - // MTHGEN: store {{.*}} @[[SMC]], i64 0, i64 1 + // MTHGEN: store {{.*}} @[[SMC]], i32 0, i32 1 // MTHUSE: br {{.*}} !prof ![[SM1:[0-9]+]] if (Member) {} // MTHGEN-NOT: store {{.*}} @[[SMC]], @@ -64,9 +64,9 @@ class Derived : virtual public Simple { public: // VCTRGEN-LABEL: define {{.*}} @_ZN7DerivedC1Ev( // VCTRUSE-LABEL: define {{.*}} @_ZN7DerivedC1Ev( - // VCTRGEN: store {{.*}} @[[SCC:__profc__ZN7DerivedC1Ev]], i64 0, i64 0 + // VCTRGEN: store {{.*}} @[[SCC:__profc__ZN7DerivedC1Ev]], i32 0, i32 0 Derived() : Simple(0) { - // VCTRGEN: store {{.*}} @[[SCC]], i64 0, i64 1 + // VCTRGEN: store {{.*}} @[[SCC]], i32 0, i32 1 // VCTRUSE: br {{.*}} !prof ![[SC1:[0-9]+]] if (Member) {} // VCTRGEN-NOT: store {{.*}} @[[SCC]], @@ -77,9 +77,9 @@ public: // VDTRGEN-LABEL: define {{.*}} @_ZN7DerivedD2Ev( // VDTRUSE-LABEL: define {{.*}} @_ZN7DerivedD2Ev( - // VDTRGEN: store {{.*}} @[[SDC:__profc__ZN7DerivedD2Ev]], i64 0, i64 0 + // VDTRGEN: store {{.*}} @[[SDC:__profc__ZN7DerivedD2Ev]], i32 0, i32 0 ~Derived() { - // VDTRGEN: store {{.*}} @[[SDC]], i64 0, i64 1 + // VDTRGEN: store {{.*}} @[[SDC]], i32 0, i32 1 // VDTRUSE: br {{.*}} !prof ![[SD1:[0-9]+]] if (Member) {} // VDTRGEN-NOT: store {{.*}} @[[SDC]], @@ -91,9 +91,9 @@ public: // WRPGEN-LABEL: define {{.*}} @_Z14simple_wrapperv( // WRPUSE-LABEL: define {{.*}} @_Z14simple_wrapperv( -// WRPGEN: store {{.*}} @[[SWC:__profc__Z14simple_wrapperv]], i64 0, i64 0 +// WRPGEN: store {{.*}} @[[SWC:__profc__Z14simple_wrapperv]], i32 0, i32 0 void simple_wrapper() { - // WRPGEN: store {{.*}} @[[SWC]], i64 0, i64 1 + // WRPGEN: store {{.*}} @[[SWC]], i32 0, i32 1 // WRPUSE: br {{.*}} !prof ![[SW1:[0-9]+]] for (int I = 0; I < 100; ++I) { Derived d; diff --git a/clang/test/Profile/cxx-lambda.cpp b/clang/test/Profile/cxx-lambda.cpp index 4512f23..26d5474 100644 --- a/clang/test/Profile/cxx-lambda.cpp +++ b/clang/test/Profile/cxx-lambda.cpp @@ -15,32 +15,33 @@ // PGOGEN-LABEL: define {{.*}}void @_Z7lambdasv() // PGOUSE-LABEL: define {{.*}}void @_Z7lambdasv() -// PGOGEN: store {{.*}} @[[LWC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[LWC]], i32 0, i32 0 void lambdas() { int i = 1; // LMBGEN-LABEL: define internal{{( [0-9_a-z]*cc)?( zeroext)?}} i1 @"_ZZ7lambdasvENK3$_0clEi"( // LMBUSE-LABEL: define internal{{( [0-9_a-z]*cc)?( zeroext)?}} i1 @"_ZZ7lambdasvENK3$_0clEi"( - // LMBGEN: store {{.*}} @[[LFC]], i64 0, i64 0 + // LMBGEN: store {{.*}} @[[LFC]], i32 0, i32 0 auto f = [&i](int k) { - // LMBGEN: store {{.*}} @[[LFC]], i64 0, i64 1 + // LMBGEN: store {{.*}} @[[LFC]], i32 0, i32 1 // LMBUSE: br {{.*}} !prof ![[LF1:[0-9]+]] - if (i > 0) {} - // LMBGEN: store {{.*}} @[[LFC]], i64 0, i64 2 + if (i > 0) { + } + // LMBGEN: store {{.*}} @[[LFC]], i32 0, i32 2 // LMBUSE: br {{.*}} !prof ![[LF2:[0-9]+]] return k && i; }; - // PGOGEN: store {{.*}} @[[LWC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[LWC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[LW1:[0-9]+]] if (i) {} - // PGOGEN: store {{.*}} @[[LWC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[LWC]], i32 0, i32 2 // PGOUSE: br {{.*}} !prof ![[LW2:[0-9]+]] for (i = 0; i < 10; ++i) f(9 - i); - // PGOGEN: store {{.*}} @[[LWC]], i64 0, i64 3 + // PGOGEN: store {{.*}} @[[LWC]], i32 0, i32 3 // PGOUSE: br {{.*}} !prof ![[LW3:[0-9]+]] if (i) {} } diff --git a/clang/test/Profile/cxx-rangefor.cpp b/clang/test/Profile/cxx-rangefor.cpp index 1d2f7f4..4f463ce 100644 --- a/clang/test/Profile/cxx-rangefor.cpp +++ b/clang/test/Profile/cxx-rangefor.cpp @@ -10,25 +10,25 @@ // PGOGEN: @[[RFC:__profc__Z9range_forv]] = {{(private|internal)}} global [5 x i64] zeroinitializer // CHECK-LABEL: define {{.*}}void @_Z9range_forv() -// PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[RFC]], i32 0, i32 0 void range_for() { int arr[] = {1, 2, 3, 4, 5}; int sum = 0; - // PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[RFC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[RF1:[0-9]+]] for (auto i : arr) { - // PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[RFC]], i32 0, i32 2 // PGOUSE: br {{.*}} !prof ![[RF2:[0-9]+]] if (i == 3) continue; sum += i; - // PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 3 + // PGOGEN: store {{.*}} @[[RFC]], i32 0, i32 3 // PGOUSE: br {{.*}} !prof ![[RF3:[0-9]+]] if (sum >= 7) break; } - // PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 4 + // PGOGEN: store {{.*}} @[[RFC]], i32 0, i32 4 // PGOUSE: br {{.*}} !prof ![[RF4:[0-9]+]] if (sum) {} } diff --git a/clang/test/Profile/cxx-stmt-initializers.cpp b/clang/test/Profile/cxx-stmt-initializers.cpp index 6ff4d6e..6baa44b 100644 --- a/clang/test/Profile/cxx-stmt-initializers.cpp +++ b/clang/test/Profile/cxx-stmt-initializers.cpp @@ -10,20 +10,20 @@ // switch initializer, and the switch successor block. // // CHECK-LABEL: define {{.*}}void @_Z11switch_initv() -// PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 0 void switch_init() { switch (int i = true ? 0 : 1; i) {} - // PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 2 - // PGOGEN: store {{.*}} @[[SIC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 2 + // PGOGEN: store {{.*}} @[[SIC]], i32 0, i32 1 } // Note: We expect counters for the function entry block, the condition in the // if initializer, and the if successor block. // // CHECK-LABEL: define {{.*}}void @_Z7if_initv() -// PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 0 void if_init() { if (int i = true ? 0 : 1; i) {} - // PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 2 - // PGOGEN: store {{.*}} @[[IIC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 2 + // PGOGEN: store {{.*}} @[[IIC]], i32 0, i32 1 } diff --git a/clang/test/Profile/cxx-templates.cpp b/clang/test/Profile/cxx-templates.cpp index 9f8c5a0..3207376 100644 --- a/clang/test/Profile/cxx-templates.cpp +++ b/clang/test/Profile/cxx-templates.cpp @@ -21,13 +21,13 @@ // T100USE-LABEL: define linkonce_odr {{.*}}void @_Z4loopILj100EEvv() template void loop() { // ALL-NOT: ret - // T0GEN: store {{.*}} @[[T0C]], i64 0, i64 0 - // T100GEN: store {{.*}} @[[T100C]], i64 0, i64 0 + // T0GEN: store {{.*}} @[[T0C]], i32 0, i32 0 + // T100GEN: store {{.*}} @[[T100C]], i32 0, i32 0 // ALL-NOT: ret - // T0GEN: store {{.*}} @[[T0C]], i64 0, i64 1 + // T0GEN: store {{.*}} @[[T0C]], i32 0, i32 1 // T0USE: br {{.*}} !prof ![[T01:[0-9]+]] - // T100GEN: store {{.*}} @[[T100C]], i64 0, i64 1 + // T100GEN: store {{.*}} @[[T100C]], i32 0, i32 1 // T100USE: br {{.*}} !prof ![[T1001:[0-9]+]] for (unsigned I = 0; I < N; ++I) {} diff --git a/clang/test/Profile/cxx-throws.cpp b/clang/test/Profile/cxx-throws.cpp index f6c0f52..a646cbb 100644 --- a/clang/test/Profile/cxx-throws.cpp +++ b/clang/test/Profile/cxx-throws.cpp @@ -16,16 +16,16 @@ // PGOGEN-LABEL: @_Z6throwsv() // PGOUSE-LABEL: @_Z6throwsv() -// PGOGEN: store {{.*}} @[[THC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[THC]], i32 0, i32 0 void throws() { - // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[THC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[TH1:[0-9]+]] for (int i = 0; i < 100; ++i) { try { - // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 3 + // PGOGEN: store {{.*}} @[[THC]], i32 0, i32 3 // PGOUSE: br {{.*}} !prof ![[TH2:[0-9]+]] if (i % 3) { - // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 4 + // PGOGEN: store {{.*}} @[[THC]], i32 0, i32 4 // PGOUSE: br {{.*}} !prof ![[TH3:[0-9]+]] if (i < 50) throw 1; @@ -36,7 +36,7 @@ void throws() { // PGOUSE: if.else{{.*}}: // PGOGEN: if.else{{.*}}: - // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 5 + // PGOGEN: store {{.*}} @[[THC]], i32 0, i32 5 // PGOUSE: br {{.*}} !prof ![[TH4:[0-9]+]] if (i >= 50) throw 0; @@ -45,14 +45,14 @@ void throws() { // PGOUSE-EXC: catch{{.*}}: // PGOGEN-EXC: catch{{.*}}: - // PGOGEN-EXC: store {{.*}} @[[THC]], i64 0, i64 6 - // PGOGEN-EXC: store {{.*}} @[[THC]], i64 0, i64 7 + // PGOGEN-EXC: store {{.*}} @[[THC]], i32 0, i32 6 + // PGOGEN-EXC: store {{.*}} @[[THC]], i32 0, i32 7 // PGOUSE-EXC: br {{.*}} !prof ![[TH5:[0-9]+]] if (e) {} } - // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[THC]], i32 0, i32 2 - // PGOGEN: store {{.*}} @[[THC]], i64 0, i64 8 + // PGOGEN: store {{.*}} @[[THC]], i32 0, i32 8 // PGOUSE: br {{.*}} !prof ![[TH6:[0-9]+]] if (i < 100) {} } @@ -63,14 +63,14 @@ void throws() { // PGOGEN-LABEL: @_Z11unreachablei(i32 // PGOUSE-LABEL: @_Z11unreachablei(i32 -// PGOGEN: store {{.*}} @[[UNC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[UNC]], i32 0, i32 0 void unreachable(int i) { - // PGOGEN: store {{.*}} @[[UNC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[UNC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[UN1:[0-9]+]] if (i) throw i; - // PGOGEN: store {{.*}} @[[UNC]], i64 0, i64 2 + // PGOGEN: store {{.*}} @[[UNC]], i32 0, i32 2 // Since we never reach here, the weights should all be zero (and skipped) // PGOUSE-NOT: br {{.*}} !prof !{{.*}} if (i) {} diff --git a/clang/test/Profile/objc-general.m b/clang/test/Profile/objc-general.m index 7a4cac9..b043363 100644 --- a/clang/test/Profile/objc-general.m +++ b/clang/test/Profile/objc-general.m @@ -44,23 +44,25 @@ struct NSFastEnumerationState; @implementation A // PGOGEN: define {{.*}}+[A foreach:] // PGOUSE: define {{.*}}+[A foreach:] -// PGOGEN: store {{.*}} @[[FRC]], i64 0, i64 0 +// PGOGEN: store {{.*}} @[[FRC]], i32 0, i32 0 + (void)foreach: (NSArray *)array { __block id result; - // PGOGEN: store {{.*}} @[[FRC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[FRC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[FR1:[0-9]+]] // PGOUSE: br {{.*}} !prof ![[FR2:[0-9]+]] for (id x in array) { // PGOGEN: define {{.*}}_block_invoke // PGOUSE: define {{.*}}_block_invoke - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 0 - ^{ static int init = 0; - // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 1 + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 0 + ^{ + static int init = 0; + // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[BL1:[0-9]+]] - if (init) - result = x; - init = 1; }(); + if (init) + result = x; + init = 1; + }(); } } @end diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index ad21fec..36a66e0 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -692,7 +692,7 @@ void InstrProfiling::lowerIncrement(InstrProfIncrementInst *Inc) { IRBuilder<> Builder(Inc); uint64_t Index = Inc->getIndex()->getZExtValue(); - Value *Addr = Builder.CreateConstInBoundsGEP2_64(Counters->getValueType(), + Value *Addr = Builder.CreateConstInBoundsGEP2_32(Counters->getValueType(), Counters, 0, Index); if (isRuntimeCounterRelocationEnabled()) { diff --git a/llvm/test/Instrumentation/InstrProfiling/atomic-updates.ll b/llvm/test/Instrumentation/InstrProfiling/atomic-updates.ll index 691a116..d123f6b 100644 --- a/llvm/test/Instrumentation/InstrProfiling/atomic-updates.ll +++ b/llvm/test/Instrumentation/InstrProfiling/atomic-updates.ll @@ -5,7 +5,7 @@ target triple = "x86_64-apple-macosx10.10.0" @__profn_foo = private constant [3 x i8] c"foo" ; CHECK-LABEL: define void @foo -; CHECK-NEXT: atomicrmw add i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i64 0, i64 0), i64 1 monotonic +; CHECK-NEXT: atomicrmw add i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i32 0, i32 0), i64 1 monotonic define void @foo() { call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 0, i32 1, i32 0) ret void diff --git a/llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll b/llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll index cd5d36b..e5e9b7d 100644 --- a/llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll +++ b/llvm/test/Instrumentation/InstrProfiling/runtime-counter-relocation.ll @@ -8,9 +8,9 @@ target triple = "x86_64-unknown-linux-gnu" ; RELOC: @__llvm_profile_counter_bias = linkonce_odr hidden global i64 0, comdat ; CHECK-LABEL: define void @foo -; CHECK-NEXT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i64 0, i64 0) +; CHECK-NEXT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i32 0, i32 0) ; CHECK-NEXT: %1 = add i64 %pgocount, 1 -; CHECK-NEXT: store i64 %1, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i64 0, i64 0) +; CHECK-NEXT: store i64 %1, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo, i32 0, i32 0) ; RELOC-LABEL: define void @foo ; RELOC-NEXT: %1 = load i64, i64* @__llvm_profile_counter_bias ; RELOC-NEXT: %2 = add i64 ptrtoint ([1 x i64]* @__profc_foo to i64), %1 diff --git a/llvm/test/Transforms/PGOProfile/counter_promo_exit_catchswitch.ll b/llvm/test/Transforms/PGOProfile/counter_promo_exit_catchswitch.ll index dc7a166..dc84b4f 100644 --- a/llvm/test/Transforms/PGOProfile/counter_promo_exit_catchswitch.ll +++ b/llvm/test/Transforms/PGOProfile/counter_promo_exit_catchswitch.ll @@ -38,11 +38,11 @@ for.cond: ; preds = %for.inc, %entry for.body: ; preds = %for.cond ; CHECK: for.body: -; NOTENTRY: %pgocount1 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 0) -; TENTRY: %pgocount1 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 1) +; NOTENTRY: %pgocount1 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i32 0, i32 0) +; TENTRY: %pgocount1 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i32 0, i32 1) ; CHECK: %1 = add i64 %pgocount1, 1 -; NOTENTRY: store i64 %1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 0) -; ENTRY: store i64 %1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 1) +; NOTENTRY: store i64 %1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i32 0, i32 0) +; ENTRY: store i64 %1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i32 0, i32 1) %idxprom = zext i32 %i.0 to i64 %arrayidx = getelementptr inbounds [200 x i8], [200 x i8]* @"?buffer@@3PADA", i64 0, i64 %idxprom %0 = load i8, i8* %arrayidx, align 1 @@ -55,11 +55,11 @@ if.end: ; preds = %for.body for.inc: ; preds = %if.end ; CHECK: for.inc: -; NOTENTRY: %pgocount2 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 1) -; ENTRY: %pgocount2 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 2) +; NOTENTRY: %pgocount2 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i32 0, i32 1) +; ENTRY: %pgocount2 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i32 0, i32 2) ; CHECK: %3 = add i64 %pgocount2, 1 -; NOTENTRY: store i64 %3, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 1) -; ENTRY: store i64 %3, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 2) +; NOTENTRY: store i64 %3, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i32 0, i32 1) +; ENTRY: store i64 %3, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i32 0, i32 2) %inc = add nuw nsw i32 %i.0, 1 br label %for.cond diff --git a/llvm/test/Transforms/PGOProfile/instr_entry_bb.ll b/llvm/test/Transforms/PGOProfile/instr_entry_bb.ll index 80e30a3..34586e6 100644 --- a/llvm/test/Transforms/PGOProfile/instr_entry_bb.ll +++ b/llvm/test/Transforms/PGOProfile/instr_entry_bb.ll @@ -18,7 +18,7 @@ entry: ; GEN: entry: ; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_2, i32 0, i32 0), i64 {{[0-9]+}}, i32 2, i32 0) ; GENA: entry: -; GENA: %{{[0-9+]}} = atomicrmw add i64* getelementptr inbounds ([2 x i64], [2 x i64]* @__profc_test_br_2, i64 0, i64 0), i64 1 monotonic +; GENA: %{{[0-9+]}} = atomicrmw add i64* getelementptr inbounds ([2 x i64], [2 x i64]* @__profc_test_br_2, i32 0, i32 0), i64 1 monotonic ; USE: br i1 %cmp, label %if.then, label %if.else ; USE-SAME: !prof ![[BW_ENTRY:[0-9]+]] ; USE: ![[BW_ENTRY]] = !{!"branch_weights", i32 0, i32 1} @@ -35,9 +35,9 @@ if.else: ; GEN: if.else: ; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_2, i32 0, i32 0), i64 {{[0-9]+}}, i32 2, i32 1) ; GENA: if.else: -; GENA: %pgocount = load i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @__profc_test_br_2, i64 0, i64 1), align 8 +; GENA: %pgocount = load i64, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @__profc_test_br_2, i32 0, i32 1), align 8 ; GENA: [[V:%[0-9]*]] = add i64 %pgocount, 1 -; GENA: store i64 [[V]], i64* getelementptr inbounds ([2 x i64], [2 x i64]* @__profc_test_br_2, i64 0, i64 1), align 8 +; GENA: store i64 [[V]], i64* getelementptr inbounds ([2 x i64], [2 x i64]* @__profc_test_br_2, i32 0, i32 1), align 8 %sub = sub nsw i32 %i, 2 br label %if.end -- 2.7.4