llvm-project/llvm/lib
Philip Reames 37ead201e6 [runtime-unroll] Use incrementing IVs instead of decrementing ones
This is one of those wonderful "in theory X doesn't matter, but in practice is does" changes. In this particular case, we shift the IVs inserted by the runtime unroller to clamp iteration count of the loops* from decrementing to incrementing.

Why does this matter?  A couple of reasons:
* SCEV doesn't have a native subtract node.  Instead, all subtracts (A - B) are represented as A + -1 * B and drops any flags invalidated by such.  As a result, SCEV is slightly less good at reasoning about edge cases involving decrementing addrecs than incrementing ones.  (You can see this in the inferred flags in some of the test cases.)
* Other parts of the optimizer produce incrementing IVs, and they're common in idiomatic source language.  We do have support for reversing IVs, but in general if we produce one of each, the pair will persist surprisingly far through the optimizer before being coalesced.  (You can see this looking at nearby phis in the test cases.)

Note that if the hardware prefers decrementing (i.e. zero tested) loops, LSR should convert back immediately before codegen.

* Mostly irrelevant detail: The main loop of the prolog case is handled independently and will simple use the original IV with a changed start value.  We could in theory use this scheme for all iteration clamping, but that's a larger and more invasive change.
2021-11-12 15:44:58 -08:00
..
Analysis [SCEV] Update SCEVLoopGuardRewriter to take SCEV -> SCEV map (NFC). 2021-11-12 18:16:03 +00:00
AsmParser Revert "[DebugInfo] Enforce implicit constraints on `distinct` MDNodes" 2021-11-09 14:27:55 -08:00
BinaryFormat [llvm][clang][NFC] updates inline licence info 2021-08-11 02:48:53 +00:00
Bitcode [DebugInfo] run clang-format on some unformatted files 2021-11-11 18:59:41 -08:00
Bitstream
CodeGen [CodeGen] Use SDNode::uses (NFC) 2021-11-12 07:33:29 -08:00
DWARFLinker Move TargetRegistry.(h|cpp) from Support to MC 2021-10-08 14:51:48 -07:00
DWP [DWP] Refactoring llvm-dwp in to a library part 2 2021-07-22 14:23:29 -07:00
DebugInfo llvm-dwarfdump: Lookup type units when prettyprinting types 2021-11-09 16:58:22 -08:00
Demangle Fix memory leak in D demangler 2021-11-09 16:08:14 -08:00
ExecutionEngine [JITLink] Fix think-o in handwritten CWrapperFunctionResult -> Error converter. 2021-11-12 10:36:17 -08:00
Extensions
FileCheck [llvm] Use StringRef::contains (NFC) 2021-10-23 08:45:27 -07:00
Frontend Move TargetRegistry.(h|cpp) from Support to MC 2021-10-08 14:51:48 -07:00
FuzzMutate
Fuzzer
IR [DebugInfo] run clang-format on some unformatted files 2021-11-11 18:59:41 -08:00
IRReader
InterfaceStub [llvm] Use StringRef::contains (NFC) 2021-10-23 08:45:27 -07:00
LTO [NewPM] Use the default AA pipeline by default 2021-11-04 15:10:34 -07:00
LineEditor
Linker [llvm] Use make_early_inc_range (NFC) 2021-11-05 19:39:07 -07:00
MC [llvm] Use llvm::reverse (NFC) 2021-11-06 19:31:18 -07:00
MCA [MCA] Fix a warning 2021-09-20 09:46:38 -07:00
Object Extend obj2yaml to optionally preserve raw __LINKEDIT/__DATA segments. 2021-11-08 11:30:12 -08:00
ObjectYAML Reland [XCOFF][yaml2obj] support for the auxiliary file header. 2021-11-10 07:23:56 +00:00
Option [llvm/OptTable] Add named param comment for GroupedShortOption 2021-09-27 11:33:29 -04:00
Passes [NFC] Rename GVN -> GVNPass and SROA -> SROAPass 2021-11-09 10:35:58 -08:00
ProfileData [compiler-rt] Fix diagnostic in InstrProfError 2021-11-09 20:30:03 +00:00
Remarks
Support [Support] [VirtualFileSystem] Detect the windows_slash path style 2021-11-08 22:21:29 +02:00
TableGen [Tablegen] Collect all global state into one managed static 2021-11-09 01:24:54 +00:00
Target [RISCV] Improve codegen for i32 udiv/urem by constant on RV64. 2021-11-12 14:49:10 -08:00
Testing
TextAPI [llvm] Use drop_begin (NFC) 2021-09-16 08:46:26 -07:00
ToolDrivers [Type] Avoid APFloat.h include (NFC) 2021-10-09 11:29:26 +02:00
Transforms [runtime-unroll] Use incrementing IVs instead of decrementing ones 2021-11-12 15:44:58 -08:00
WindowsManifest Make WindowsManifestMerger::merge() take a MemoryBufferRef 2021-08-24 16:39:20 -04:00
XRay Support: Use Expected<T>::moveInto() in a few places 2021-10-22 12:40:10 -07:00
CMakeLists.txt [DWP] Refactoring llvm-dwp in to a library part 2 2021-07-22 14:23:29 -07:00