diff options
author | Philip Reames <listmail@philipreames.com> | 2016-01-25 23:37:53 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2016-01-25 23:37:53 +0000 |
commit | 273dcb0d820d095e67c1af2e443dbe0dc3ad3763 (patch) | |
tree | 655822bdc8bdc16020aec6df0ab3580fc64b5c7d /llvm/lib/Transforms/Scalar/GVN.cpp | |
parent | fbc3da577ce5b26f82c4210fb5f949e20ea253a6 (diff) | |
download | bcm5719-llvm-273dcb0d820d095e67c1af2e443dbe0dc3ad3763.tar.gz bcm5719-llvm-273dcb0d820d095e67c1af2e443dbe0dc3ad3763.zip |
[GVN] Rearrange code to make local vs non-local cases more obvious [NFCI]
llvm-svn: 258747
Diffstat (limited to 'llvm/lib/Transforms/Scalar/GVN.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index e0b1c9d2535..bbffbb0be75 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1895,6 +1895,23 @@ bool GVN::processLoad(LoadInst *L) { MemDepResult Dep = MD->getDependency(L); const DataLayout &DL = L->getModule()->getDataLayout(); + // If it is defined in another block, try harder. + if (Dep.isNonLocal()) + return processNonLocalLoad(L); + + // Only handle the local case below + if (!Dep.isDef() && !Dep.isClobber()) { + // This might be a NonFuncLocal or an Unknown + DEBUG( + // fast print dep, using operator<< on instruction is too slow. + dbgs() << "GVN: load "; + L->printAsOperand(dbgs()); + dbgs() << " has unknown dependence\n"; + ); + return false; + } + + // If we have a clobber and target data is around, see if this is a clobber // that we can fix up through code synthesis. if (Dep.isClobber()) { @@ -1966,19 +1983,7 @@ bool GVN::processLoad(LoadInst *L) { return false; } - // If it is defined in another block, try harder. - if (Dep.isNonLocal()) - return processNonLocalLoad(L); - - if (!Dep.isDef()) { - DEBUG( - // fast print dep, using operator<< on instruction is too slow. - dbgs() << "GVN: load "; - L->printAsOperand(dbgs()); - dbgs() << " has unknown dependence\n"; - ); - return false; - } + assert(Dep.isDef() && "expected from control flow"); Instruction *DepInst = Dep.getInst(); Value *AvailableValue = nullptr; |