diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2014-10-21 09:00:40 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2014-10-21 09:00:40 +0000 |
| commit | aa72a6dd3bd1a880e30c76545cdbb8928c104cd4 (patch) | |
| tree | c9da6a60184c829830e1bab1a4fc246e21d221fd /llvm/lib/Transforms/InstCombine | |
| parent | 592239d498c97c25d06eb76dad662df58c49a9b0 (diff) | |
| download | bcm5719-llvm-aa72a6dd3bd1a880e30c76545cdbb8928c104cd4.tar.gz bcm5719-llvm-aa72a6dd3bd1a880e30c76545cdbb8928c104cd4.zip | |
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.
llvm-svn: 220277
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index 3557ad72f49..95ca1a6ff7a 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -417,7 +417,8 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { BasicBlock::iterator BBI = &LI; if (Value *AvailableVal = FindAvailableLoadedValue(Op, LI.getParent(), BBI,6)) return ReplaceInstUsesWith( - LI, Builder->CreateBitCast(AvailableVal, LI.getType())); + LI, Builder->CreateBitOrPointerCast(AvailableVal, LI.getType(), + LI.getName() + ".cast")); // load(gep null, ...) -> unreachable if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(Op)) { |

