llvm-project/llvm/test
Nick Desaulniers 4331f19d8b [ISEL][BitTestBlock] omit additional bit test when default destination is unreachable
Otherwise we end up with an extra conditional jump, following by an
unconditional jump off the end of a function. ie.

  bb.0:
    BT32rr ..
    JCC_1 %bb.4 ...
  bb.1:
    BT32rr ..
    JCC_1 %bb.2 ...
    JMP_1 %bb.3
  bb.2:
    ...
  bb.3.unreachable:
  bb.4:
    ...

  Should be equivalent to:
  bb.0:
    BT32rr ..
    JCC_1 %bb.4 ...
    JMP_1 %bb.2
  bb.1:
  bb.2:
    ...
  bb.3.unreachable:
  bb.4:
    ...

This can occur since at the higher level IR (Instruction) SwitchInsts
are required to have BBs for default destinations, even when it can be
deduced that such BBs are unreachable.

For most programs, this isn't an issue, just wasted instructions since the
unreachable has been statically proven.

The x86_64 Linux kernel when built with CONFIG_LTO_CLANG_THIN=y fails to
boot though once D106056 is re-applied.  D106056 makes it more likely
that correlation-propagation (CVP) can deduce that the default case of
SwitchInsts are unreachable. The x86_64 kernel uses a binary post
processor called objtool, which emits this warning:

vmlinux.o: warning: objtool: cfg80211_edmg_chandef_valid()+0x169: can't
find jump dest instruction at .text.cfg80211_edmg_chandef_valid+0x17b

I haven't debugged precisely why this causes a failure at boot time, but
fixing this very obvious jump off the end of the function fixes the
warning and boot problem.

Link: https://bugs.llvm.org/show_bug.cgi?id=50080
Fixes: https://github.com/ClangBuiltLinux/linux/issues/679
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1440

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D109103
2021-09-08 11:03:47 -07:00
..
Analysis [SCEV] Use no-self-wrap flags infered from exit structure to compute trip count 2021-09-07 17:00:02 -07:00
Assembler [UseListOrder] Fix use list order for function operands 2021-09-07 20:59:12 +02:00
Bindings
Bitcode [DebugInfo] generate btf_tag annotations for func parameters 2021-08-26 14:18:30 -07:00
BugPoint
CodeGen [ISEL][BitTestBlock] omit additional bit test when default destination is unreachable 2021-09-08 11:03:47 -07:00
DebugInfo [LiveDebugValues] Handle spills of indirect debug values correctly 2021-09-08 14:06:08 +03:00
Demangle
Examples
ExecutionEngine [RuntimeDyld] Implemented relocation of TLS symbols in ELF 2021-09-06 10:27:43 +02:00
Feature
FileCheck [FileCheck] Use StringRef for MatchRegexp to fix crash. 2021-09-01 14:27:14 +02:00
Instrumentation [test] Remove some legacy PM tests in llvm/test/Instrumentation/AddressSanitizer 2021-09-05 12:06:14 -07:00
Integer
JitListener
LTO
Linker Copy Elementtype Attribute to IR at Link step 2021-09-07 11:41:43 -07:00
MC [WebAssembly] Change WebAssemblyMCLowerPrePass to ModulePass 2021-09-08 10:47:43 -07:00
MachineVerifier Revert @llvm.isnan intrinsic patchset. 2021-09-02 13:53:56 +03:00
Object
ObjectYAML
Other [verify-uselistorder] Support -force-opaque-pointers 2021-09-04 22:41:31 +02:00
SafepointIRVerifier
Support
SymbolRewriter
TableGen [TableGen] Allow target specific flags for RegisterClass 2021-08-31 22:29:11 -04:00
ThinLTO/X86 [Clang] add support for error+warning fn attrs 2021-08-25 10:34:18 -07:00
Transforms [IROutliner] Adding supports for multiple exits 2021-09-08 08:58:07 -07:00
Unit
Verifier [Verifier] Only allow invariant.group metadata on stores and loads 2021-09-02 12:49:04 -07:00
YAMLParser
tools [SampleFDO] Allow forward compatibility when adding a new section for extbinary 2021-09-07 19:38:43 -07:00
.clang-format
CMakeLists.txt
TestRunner.sh
lit.cfg.py
lit.site.cfg.py.in