Can't check for lifetime end in GVN pass

I’ve been working on bug 20811 and have been stuck for some time now. I made the following changes to the GVN.cpp file, but these changes have not been able to fix the issue, i.e., the load is still not replaced with undef

Added function:

static bool isLifetimeEnd(const Instruction *Inst) {
  if (const IntrinsicInst* II = dyn_cast<IntrinsicInst>(Inst))
    return II->getIntrinsicID() == Intrinsic::lifetime_end;
  return false;

And modified the following line:

if (isa<AllocaInst>(DepInst) || isMallocLikeFn(DepInst, TLI) ||
    isLifetimeStart(DepInst) || isLifetimeEnd(DepInst)) { <-- added isLifetimeEnd()
  Res = AvailableValue::get(UndefValue::get(LI->getType()));
  return true;

Link to the bug: [](