[clang] [llvm] [X86] Support branch hint (PR #97721)
Shengchen Kan via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 4 18:47:21 PDT 2024
================
@@ -0,0 +1,95 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-linux -branch-hint -branch-hint-probability-threshold=60 -show-mc-encoding | FileCheck %s
+
+; Design: Insert "ds # encoding: [0x3e]" for condition branches who has high probability to take.
+; Source code:
+; int XX = 0;
+; int bar(int x);
+; void foo(int a, int b, char* c) {
+; if (a == 0) {
+; XX += 1;
+; } else {
+; if (c == 0)
+; XX += 2;
+; }
+; for(int i=0; i<b; i++)
+; bar(XX);
+; }
+
+ at XX = dso_local local_unnamed_addr global i32 0, align 4
+
+; Function Attrs: nounwind
+define dso_local void @foo(i32 noundef %a, i32 noundef %b, i8* noundef readnone %c) local_unnamed_addr #0 {
----------------
KanRobert wrote:
Drop `dso_local` `local_unnamed_addr #0` `; Function Attrs: nounwind` and add `-mattr=+branch-hint` to run line.
https://github.com/llvm/llvm-project/pull/97721
More information about the cfe-commits
mailing list