Skip to content

Commit

Permalink
[LateLowerGC] Change undef FCA into zeroinit (#43867)
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy authored Jan 20, 2022
1 parent f6ea7cc commit 88b1f92
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/llvm-late-gc-lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2258,6 +2258,18 @@ bool LateLowerGCFrame::CleanupIR(Function &F, State *S) {
I->setMetadata(LLVMContext::MD_tbaa, MutableTBAA);
}
}
// FCA chains created by SROA start with an undef value
// if the type contains an tracked pointer that can lead to a partial
// initialisation and LateLower might have inserted an extractvalue
// of an undef field. Fix this by changing it to start with an zero-init
if (auto *IV = dyn_cast<InsertValueInst>(*&it)) {
Value *SourceAggregate = IV->getAggregateOperand();
if (isa<UndefValue>(SourceAggregate)) {
IV->setOperand(IV->getAggregateOperandIndex(), ConstantAggregateZero::get(IV->getType()));
ChangesMade = true;
}
}

auto *CI = dyn_cast<CallInst>(&*it);
if (!CI) {
++it;
Expand Down

2 comments on commit 88b1f92

@vchuravy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanosoldier runtests(ALL, vs = "@f6ea7cc5f2e6cb1403c5462bd9df9e4961c1e662")

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here.

Please sign in to comment.