Skip to content

Commit cf49d07

Browse files
authored
Revert "[GVNSink] Fix incorrect codegen with respect to GEPs #85333" (#90658)
Reverts #88440 Test failing on Windows: https://lab.llvm.org/buildbot/#/builders/233/builds/9396 ``` Input file: <stdin> # | Check file: C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\Transforms\GVNSink\different-gep-types.ll # | # | -dump-input=help explains the following input dump. # | # | Input was: # | <<<<<< # | . # | . # | . # | 42: br label %if.end6 # | 43: # | 44: if.else5: ; preds = %if.else # | 45: br label %if.end6 # | 46: # | 47: if.end6: ; preds = %if.else5, %if.then3, %if.then # | next:67'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found # | next:67'1 with "IF_THEN" equal to "%if\\.then" # | next:67'2 with "IF_THEN3" equal to "%if\\.then3" # | next:67'3 with "IF_ELSE5" equal to "%if\\.else5" # | 48: %.sink1 = phi i32 [ -8, %if.then3 ], [ -4, %if.else5 ], [ 8, %if.then ] # | next:67'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # | next:67'4 ? possible intended match # | 49: %0 = load ptr, ptr %__i, align 4 # | next:67'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # | 50: %incdec.ptr4 = getelementptr inbounds i8, ptr %0, i32 %.sink1 # | next:67'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # | 51: store ptr %incdec.ptr4, ptr %__i, align 4 # | next:67'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # | 52: ret void # | next:67'0 ~~~~~~~~~~ # | 53: } # | next:67'0 ~~ # | >>>>>> # `----------------------------- # error: command failed with exit status: 1 ```
1 parent a1423ba commit cf49d07

File tree

2 files changed

+5
-105
lines changed

2 files changed

+5
-105
lines changed

llvm/lib/Transforms/Scalar/GVNSink.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,11 +719,12 @@ GVNSink::analyzeInstructionForSinking(LockstepReverseIterator &LRI,
719719
// try and continue making progress.
720720
Instruction *I0 = NewInsts[0];
721721

722-
auto isNotSameOperation = [&I0](Instruction *I) {
723-
return !I0->isSameOperationAs(I);
722+
// If all instructions that are going to participate don't have the same
723+
// number of operands, we can't do any useful PHI analysis for all operands.
724+
auto hasDifferentNumOperands = [&I0](Instruction *I) {
725+
return I->getNumOperands() != I0->getNumOperands();
724726
};
725-
726-
if (any_of(NewInsts, isNotSameOperation))
727+
if (any_of(NewInsts, hasDifferentNumOperands))
727728
return std::nullopt;
728729

729730
for (unsigned OpNum = 0, E = I0->getNumOperands(); OpNum != E; ++OpNum) {

llvm/test/Transforms/GVNSink/different-gep-types.ll

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)