Shreyansh Chouhan via llvm-dev
2019-Aug-20  08:36 UTC
[llvm-dev] 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: https://bugs.llvm.org/show_bug.cgi?id=20811
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20190820/58f1b59b/attachment.html>