1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 05:23:45 +02:00
llvm-mirror/lib/Transforms/InstCombine
Silviu Baranga 93f7373429 Re-commit r257064, this time with a fixed assert
In setInsertionPoint if the value is not a PHI, Instruction or
Argument it should be a Constant, not a ConstantExpr.

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: 257164
2016-01-08 11:11:04 +00:00
..
CMakeLists.txt
InstCombineAddSub.cpp [InstCombine] Fix indentation. NFC. 2015-12-21 01:02:28 +00:00
InstCombineAndOrXor.cpp getParent() ^ 3 == getModule() ; NFCI 2015-12-14 17:24:23 +00:00
InstCombineCalls.cpp [Statepoints] Refactor GCRelocateOperands into an intrinsic wrapper. NFC. 2016-01-05 04:03:00 +00:00
InstCombineCasts.cpp fix formatting; NFC 2015-12-30 18:31:30 +00:00
InstCombineCompares.cpp Re-commit r257064, this time with a fixed assert 2016-01-08 11:11:04 +00:00
InstCombineInternal.h fix typo; NFC 2016-01-06 00:23:12 +00:00
InstCombineLoadStoreAlloca.cpp [OperandBundles] Have InstCombine play nice with operand bundles 2015-12-23 09:58:41 +00:00
InstCombineMulDivRem.cpp InstCombine: Remove ilist iterator implicit conversions, NFC 2015-10-13 16:59:33 +00:00
InstCombinePHI.cpp [InstCombine] Teach FoldPHIArgZextsIntoPHI about EHPads 2015-11-07 00:52:53 +00:00
InstCombineSelect.cpp [InstCombine] Call getCmpPredicateForMinMax only with a valid SPF 2015-12-05 23:44:22 +00:00
InstCombineShifts.cpp don't repeat function names in comments; NFC 2015-11-02 22:34:55 +00:00
InstCombineSimplifyDemanded.cpp [InstCombine] Teach SimplifyDemandedVectorElts how to handle ConstantVector select masks with ConstantExpr elements (PR24922) 2015-10-06 10:34:53 +00:00
InstCombineVectorOps.cpp [InstCombine] insert a new shuffle in a safe place (PR25999) 2016-01-08 01:39:16 +00:00
InstructionCombining.cpp [InstructionCombining] prepareICWorklistFromFunction halts in infinite loop with instructions of token type 2016-01-04 23:28:57 +00:00
LLVMBuild.txt
Makefile