-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[InstCombine] Make test resilient to metadata presence #157607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[InstCombine] Make test resilient to metadata presence #157607
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3dd6205
to
b883589
Compare
b883589
to
0139719
Compare
@llvm/pr-subscribers-llvm-transforms Author: Mircea Trofin (mtrofin) ChangesAdding The prof annotations don’t change the intent of the test, but make it resilient to the Added a profile presence test, too. Full diff: https://github.com/llvm/llvm-project/pull/157607.diff 2 Files Affected:
diff --git a/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll b/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll
index f558e35ebe015..0b4c852664c2f 100644
--- a/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll
+++ b/llvm/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll
@@ -1,16 +1,17 @@
-; RUN: opt < %s -passes=instcombine,mem2reg,simplifycfg -simplifycfg-require-and-preserve-domtree=1 | \
-; RUN: llvm-dis | grep -v store | not grep "i32 1"
+; RUN: opt %s -passes=instcombine,mem2reg,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S \
+; RUN: | grep -v store | not grep "i32 1"
+; RUN: opt %s -passes=instcombine,mem2reg,simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
; Test to make sure that instcombine does not accidentally propagate the load
; into the PHI, which would break the program.
-define i32 @test(i1 %C) {
+define i32 @test(i1 %C) !prof !0 {
entry:
%X = alloca i32 ; <ptr> [#uses=3]
%X2 = alloca i32 ; <ptr> [#uses=2]
store i32 1, ptr %X
store i32 2, ptr %X2
- br i1 %C, label %cond_true.i, label %cond_continue.i
+ br i1 %C, label %cond_true.i, label %cond_continue.i, !prof !1
cond_true.i: ; preds = %entry
br label %cond_continue.i
@@ -22,4 +23,7 @@ cond_continue.i: ; preds = %cond_true.i, %entry
ret i32 %tmp.3
}
+; CHECK: %spec.select = select i1 %C, ptr %X, ptr %X2, !prof !1
+!0 = !{!"function_entry_count", i64 1000}
+!1 = !{!"branch_weights", i32 2, i32 7}
\ No newline at end of file
diff --git a/llvm/utils/profcheck-xfail.txt b/llvm/utils/profcheck-xfail.txt
index 258e9bcd0b34f..0f2a380a58dcb 100644
--- a/llvm/utils/profcheck-xfail.txt
+++ b/llvm/utils/profcheck-xfail.txt
@@ -831,7 +831,6 @@ Transforms/IndVarSimplify/invalidate-modified-lcssa-phi.ll
Transforms/IndVarSimplify/pr45835.ll
Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll
Transforms/Inline/optimization-remarks-hotness-threshold.ll
-Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll
Transforms/InstCombine/2004-09-20-BadLoadCombine.ll
Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll
Transforms/InstCombine/2011-02-14-InfLoop.ll
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you replace this grep test with standard FileCheck + update_test_checks?
0139719
to
e3a1591
Compare
Good point! Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but do you actually still need the prof metadata for your original motivation after this change? I guess the grep was previously matching the wrong thing, which should no longer be a problem. If it's not needed I'd drop it again.
True - it'd get checked by profcheck. |
e3a1591
to
d6811c6
Compare
d6811c6
to
8cc0a20
Compare
…esilient_to_metadata_presence
Modernized it to using
update_test_checks
which addresses an ambgiuty in the previous test formulation, where a profile metadaat of valuei32 1
would have (incorrectly matched.