1 # needs-profiler-support
4 # FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
5 # properly. Since we only have GCC on the CI ignore the test for now.
10 # We don't compile `opaque` with either optimizations or instrumentation.
11 # We don't compile `opaque` with either optimizations or instrumentation.
12 $(RUSTC) $(COMMON_FLAGS) opaque.rs
13 # Compile the test program with instrumentation
14 mkdir -p "$(TMPDIR)"/prof_data_dir
15 $(RUSTC) $(COMMON_FLAGS) interesting.rs \
16 -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O -Ccodegen-units=1
17 $(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)"/prof_data_dir -O
18 # The argument below generates to the expected branch weights
19 $(call RUN,main) || exit 1
20 "$(LLVM_BIN_DIR)"/llvm-profdata merge \
21 -o "$(TMPDIR)"/prof_data_dir/merged.profdata \
22 "$(TMPDIR)"/prof_data_dir
23 $(RUSTC) $(COMMON_FLAGS) interesting.rs \
24 -Cprofile-use="$(TMPDIR)"/prof_data_dir/merged.profdata -O \
25 -Ccodegen-units=1 --emit=llvm-ir
26 cat "$(TMPDIR)"/interesting.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt