mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix wrong combination of MemoryBehavior.
Instead of taking the maximum we need to handle the special case MayRead + MayWrite = MayReadWrite
This commit is contained in:
@@ -253,12 +253,13 @@ MemBehavior MemoryBehaviorVisitor::visitApplyInst(ApplyInst *AI) {
|
||||
Idx < End && Behavior < MemBehavior::MayHaveSideEffects; ++Idx) {
|
||||
auto &ArgEffect = ApplyEffects.getParameterEffects()[Idx];
|
||||
auto ArgBehavior = ArgEffect.getMemBehavior(InspectionMode);
|
||||
if (ArgBehavior > Behavior) {
|
||||
auto NewBehavior = combineMemoryBehavior(Behavior, ArgBehavior);
|
||||
if (NewBehavior != Behavior) {
|
||||
SILValue Arg = AI->getArgument(Idx);
|
||||
// We only consider the argument effects if the argument aliases V.
|
||||
if (!Arg.getType().isAddress() ||
|
||||
!AA->isNoAlias(Arg, V, computeTBAAType(Arg), getValueTBAAType())) {
|
||||
Behavior = ArgBehavior;
|
||||
Behavior = NewBehavior;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user