[llvm] [VPlan] Add VPInst::getNumOperandsForOpcode, use to verify in ctor (NFC) (PR #142284)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 24 04:37:07 PDT 2025
================
@@ -706,13 +706,15 @@ TEST_F(VPBasicBlockTest, reassociateBlocks) {
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
TEST_F(VPBasicBlockTest, print) {
- VPInstruction *TC = new VPInstruction(Instruction::Add, {});
+ VPInstruction *TC = new VPInstruction(Instruction::PHI, {});
VPlan &Plan = getPlan(TC);
+ IntegerType *Int32 = IntegerType::get(C, 32);
+ VPValue *Val = Plan.getOrAddLiveIn(ConstantInt::get(Int32, 1));
VPBasicBlock *VPBB0 = Plan.getEntry();
VPBB0->appendRecipe(TC);
- VPInstruction *I1 = new VPInstruction(Instruction::Add, {});
- VPInstruction *I2 = new VPInstruction(Instruction::Sub, {I1});
+ VPInstruction *I1 = new VPInstruction(Instruction::Add, {Val, Val});
+ VPInstruction *I2 = new VPInstruction(Instruction::Sub, {I1, Val});
VPInstruction *I3 = new VPInstruction(Instruction::Br, {I1, I2});
----------------
fhahn wrote:
Yep, this just creates artificial VPInstructions to test printing, the ocpodes don't really matter, other than checking.
We should probably tighten down which kinds of opcodes are supported for VPInstruction
https://github.com/llvm/llvm-project/pull/142284
More information about the llvm-commits
mailing list