Skip to content

Commit

Permalink
Revert "[SimplifyCFG] Check if the return instruction causes undefine…
Browse files Browse the repository at this point in the history
…d behavior"

This reverts commit b6a0be8.
  • Loading branch information
DianQK committed Mar 19, 2023
1 parent c6e54c7 commit 6505b9d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 136 deletions.
14 changes: 0 additions & 14 deletions llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Expand Up @@ -7115,20 +7115,6 @@ static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I, bool PtrValu
return passingValueIsAlwaysUndefined(V, GEP, PtrValueMayBeModified);
}

// Look through return.
if (ReturnInst *Ret = dyn_cast<ReturnInst>(Use)) {
bool HasNoUndefAttr =
Ret->getFunction()->hasRetAttribute(Attribute::NoUndef);
// Return undefined to a noundef return value is undefined.
if (isa<UndefValue>(C) && HasNoUndefAttr)
return true;
// Return null to a nonnull+noundef return value is undefined.
if (C->isNullValue() && HasNoUndefAttr &&
Ret->getFunction()->hasRetAttribute(Attribute::NonNull)) {
return !PtrValueMayBeModified;
}
}

// Look through bitcasts.
if (BitCastInst *BC = dyn_cast<BitCastInst>(Use))
return passingValueIsAlwaysUndefined(V, BC, PtrValueMayBeModified);
Expand Down
122 changes: 0 additions & 122 deletions llvm/test/Transforms/SimplifyCFG/unreachable-eliminate-on-ret.ll

This file was deleted.

0 comments on commit 6505b9d

Please sign in to comment.