Skip to content

Commit 9a864af

Browse files
authored
llvm parsing: filter out nothing (#414)
Some of the `Dicts` in `llvm_yaml` had entries `"before" => nothing`, and that was breaking parsing. Fixes #405
1 parent 519299d commit 9a864af

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

docs/src/tutorials/snoop_llvm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ using SnoopCompileCore
2525
end
2626
2727
using SnoopCompile
28-
times, info = SnoopCompile.read_snoop_llvm("func_names.csv", "llvm_timings.yaml", tmin_secs = 0.025);
28+
times, info = SnoopCompile.read_snoop_llvm("func_names.csv", "llvm_timings.yaml", tmin_secs = 0.005);
2929
```
3030

3131
This will write two files, `"func_names.csv"` and `"llvm_timings.yaml"`, in your current working directory. Let's look at what was read from these files:

src/parcel_snoop_llvm.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,15 @@ Dict{String, NamedTuple{(:before, :after), Tuple{NamedTuple{(:instructions, :bas
3838
function read_snoop_llvm(func_csv_file, llvm_yaml_file; tmin_secs=0.0)
3939
func_csv = _read_snoop_llvm_csv(func_csv_file)
4040
llvm_yaml = YAML.load_file(llvm_yaml_file)
41+
filter!(llvm_yaml) do llvm_module
42+
llvm_module["before"] !== nothing
43+
end
4144

4245
jl_names = Dict(r[1]::String => r[2]::String for r in func_csv)
4346

47+
# `get`, but with a warning
4448
try_get_jl_name(name) = if name in keys(jl_names)
45-
jl_names[name]
49+
jl_names[name]
4650
else
4751
@warn "Couldn't find $name"
4852
name

0 commit comments

Comments
 (0)