llvm-project/llvm/lib
David Green ffc922ec35 [LSR] Attempt to increase the accuracy of LSR's setup cost
In some loops, we end up generating loop induction variables that look like:
  {(-1 * (zext i16 (%i0 * %i1) to i32))<nsw>,+,1}
As opposed to the simpler:
  {(zext i16 (%i0 * %i1) to i32),+,-1}
i.e we count up from -limit to 0, not the simpler counting down from limit to
0. This is because the scores, as LSR calculates them, are the same and the
second is filtered in place of the first. We end up with a redundant SUB from 0
in the code.

This patch tries to make the calculation of the setup cost a little more
thoroughly, recursing into the scev members to better approximate the setup
required. The cost function for comparing LSR costs is:

return std::tie(C1.NumRegs, C1.AddRecCost, C1.NumIVMuls, C1.NumBaseAdds,
                C1.ScaleCost, C1.ImmCost, C1.SetupCost) <
       std::tie(C2.NumRegs, C2.AddRecCost, C2.NumIVMuls, C2.NumBaseAdds,
                C2.ScaleCost, C2.ImmCost, C2.SetupCost);
So this will only alter results if none of the other variables turn out to be
different.

Differential Revision: https://reviews.llvm.org/D58770

llvm-svn: 355597
2019-03-07 13:44:40 +00:00
..
Analysis [IDF] Delete a redundant J-edge test 2019-03-07 11:42:59 +00:00
AsmParser Implementation of asm-goto support in LLVM 2019-02-08 20:48:56 +00:00
BinaryFormat [WebAssembly] clang-tidy (NFC) 2019-02-04 19:13:39 +00:00
Bitcode Implementation of asm-goto support in LLVM 2019-02-08 20:48:56 +00:00
CodeGen [PS4] Emit a trap after a stack-protector fail call. 2019-03-06 19:57:43 +00:00
DebugInfo [DWARFFormValue] Don't consider DW_FORM_data4/8 to be section offsets. 2019-03-05 23:47:22 +00:00
Demangle Add missing include (cstdlib) to Demangle.h 2019-01-22 19:18:18 +00:00
ExecutionEngine Add newline to interpreter debugging output 2019-03-07 10:14:38 +00:00
FuzzMutate [opaque pointer types] Pass value type to LoadInst creation. 2019-02-01 20:44:24 +00:00
Fuzzer
IR [IR][ARM] Add function pointer alignment to datalayout 2019-03-07 09:15:23 +00:00
IRReader [IRReader] Expose getLazyIRModule 2019-02-11 22:01:13 +00:00
LTO Reland "[Remarks] Refactor remark diagnostic emission in a RemarkStreamer" 2019-03-06 15:20:13 +00:00
LineEditor Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Linker Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MC [MC][MachO] Emit an error for emitting relocations of the form -SYM + cst 2019-03-06 18:10:41 +00:00
MCA [MCA] Highlight kernel bottlenecks in the summary view. 2019-03-04 11:52:34 +00:00
Object [llvm-objdump] Should print unknown d_tag in hex format 2019-03-02 04:20:28 +00:00
ObjectYAML [yaml2obj] - Allow producing ELFDATANONE ELFs 2019-03-07 12:09:19 +00:00
Option Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Passes [PGO] Context sensitive PGO (part 3) 2019-03-04 20:21:27 +00:00
ProfileData [PGO] Context sensitive PGO (part 4) 2019-03-06 19:31:37 +00:00
Remarks [Remarks][NFC] Rename RemarkParser to YAMLRemarkParser 2019-03-05 20:50:35 +00:00
Support [llvm] [Support] Revert "Reimplement getMainExecutable() using sysctl on NetBSD" 2019-03-04 04:53:50 +00:00
TableGen TableGen: Allow lists to be concatenated through '#' 2019-03-05 17:16:07 +00:00
Target [MIPS GlobalISel] Fix mul operands 2019-03-07 13:28:29 +00:00
Testing Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TextAPI Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ToolDrivers [llvm-ar][libObject] Fix relative paths when nesting thin archives. 2019-02-13 23:39:41 +00:00
Transforms [LSR] Attempt to increase the accuracy of LSR's setup cost 2019-03-07 13:44:40 +00:00
WindowsManifest Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
XRay Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt [OptRemarks] Make OptRemarks more generic: rename OptRemarks to Remarks 2019-03-05 20:45:17 +00:00
LLVMBuild.txt [OptRemarks] Make OptRemarks more generic: rename OptRemarks to Remarks 2019-03-05 20:45:17 +00:00