Revert r220349 to re-instate r220277 with a fix for PR21330 -- quite
authorChandler Carruth <chandlerc@gmail.com>
Tue, 25 Nov 2014 08:20:27 +0000 (08:20 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 25 Nov 2014 08:20:27 +0000 (08:20 +0000)
commita87c35420be5178e39b87f076c5dfd93ffa727f4
tree14a2f385c181de302f812d3f2f96b7222c298010
parent87926dfe7efbb3f01ef6f71becce3837b758aac5
Revert r220349 to re-instate r220277 with a fix for PR21330 -- quite
clearly only exactly equal width ptrtoint and inttoptr casts are no-op
casts, it says so right there in the langref. Make the code agree.

Original log from r220277:
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@222739 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