Skip to content

Commit 4dbba17

Browse files
committed
Preserve IR flags in scalarization
1 parent 86bfa62 commit 4dbba17

File tree

2 files changed

+107
-1058
lines changed

2 files changed

+107
-1058
lines changed

llvm/lib/CodeGen/ExpandFp.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,9 +936,12 @@ static void scalarize(Instruction *I, SmallVectorImpl<Instruction *> &Replace) {
936936
Op = Builder.CreateCast(cast<CastInst>(I)->getOpcode(), Ext,
937937
I->getType()->getScalarType());
938938
Result = Builder.CreateInsertElement(Result, Op, Idx);
939-
if (isa<Instruction>(Op))
940-
Replace.push_back(cast<Instruction>(Op));
939+
if (auto *ScalarizedI = dyn_cast<Instruction>(Op)) {
940+
ScalarizedI->copyIRFlags(I, true);
941+
Replace.push_back(ScalarizedI);
942+
}
941943
}
944+
942945
I->replaceAllUsesWith(Result);
943946
I->dropAllReferences();
944947
I->eraseFromParent();

0 commit comments

Comments
 (0)