[llvm] [SandboxIR] Implement missing PHINode functions (PR #101734)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 12:39:54 PDT 2024
================
@@ -1974,7 +1974,18 @@ define void @foo(i32 %arg) {
EXPECT_EQ(PHI->hasConstantOrUndefValue(), LLVMPHI->hasConstantOrUndefValue());
// Check isComplete().
EXPECT_EQ(PHI->isComplete(), LLVMPHI->isComplete());
-
+ // Check replaceIncomingBlockWith
+ OrigBB = PHI->getIncomingBlock(0);
+ EXPECT_EQ(OrigBB, BB1);
+ EXPECT_NE(OrigBB, BB2);
+ PHI->replaceIncomingBlockWith(BB1, BB2);
+ EXPECT_EQ(PHI->getIncomingBlock(0), BB2);
+ // Check replaceIncomingValueIf
+ EXPECT_EQ(PHI->getNumIncomingValues(), 2u);
+ PHI->removeIncomingValueIf([&](unsigned Idx) {
+ return PHI->getIncomingBlock(Idx) == BB2;
+ });
+ EXPECT_EQ(PHI->getNumIncomingValues(), 1u);
----------------
vporpo wrote:
Shouldn't we check the remaining values/blocks here too?
https://github.com/llvm/llvm-project/pull/101734
More information about the llvm-commits
mailing list