Skip to content

Commit 355aee3

Browse files
committed
Revert "[IR][LoopRotate] avoid leaving phi with no operands (PR48296)"
This reverts commit bfd2c21. This appears to be causing stage2 msan failures on buildbots: FAIL: LLVM :: Transforms/SimplifyCFG/X86/bug-25299.ll (65872 of 71835) ******************** TEST 'LLVM :: Transforms/SimplifyCFG/X86/bug-25299.ll' FAILED ******************** Script: -- : 'RUN: at line 1'; /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/opt < /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SimplifyCFG/X86/bug-25299.ll -simplifycfg -S | /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/test/Transforms/SimplifyCFG/X86/bug-25299.ll -- Exit Code: 2 Command Output (stderr): -- ==87374==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x9de47b6 in getBasicBlockIndex /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/IR/Instructions.h:2749:5 #1 0x9de47b6 in simplifyCommonResume /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:4112:23 #2 0x9de47b6 in simplifyResume /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:4039:12 #3 0x9de47b6 in (anonymous namespace)::SimplifyCFGOpt::simplifyOnce(llvm::BasicBlock*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6330:16 #4 0x9dcca13 in run /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6358:16 #5 0x9dcca13 in llvm::simplifyCFG(llvm::BasicBlock*, llvm::TargetTransformInfo const&, llvm::SimplifyCFGOptions const&, llvm::SmallPtrSetImpl<llvm::BasicBlock*>*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6369:8 #6 0x974643d in iterativelySimplifyCFG(
1 parent 78c7118 commit 355aee3

File tree

3 files changed

+4
-38
lines changed

3 files changed

+4
-38
lines changed

llvm/include/llvm/IR/BasicBlock.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,9 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
387387
/// Update PHI nodes in this BasicBlock before removal of predecessor \p Pred.
388388
/// Note that this function does not actually remove the predecessor.
389389
///
390-
/// If \p KeepOneInputPHIs is true, then don't remove PHIs that are left with
391-
/// one incoming value and don't simplify PHIs with all incoming values the
392-
/// same.
390+
/// If \p KeepOneInputPHIs is true then don't remove PHIs that are left with
391+
/// zero or one incoming values, and don't simplify PHIs with all incoming
392+
/// values the same.
393393
void removePredecessor(BasicBlock *Pred, bool KeepOneInputPHIs = false);
394394

395395
bool canSplitPredecessors() const;

llvm/lib/IR/BasicBlock.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ void BasicBlock::removePredecessor(BasicBlock *Pred,
330330

331331
unsigned NumPreds = cast<PHINode>(front()).getNumIncomingValues();
332332
for (PHINode &Phi : make_early_inc_range(phis())) {
333-
Phi.removeIncomingValue(Pred);
333+
Phi.removeIncomingValue(Pred, !KeepOneInputPHIs);
334334
if (KeepOneInputPHIs)
335335
continue;
336336
// If we have a single predecessor, removeIncomingValue erased the PHI

llvm/test/Transforms/LoopRotate/phi-empty.ll

-34
This file was deleted.

0 commit comments

Comments
 (0)