llvm-project/llvm/test
Zhongduo Lin eae228a292 [IndVarSimplify] Extend previous special case for load use instruction to any narrow type loop variant to avoid extra trunc instruction
Summary:
The widenIVUse avoids generating trunc by evaluating the use as AddRec, this
will not work when:
   1) SCEV traces back to an instruction inside the loop that SCEV can not
expand, eg. add %indvar, (load %addr)
   2) SCEV finds a loop variant, eg. add %indvar, %loopvariant

While SCEV fails to avoid trunc, we can still try to use instruction
combining approach to prove trunc is not required. This can be further
extended with other instruction combining checks, but for now we handle the
following case (sub can be "add" and "mul", "nsw + sext" can be "nus + zext")
```
Src:
  %c = sub nsw %b, %indvar
  %d = sext %c to i64
Dst:
  %indvar.ext1 = sext %indvar to i64
  %m = sext %b to i64
  %d = sub nsw i64 %m, %indvar.ext1
```
Therefore, as long as the result of add/sub/mul is extended to wide type with
right extension and overflow wrap combination, no
trunc is required regardless of how %b is generated. This pattern is common
when calculating address in 64 bit architecture.

Note that this patch reuse almost all the code from D49151 by @az:
https://reviews.llvm.org/D49151

It extends it by providing proof of why trunc is unnecessary in more general case,
it should also resolve some of the concerns from the following discussion with @reames.

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180910/585945.html

Reviewers: sanjoy, efriedma, sebpop, reames, az, javed.absar, amehsan

Reviewed By: az, amehsan

Subscribers: hiraditya, llvm-commits, amehsan, reames, az

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73059
2020-03-05 16:27:59 -05:00
..
Analysis [ARM] Change all tests from "thumbv8.1-m.main" to "thumbv8.1m.main". NFC 2020-03-04 13:47:35 +00:00
Assembler Reland "[DebugInfo][clang][DWARF5]: Added support for debuginfo generation for defaulted parameters 2020-03-02 16:45:48 +05:30
Bindings Revert "Rework go bindings so that validation works fine" 2020-02-24 09:20:08 -08:00
Bitcode Revert "Restore "[WPD/LowerTypeTests] Delay lowering/removal of type tests until after ICP"" 2020-03-02 14:02:13 -08:00
BugPoint
CodeGen [AArch64][GlobalISel] Avoid copies to target register bank for subregister copies 2020-03-05 11:13:02 -08:00
DebugInfo Fix typos in comment marks. 2020-03-05 20:01:45 +07:00
Demangle
Examples
ExecutionEngine [JITLink] Add a -slab-address option to llvm-jitlink. 2020-03-03 14:25:51 -08:00
Feature Remove no un-necessary require for load_extension.ll 2020-02-26 08:29:09 +01:00
FileCheck
Instrumentation Reland: [Coverage] Revise format to reduce binary size 2020-02-28 18:12:04 -08:00
Integer
JitListener
LTO [LTO][Legacy] Add new API to query Mach-O CPU (sub)type 2020-02-28 12:56:05 -08:00
Linker Remove lit feature object-emission 2020-02-10 15:57:56 -06:00
MC [llvm-objdump] --syms: make flags closer to GNU objdump 2020-03-05 09:59:53 -08:00
MachineVerifier Revert "Revert "Reland "[Support] make report_fatal_error `abort` instead of `exit`""" 2020-02-13 10:16:06 -08:00
Object [llvm-readobj] - Report warnings instead of errors for broken relocations. 2020-02-29 12:50:32 +03:00
ObjectYAML
Other [PassManager] adjust VectorCombine placement 2020-03-04 11:10:49 -05:00
Reduce
SafepointIRVerifier
Support
SymbolRewriter
TableGen TableGen: Fix logic for default operands 2020-02-19 23:41:07 -05:00
ThinLTO/X86 Revert "Restore "[WPD/LowerTypeTests] Delay lowering/removal of type tests until after ICP"" 2020-03-02 14:02:13 -08:00
Transforms [IndVarSimplify] Extend previous special case for load use instruction to any narrow type loop variant to avoid extra trunc instruction 2020-03-05 16:27:59 -05:00
Unit
Verifier More principled implementation of DISubprogram::describes() 2020-03-02 10:03:14 -08:00
YAMLParser
tools [llvm-objdump] --syms: make flags closer to GNU objdump 2020-03-05 09:59:53 -08:00
.clang-format
CMakeLists.txt Revert abb00753 "build: reduce CMake handling for zlib" (PR44780) 2020-03-03 11:03:09 +01:00
TestRunner.sh
lit.cfg.py Revert "Rework go bindings so that validation works fine" 2020-02-24 09:20:08 -08:00
lit.site.cfg.py.in Revert abb00753 "build: reduce CMake handling for zlib" (PR44780) 2020-03-03 11:03:09 +01:00