This is an archive of the discontinued LLVM Phabricator instance.

[SCCP] Replace new value's value state with removed value's
AcceptedPublic

Authored by StephenFan on Jun 6 2023, 10:00 PM.

Details

Summary

In replaceSignedInst, if a signed instruction can be repalced with
unsigned instruction, we created a new instruction and removed the old
instruction's value state. If the following instructions has this new
instruction as a use operand, transformations like replaceSignedInst and
refineInstruction would be blocked. The reason is there is no value
state for the new instrution.

This patch set the new instruction's value state with the removed
instruction's value state. I believe it is correct bacause when we
repalce a signed instruction with unsigned instruction, the value state
is not changed.

Diff Detail

Event Timeline

StephenFan created this revision.Jun 6 2023, 10:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2023, 10:00 PM
StephenFan requested review of this revision.Jun 6 2023, 10:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2023, 10:00 PM
nikic accepted this revision.Jun 7 2023, 1:26 AM

LGTM

llvm/include/llvm/Transforms/Utils/SCCPSolver.h
133

I found this name confusing. Maybe just moveLatticeValue?

This revision is now accepted and ready to land.Jun 7 2023, 1:26 AM

Rename to moveLatticeValue.
Don't do insert in moveLatticeValue since the new value may have already existed in valuestate.

This revision was landed with ongoing or failed builds.Jun 11 2023, 8:41 PM
This revision was automatically updated to reflect the committed changes.
vitalybuka reopened this revision.Jun 12 2023, 11:07 AM
vitalybuka added a subscriber: vitalybuka.

There are crashes with sanitizers

This revision is now accepted and ready to land.Jun 12 2023, 11:07 AM

Example https://lab.llvm.org/buildbot/#/builders/168/builds/13981
similar with msan and hwasan both arm and x86

We (Linaro) also saw a 2nd stage compiler crash on our Windows on Arm (AArch64) bot. The revert has fixed that, thanks!

I expect the cause was the same, but can't see the specifics in the logs. If it happens again on reland I'll come back with the reproducer for it.