llvm-project/llvm/lib
Nikita Popov 5a2265647e Reapply [InstSimplify] Remove known bits constant folding
No changes relative to last time, but after a mitigation for
an AMDGPU regression landed.

---

If SimplifyInstruction() does not succeed in simplifying the
instruction, it will compute the known bits of the instruction
in the hope that all bits are known and the instruction can be
folded to a constant. I have removed a similar optimization
from InstCombine in D75801, and would like to drop this one as well.

On average, we spend ~1% of total compile-time performing this
known bits calculation. However, if we introduce some additional
statistics for known bits computations and how many of them succeed
in simplifying the instruction we get (on test-suite):

    instsimplify.NumKnownBits: 216
    instsimplify.NumKnownBitsComputed: 13828375
    valuetracking.NumKnownBitsComputed: 45860806

Out of ~14M known bits calculations (accounting for approximately
one third of all known bits calculations), only 0.0015% succeed in
producing a constant. Those cases where we do succeed to compute
all known bits will get folded by other passes like InstCombine
later. On test-suite, only lencod.test and GCC-C-execute-pr44858.test
show a hash difference after this change. On lencod we see an
improvement (a loop phi is optimized away), on the GCC torture
test a regression (a function return value is determined only
after IPSCCP, preventing propagation from a noinline function.)

There are various regressions in InstSimplify tests. However, all
of these cases are already handled by InstCombine, and corresponding
tests have already been added there.

Differential Revision: https://reviews.llvm.org/D79294
2020-05-08 10:24:53 +02:00
..
Analysis Reapply [InstSimplify] Remove known bits constant folding 2020-05-08 10:24:53 +02:00
AsmParser Add IR constructs for preallocated (inalloca replacement) 2020-04-27 16:15:50 -07:00
BinaryFormat XCOFF.h - replace StringRef.h include with forward declaration. NFC. 2020-04-23 13:52:48 +01:00
Bitcode [BitcodeReader] Simplify raw attribute handling (NFC) 2020-04-30 18:47:14 +02:00
Bitstream [Bitcode] reserve in front of push_back loops. NFCI. 2020-05-01 15:52:53 +02:00
CodeGen [DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units. 2020-05-08 15:14:42 +07:00
DWARFLinker [DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units. 2020-05-08 15:14:42 +07:00
DebugInfo [DebugInfo] Fix handling DW_OP_call_ref in DWARF64 units. 2020-05-08 15:14:42 +07:00
Demangle Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
ExecutionEngine [ORC] Rename SearchOrder operations on JITDylib to LinkOrder. 2020-05-04 16:47:52 -07:00
Extensions Update compiler extension integration into the build system 2020-04-24 09:40:14 +02:00
Frontend [cmake] LLVMFrontendOpenMP - fix include/llvm/Frontend/OpenMP header path 2020-04-18 12:31:39 +01:00
FuzzMutate Remove CompositeType class. 2020-03-18 13:53:17 -07:00
Fuzzer
IR [SVE] Fix getAlignmentInfo for scalable vectors 2020-05-07 07:52:37 +01:00
IRReader
LTO [LTO] Suppress emission of empty combined module by default 2020-05-04 18:31:09 -07:00
LineEditor Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
Linker [SVE] Add new VectorType subclasses 2020-04-22 08:59:01 -07:00
MC [PowerPC] Fix missing GOT indirect variant kind 2020-05-06 05:50:56 -05:00
MCA [MCA] Fixed a bug where loads and stores were sometimes incorrectly marked as depedent. Fixes PR45793. 2020-05-05 10:25:36 +01:00
Object [Object] Remove unneeded check in ELFFile<ELFT>::dynamicEntries(). 2020-05-08 09:54:36 +08:00
ObjectYAML [PDB] Remove unique_ptr wrapper around C13 line table subsections 2020-05-02 16:35:07 -07:00
Option Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
Passes [llvm][NFC] Factor out inlining pipeline as a module pipeline. 2020-04-24 09:24:12 -07:00
ProfileData [InstrProf] Silence warnings when targeting x86 with VS2019 16.5.4 2020-05-06 09:12:00 -04:00
Remarks [cmake] Add headers in include/llvm/Remarks subdirectory 2020-05-07 16:43:29 +01:00
Support getMainExecutable: Fix hand-rolled AT_EXECPATH for older FreeBSD 2020-05-07 17:05:17 -04:00
TableGen [TableGen] Simplify with TGParser::consume() 2020-04-26 15:26:49 -07:00
Target [AMDGPU] Try to determine sign bit during div/rem expansion 2020-05-08 10:11:26 +02:00
Testing
TextAPI [cmake] Add headers in TextAPI/Elf and TextAPI/MachO subdirectories 2020-04-24 18:42:44 +01:00
ToolDrivers [ms] llvm-lib gives a more useful error if no inputs and no output path are provided 2020-05-01 07:43:32 -04:00
Transforms [LoopFusion] Remove unreachable blocks from DT and LI after fusion 2020-05-07 16:44:40 -07:00
WindowsManifest Try to fix WindowsManifest CMake logic on Windows 2020-02-28 17:24:03 -08:00
XRay [Object] Change ObjectFile::getSymbolValue() return type to Expected<uint64_t> 2020-05-02 14:04:44 +08:00
CMakeLists.txt Update compiler extension integration into the build system 2020-04-24 09:40:14 +02:00
LLVMBuild.txt Update compiler extension integration into the build system 2020-04-24 09:40:14 +02:00