Index: lib/Transforms/Scalar/GVN.cpp =================================================================== --- lib/Transforms/Scalar/GVN.cpp +++ lib/Transforms/Scalar/GVN.cpp @@ -1733,12 +1733,13 @@ } // If this load follows a GEP, see if we can PRE the indices before analyzing. + bool Changed = false; if (GetElementPtrInst *GEP = dyn_cast(LI->getOperand(0))) { for (GetElementPtrInst::op_iterator OI = GEP->idx_begin(), OE = GEP->idx_end(); OI != OE; ++OI) if (Instruction *I = dyn_cast(OI->get())) - performScalarPRE(I); + Changed |= performScalarPRE(I); } // Step 2: Analyze the availability of the load @@ -1749,7 +1750,7 @@ // If we have no predecessors that produce a known value for this load, exit // early. if (ValuesPerBlock.empty()) - return false; + return Changed; // Step 3: Eliminate fully redundancy. // @@ -1777,9 +1778,10 @@ // Step 4: Eliminate partial redundancy. if (!EnablePRE || !EnableLoadPRE) - return false; + return Changed; - return PerformLoadPRE(LI, ValuesPerBlock, UnavailableBlocks); + Changed |= PerformLoadPRE(LI, ValuesPerBlock, UnavailableBlocks); + return Changed; } bool GVN::processAssumeIntrinsic(IntrinsicInst *IntrinsicI) {