diff options
author | Reid Kleckner <rnk@google.com> | 2016-06-24 18:42:58 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-06-24 18:42:58 +0000 |
commit | fbd5eef691f4d74317722dbf58016d07c14bedca (patch) | |
tree | 6883060814158a8950992550d459dee44ad2a8d8 /llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | |
parent | f8b08f7179bca3cac6ccb32c5f2c05a07ffabd9e (diff) | |
download | bcm5719-llvm-fbd5eef691f4d74317722dbf58016d07c14bedca.tar.gz bcm5719-llvm-fbd5eef691f4d74317722dbf58016d07c14bedca.zip |
Revert "InstCombine rule to fold trunc when value available"
This reverts commit r273608.
Broke building code with sanitizers, where apparently these kinds of
loads, casts, and truncations are common:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/24502
http://crbug.com/623099
llvm-svn: 273703
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 2aaf600c84b..dddcd0183b3 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -14,10 +14,9 @@ #include "InstCombineInternal.h" #include "llvm/ADT/SetVector.h" #include "llvm/Analysis/ConstantFolding.h" -#include "llvm/Analysis/Loads.h" -#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/PatternMatch.h" +#include "llvm/Analysis/TargetLibraryInfo.h" using namespace llvm; using namespace PatternMatch; @@ -577,24 +576,6 @@ Instruction *InstCombiner::visitTrunc(TruncInst &CI) { if (Instruction *I = foldVecTruncToExtElt(CI, *this, DL)) return I; - // When trunc operand is a widened load, see if we can get the value from a - // previous store/load - if (auto *LI = dyn_cast<LoadInst>(Src)) { - BasicBlock::iterator BBI(*LI); - - // Scan a few instructions up from LI and if we find a partial load/store - // of Type DestTy that feeds into LI, we can replace all uses of the trunc - // with the load/store value. - // This replacement can be done only in the case of non-volatile loads. If - // the load is atomic, its only use should be the trunc instruction. We - // don't want to allow other users of LI to see a value that is out of sync - // with the value we're folding the trunc to (in case of a race). - if (!LI->isVolatile() && (!LI->isAtomic() || LI->hasOneUse())) - if (Value *AvailableVal = FindAvailableLoadedValue( - LI->getPointerOperand(), DestTy, LI->isAtomic(), LI->getParent(), - BBI, DefMaxInstsToScan)) - return replaceInstUsesWith(CI, AvailableVal); - } return nullptr; } |