[llvm] [VPlan] Propagate print flags for VPInstructionWithType. (PR #200838)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 1 07:51:49 PDT 2026
https://github.com/fhahn created https://github.com/llvm/llvm-project/pull/200838
Update VPInstructionWithType::print to include printing flags.
>From 47a59a2145c3cd63ccedd3e0609bc4772956f19f Mon Sep 17 00:00:00 2001
From: Florian Hahn <flo at fhahn.com>
Date: Mon, 18 May 2026 12:46:55 +0100
Subject: [PATCH] [VPlan] Propagate print flags for VPInstructionWithType.
Update VPInstructionWithType::print to include printing flags.
---
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp | 3 ++-
.../LoopVectorize/VPlan/vplan-printing-flags.ll | 8 ++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 59084bbaf41b3..2ab880ac8d7af 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1795,7 +1795,8 @@ void VPInstructionWithType::printRecipe(raw_ostream &O, const Twine &Indent,
break;
default:
assert(Instruction::isCast(getOpcode()) && "unhandled opcode");
- O << Instruction::getOpcodeName(getOpcode()) << " ";
+ O << Instruction::getOpcodeName(getOpcode());
+ printFlags(O);
printOperands(O, SlotTracker);
O << " to " << *ResultTy;
}
diff --git a/llvm/test/Transforms/LoopVectorize/VPlan/vplan-printing-flags.ll b/llvm/test/Transforms/LoopVectorize/VPlan/vplan-printing-flags.ll
index 94b4293965ec1..1ff28c3fb487f 100644
--- a/llvm/test/Transforms/LoopVectorize/VPlan/vplan-printing-flags.ll
+++ b/llvm/test/Transforms/LoopVectorize/VPlan/vplan-printing-flags.ll
@@ -16,11 +16,11 @@ define void @cast_flags_mixed(ptr noalias %A, ptr noalias %B) {
; CHECK-EMPTY:
; CHECK-NEXT: loop:
; CHECK-NEXT: EMIT-SCALAR ir<%iv> = phi [ ir<0>, vector.ph ], [ ir<%iv.next>, loop ]
-; CHECK-NEXT: EMIT-SCALAR ir<%zext.nneg> = zext ir<3> to i64
+; CHECK-NEXT: EMIT-SCALAR ir<%zext.nneg> = zext nneg ir<3> to i64
; CHECK-NEXT: EMIT ir<%gep.zext> = getelementptr ir<%A>, ir<%zext.nneg>
; CHECK-NEXT: EMIT-SCALAR ir<%sext.plain> = sext ir<%iv> to i64
; CHECK-NEXT: EMIT ir<%gep.sext> = getelementptr ir<%A>, ir<%sext.plain>
-; CHECK-NEXT: EMIT-SCALAR ir<%trunc.flags> = trunc ir<3> to i8
+; CHECK-NEXT: EMIT-SCALAR ir<%trunc.flags> = trunc nuw nsw ir<3> to i8
; CHECK-NEXT: EMIT ir<%gep.trunc> = getelementptr ir<%B>, ir<%trunc.flags>
; CHECK-NEXT: EMIT store ir<%gep.sext>, ir<%gep.zext>
; CHECK-NEXT: EMIT store ir<0>, ir<%gep.trunc>
@@ -66,8 +66,8 @@ define void @cast_flags_single(ptr noalias %A, ptr noalias %B) {
; CHECK-EMPTY:
; CHECK-NEXT: loop:
; CHECK-NEXT: EMIT-SCALAR ir<%iv> = phi [ ir<0>, vector.ph ], [ ir<%iv.next>, loop ]
-; CHECK-NEXT: EMIT-SCALAR ir<%trunc.nuw.only> = trunc ir<3> to i8
-; CHECK-NEXT: EMIT-SCALAR ir<%trunc.nsw.only> = trunc ir<3> to i8
+; CHECK-NEXT: EMIT-SCALAR ir<%trunc.nuw.only> = trunc nuw ir<3> to i8
+; CHECK-NEXT: EMIT-SCALAR ir<%trunc.nsw.only> = trunc nsw ir<3> to i8
; CHECK-NEXT: EMIT-SCALAR ir<%zext.plain> = zext ir<3> to i64
; CHECK-NEXT: EMIT ir<%gep.a> = getelementptr ir<%A>, ir<%iv>
; CHECK-NEXT: EMIT ir<%gep.b> = getelementptr ir<%B>, ir<%iv>
More information about the llvm-commits
mailing list