Skip to content

Commit

Permalink
Workaround LLVM compiler bug when fuzzing. (#1340)
Browse files Browse the repository at this point in the history
Fixes #1173

There is a long standing crash in the LLVM code generator that we manage
to hit when fuzzing. Disable the fast instruction selector in the
fuzzing config to avoid it. I reduced a test case and filed the LLVM bug
here: llvm/llvm-project#56133
  • Loading branch information
chandlerc authored Jun 21, 2022
1 parent 445f1c6 commit c62b0d1
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions bazel/cc_toolchains/clang_cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,27 @@ def _impl(ctx):
# both are enabled.
minimal_optimization_flags = feature(
name = "minimal_optimization_flags",
flag_sets = [flag_set(
actions = codegen_compile_actions,
flag_groups = [flag_group(flags = [
"-O1",
"-mllvm",
"-fast-isel",
])],
)],
flag_sets = [
flag_set(
actions = codegen_compile_actions,
flag_groups = [flag_group(flags = [
"-O1",
])],
),
# Use a conditional flag set for enabling the fast instruction
# selector to work around an LLVM bug:
# https://github.com/llvm/llvm-project/issues/56133
flag_set(
actions = codegen_compile_actions,
flag_groups = [flag_group(flags = [
"-mllvm",
"-fast-isel",
])],
with_features = [
with_feature_set(not_features = ["fuzzer"]),
],
),
],
)
default_optimization_flags = feature(
name = "default_optimization_flags",
Expand Down

0 comments on commit c62b0d1

Please sign in to comment.