Skip to content

Revert "[GVNSink] Fix incorrect codegen with respect to GEPs #85333" #90658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions llvm/lib/Transforms/Scalar/GVNSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,11 +719,12 @@ GVNSink::analyzeInstructionForSinking(LockstepReverseIterator &LRI,
// try and continue making progress.
Instruction *I0 = NewInsts[0];

auto isNotSameOperation = [&I0](Instruction *I) {
return !I0->isSameOperationAs(I);
// If all instructions that are going to participate don't have the same
// number of operands, we can't do any useful PHI analysis for all operands.
auto hasDifferentNumOperands = [&I0](Instruction *I) {
return I->getNumOperands() != I0->getNumOperands();
};

if (any_of(NewInsts, isNotSameOperation))
if (any_of(NewInsts, hasDifferentNumOperands))
return std::nullopt;

for (unsigned OpNum = 0, E = I0->getNumOperands(); OpNum != E; ++OpNum) {
Expand Down
101 changes: 0 additions & 101 deletions llvm/test/Transforms/GVNSink/different-gep-types.ll

This file was deleted.

Loading