Teach the load analysis to allow finding available values which require
authorChandler Carruth <chandlerc@gmail.com>
Tue, 21 Oct 2014 09:00:40 +0000 (09:00 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 21 Oct 2014 09:00:40 +0000 (09:00 +0000)
commit9156c5e3baecd6b6c147a1fd29b2391a80b931ac
tree25dca62bdb4349f4e3fd8888e3ce7100b84e481e
parent59e16813d27a65aef976e0d1c9402ae149d00c73
Teach the load analysis to allow finding available values which require
inttoptr or ptrtoint cast provided there is datalayout available.
Eventually, the datalayout can just be required but in practice it will
always be there today.

To go with the ability to expose available values requiring a ptrtoint
or inttoptr cast, helpers are added to perform one of these three casts.

These smarts are necessary to finish canonicalizing loads and stores to
the operational type requirements without regressing fundamental
combines.

I've added some test cases. These should actually improve as the load
combining and store combining improves, but they may fundamentally be
highlighting some missing combines for select in addition to exercising
the specific added logic to load analysis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220277 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/IRBuilder.h
include/llvm/IR/InstrTypes.h
lib/Analysis/Loads.cpp
lib/IR/Instructions.cpp
lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
lib/Transforms/Scalar/JumpThreading.cpp
test/Transforms/InstCombine/select.ll