[llvm] [VPlan] Use VPInstructionWithType for uniform casts. (PR #140623)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Sun May 3 15:42:01 PDT 2026
================
@@ -1397,8 +1397,16 @@ static void simplifyRecipe(VPSingleDefRecipe *Def, VPTypeAnalysis &TypeInfo) {
unsigned ExtOpcode = match(Def->getOperand(0), m_SExt(m_VPValue()))
? Instruction::SExt
: Instruction::ZExt;
- auto *Ext = Builder.createWidenCast(Instruction::CastOps(ExtOpcode), A,
- TruncTy);
+ VPSingleDefRecipe *Ext;
+ if (vputils::isSingleScalar(Def)) {
+ Ext = new VPInstructionWithType(Instruction::CastOps(ExtOpcode), {A},
+ TruncTy, {}, {}, Def->getDebugLoc());
+ Builder.getInsertBlock()->insert(Ext, Builder.getInsertPoint());
+ } else {
+ Ext = Builder.createWidenCast(Instruction::CastOps(ExtOpcode), A,
+ TruncTy);
+ }
+
----------------
artagnon wrote:
I think this should be handled by narrowToSingleScalars, but we got blocked earlier on some regressions? If you remove this, do we see regressions in the current patch?
https://github.com/llvm/llvm-project/pull/140623
More information about the llvm-commits
mailing list