Skip to content

Commit 971aa2b

Browse files
Attempt to fix intermittent failures of pgo-branch-weights test.
1 parent 0a58f58 commit 971aa2b

File tree

1 file changed

+19
-11
lines changed
  • src/test/run-make-fulldeps/pgo-branch-weights

1 file changed

+19
-11
lines changed

src/test/run-make-fulldeps/pgo-branch-weights/Makefile

+19-11
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,29 @@ ifdef IS_MSVC
1515
COMMON_FLAGS=-Cpanic=abort
1616
endif
1717

18+
# For some very small programs GNU ld seems to not properly handle
19+
# instrumentation sections correctly. Neither Gold nor LLD have that problem.
20+
ifeq ($(UNAME),Linux)
21+
ifneq (,$(findstring x86,$(TARGET)))
22+
COMMON_FLAGS=-Clink-args=-fuse-ld=gold
23+
endif
24+
endif
25+
26+
1827
all:
1928
# We don't compile `opaque` with either optimizations or instrumentation.
20-
# We don't compile `opaque` with either optimizations or instrumentation.
21-
$(RUSTC) $(COMMON_FLAGS) opaque.rs
29+
$(RUSTC) $(COMMON_FLAGS) opaque.rs || exit 1
2230
# Compile the test program with instrumentation
23-
mkdir -p "$(TMPDIR)"/prof_data_dir
31+
mkdir -p "$(TMPDIR)/prof_data_dir" || exit 1
2432
$(RUSTC) $(COMMON_FLAGS) interesting.rs \
25-
-Cprofile-generate="$(TMPDIR)"/prof_data_dir -O -Ccodegen-units=1
26-
$(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O
33+
-Cprofile-generate="$(TMPDIR)/prof_data_dir" -O -Ccodegen-units=1 || exit 1
34+
$(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O || exit 1
2735
# The argument below generates to the expected branch weights
2836
$(call RUN,main aaaaaaaaaaaa2bbbbbbbbbbbb2bbbbbbbbbbbbbbbbcc) || exit 1
29-
"$(LLVM_BIN_DIR)"/llvm-profdata merge \
30-
-o "$(TMPDIR)"/prof_data_dir/merged.profdata \
31-
"$(TMPDIR)"/prof_data_dir
37+
"$(LLVM_BIN_DIR)/llvm-profdata" merge \
38+
-o "$(TMPDIR)/prof_data_dir/merged.profdata" \
39+
"$(TMPDIR)/prof_data_dir" || exit 1
3240
$(RUSTC) $(COMMON_FLAGS) interesting.rs \
33-
-Cprofile-use="$(TMPDIR)"/prof_data_dir/merged.profdata -O \
34-
-Ccodegen-units=1 --emit=llvm-ir
35-
cat "$(TMPDIR)"/interesting.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt
41+
-Cprofile-use="$(TMPDIR)/prof_data_dir/merged.profdata" -O \
42+
-Ccodegen-units=1 --emit=llvm-ir || exit 1
43+
cat "$(TMPDIR)/interesting.ll" | "$(LLVM_FILECHECK)" filecheck-patterns.txt

0 commit comments

Comments
 (0)