llvm-project/llvm/test
Silviu Baranga f29dfd36bb Re-commit r257064, after it was reverted in r257340.
This contains a fix for the issue that caused the revert:
we no longer assume that we can insert instructions after the
instruction that produces the base pointer. We previously
assumed that this would be ok, because the instruction produces
a value and therefore is not a terminator. This is false for invoke
instructions. We will now insert these new instruction directly
at the location of the users.

Original commit message:

[InstCombine] Look through PHIs, GEPs, IntToPtrs and PtrToInts to expose more constants when comparing GEPs

Summary:
When comparing two GEP instructions which have the same base pointer
and one of them has a constant index, it is possible to only compare
indices, transforming it to a compare with a constant. This removes
one use for the GEP instruction with the constant index, can reduce
register pressure and can sometimes lead to removing the comparisson
entirely.

InstCombine was already doing this when comparing two GEPs if the base
pointers were the same. However, in the case where we have complex
pointer arithmetic (GEPs applied to GEPs, PHIs of GEPs, conversions to
or from integers, etc) the value of the original base pointer will be
hidden to the optimizer and this transformation will be disabled.

This change detects when the two sides of the comparison can be
expressed as GEPs with the same base pointer, even if they don't
appear as such in the IR. The transformation will convert all the
pointer arithmetic to arithmetic done on indices and all the relevant
uses of GEPs to GEPs with a common base pointer. The GEP comparison
will be converted to a comparison done on indices.

Reviewers: majnemer, jmolloy

Subscribers: hfinkel, jevinskie, jmolloy, aadg, llvm-commits

Differential Revision: http://reviews.llvm.org/D15146

llvm-svn: 257897
2016-01-15 15:52:05 +00:00
..
Analysis Revert "[ValueTracking] Understand more select patterns in ComputeKnownBits" 2016-01-14 15:49:32 +00:00
Assembler [ConstantFold] Fix bitcast to gep constant folding transform. 2015-12-14 19:30:32 +00:00
Bindings Deprecate a few C APIs. 2015-12-18 23:46:42 +00:00
Bitcode [WinEH] Verify unwind edges against EH pad tree 2016-01-10 04:28:38 +00:00
BugPoint [bugpoint] Add a named metadata (+their operands) reducer 2015-11-06 00:12:50 +00:00
CodeGen [Hexagon] Generate CONST64 when optimizing for size in copy-to-combine 2016-01-15 14:08:31 +00:00
DebugInfo Reapply r257105 "[Verifier] Check that debug values have proper size" 2016-01-15 00:46:17 +00:00
Examples
ExecutionEngine [Orc] Add support for EH-frame registration to the Orc Remote Target utility 2016-01-14 22:02:03 +00:00
Feature [WinEH] Verify unwind edges against EH pad tree 2016-01-10 04:28:38 +00:00
FileCheck
Instrumentation [sanitizer] [msan] Fix origin store of array types 2016-01-11 19:55:27 +00:00
Integer
JitListener Fix several accidental DOS line endings in source files 2016-01-03 17:22:03 +00:00
LTO Add InaccessibleMemOnly and inaccessibleMemOrArgMemOnly attributes 2015-12-16 16:16:19 +00:00
LibDriver
Linker Reapply r257105 "[Verifier] Check that debug values have proper size" 2016-01-15 00:46:17 +00:00
MC [ARM] Add DSP build attribute and extension targeting 2016-01-15 10:28:25 +00:00
Object Handle archives with paths in the names. 2015-12-18 16:07:17 +00:00
Other Recommit r256952 "Filtering IR printing for print-after-all/print-before-all" 2016-01-06 22:55:03 +00:00
SymbolRewriter
TableGen Add test cases that will show the bug that was fixed in r256725. 2016-01-13 07:53:11 +00:00
Transforms Re-commit r257064, after it was reverted in r257340. 2016-01-15 15:52:05 +00:00
Unit
Verifier [WinEH] Fix catchpad pred verification 2016-01-10 04:32:03 +00:00
YAMLParser
tools [ARM] Add DSP build attribute and extension targeting 2016-01-15 10:28:25 +00:00
.clang-format
CMakeLists.txt [llvm-dwp] Add missing dependency from llvm tests on the llvm-dwp tool 2015-12-01 00:57:05 +00:00
Makefile check-llvm: Tweak the feature "timestamps" for autoconf. 2015-12-21 08:46:12 +00:00
Makefile.tests
TestRunner.sh
lit.cfg [llvm-symbolizer] -print-source-context-lines option to print source code around the line. 2016-01-09 00:14:35 +00:00
lit.site.cfg.in Make WinCOFFObjectWriter.cpp's timestamp writing not use ENABLE_TIMESTAMPS 2016-01-06 19:05:19 +00:00