diff options
author | Vlad Tsyrklevich <vlad@tsyrklevich.net> | 2019-07-25 15:37:57 +0000 |
---|---|---|
committer | Vlad Tsyrklevich <vlad@tsyrklevich.net> | 2019-07-25 15:37:57 +0000 |
commit | 5d5a58317cb2512d18d608a97a3a948e708c59e0 (patch) | |
tree | cf61f8c17f0db5389ffed38a811283c8e9fe5ab2 /llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | |
parent | c0d0e3bda8ebfb24e84250188f852dc2409928cc (diff) | |
download | bcm5719-llvm-5d5a58317cb2512d18d608a97a3a948e708c59e0.tar.gz bcm5719-llvm-5d5a58317cb2512d18d608a97a3a948e708c59e0.zip |
Revert "[InstCombine] try to narrow a truncated load"
This reverts commit bc4a63fd3c29c1a8ce22891bf34ee4dccfef578c, this is a
speculative revert to fix a number of sanitizer bots (like
sanitizer-x86_64-linux-bootstrap-ubsan) that have started to see stage2
compiler crashes, presumably due to a miscompile.
llvm-svn: 367029
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 08a7a068af2..2c9ba203fbf 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -681,42 +681,6 @@ static Instruction *shrinkInsertElt(CastInst &Trunc, return nullptr; } -static Instruction *narrowLoad(TruncInst &Trunc, - InstCombiner::BuilderTy &Builder, - const DataLayout &DL) { - // Check the layout to ensure we are not creating an unsupported operation. - // TODO: Create a GEP to offset the load? - if (!DL.isLittleEndian()) - return nullptr; - unsigned NarrowBitWidth = Trunc.getDestTy()->getPrimitiveSizeInBits(); - if (!DL.isLegalInteger(NarrowBitWidth)) - return nullptr; - - // Match a truncated load with no other uses. - Value *X; - if (!match(Trunc.getOperand(0), m_OneUse(m_Load(m_Value(X))))) - return nullptr; - LoadInst *WideLoad = cast<LoadInst>(Trunc.getOperand(0)); - if (!WideLoad->isSimple()) - return nullptr; - - // Don't narrow this load if we would lose information about the - // dereferenceable range. - bool CanBeNull; - uint64_t DerefBits = X->getPointerDereferenceableBytes(DL, CanBeNull) * 8; - if (DerefBits < WideLoad->getType()->getPrimitiveSizeInBits()) - return nullptr; - - // trunc (load X) --> load (bitcast X) - PointerType *PtrTy = PointerType::get(Trunc.getDestTy(), - WideLoad->getPointerAddressSpace()); - Value *Bitcast = Builder.CreatePointerCast(X, PtrTy); - LoadInst *NarrowLoad = new LoadInst(Trunc.getDestTy(), Bitcast); - NarrowLoad->setAlignment(WideLoad->getAlignment()); - copyMetadataForLoad(*NarrowLoad, *WideLoad); - return NarrowLoad; -} - Instruction *InstCombiner::visitTrunc(TruncInst &CI) { if (Instruction *Result = commonCastTransforms(CI)) return Result; @@ -876,9 +840,6 @@ Instruction *InstCombiner::visitTrunc(TruncInst &CI) { if (Instruction *I = foldVecTruncToExtElt(CI, *this)) return I; - if (Instruction *NewLoad = narrowLoad(CI, Builder, DL)) - return NewLoad; - return nullptr; } |