diff options
author | Jin-Gu Kang <jaykang10@imrc.kist.re.kr> | 2011-03-14 01:21:00 +0000 |
---|---|---|
committer | Jin-Gu Kang <jaykang10@imrc.kist.re.kr> | 2011-03-14 01:21:00 +0000 |
commit | b452db02f00ed0fce2247e1d125b4e49cdf1c2c3 (patch) | |
tree | fd46cbaf073cbdb96afc6e53dad60f5ba6451b0e /llvm/lib | |
parent | 9ba8fb1e48baba536621d544da1299df83847548 (diff) | |
download | bcm5719-llvm-b452db02f00ed0fce2247e1d125b4e49cdf1c2c3.tar.gz bcm5719-llvm-b452db02f00ed0fce2247e1d125b4e49cdf1c2c3.zip |
This case is solved by Scalar Replacement of Aggregates (DT) and
Early CSE pass so this patch reverts it to original source code.
llvm-svn: 127574
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp index e5ff00fc1dc..35c1d91d501 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp @@ -429,31 +429,9 @@ Instruction *InstCombiner::visitStoreInst(StoreInst &SI) { // the pointer we're loading and is producing the pointer we're storing, // then *this* store is dead (X = load P; store X -> P). if (LoadInst *LI = dyn_cast<LoadInst>(BBI)) { - if (equivalentAddressValues(LI->getOperand(0), Ptr) && - !SI.isVolatile()) { - if (LI == Val) - return EraseInstFromFunction(SI); - // load and store reference same memory location, the memory location - // is represented by getelementptr with two uses (load and store) and - // the getelementptr's base is alloca with single use. At this point, - // instructions from alloca to store can be removed. - // (this pattern is generated when bitfield is accessed.) - // For example, - // %u = alloca %struct.test, align 4 ; [#uses=1] - // %0 = getelementptr inbounds %struct.test* %u, i32 0, i32 0;[#uses=2] - // %1 = load i8* %0, align 4 ; [#uses=1] - // %2 = and i8 %1, -16 ; [#uses=1] - // %3 = or i8 %2, 5 ; [#uses=1] - // store i8 %3, i8* %0, align 4 - if (Ptr->hasNUses(2)) { - if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Ptr)) { - if (isa<AllocaInst>(GEP->getOperand(0))) { - if (GEP->getOperand(0)->hasOneUse()) - return EraseInstFromFunction(SI); - } - } - } - } + if (LI == Val && equivalentAddressValues(LI->getOperand(0), Ptr) && + !SI.isVolatile()) + return EraseInstFromFunction(SI); // Otherwise, this is a load from some other location. Stores before it // may not be dead. |