This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] Don't hoist allocas
ClosedPublic

Authored by aeubanks on Sep 12 2022, 3:10 PM.

Details

Summary

D129370 started hoisting allocas across stacksave/stackrestore
boundaries which is wrong.

Diff Detail

Event Timeline

aeubanks created this revision.Sep 12 2022, 3:10 PM
aeubanks requested review of this revision.Sep 12 2022, 3:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2022, 3:10 PM
aeubanks updated this revision to Diff 459570.Sep 12 2022, 3:10 PM

remove FIXME

Why specifically "inalloca" allocas? Don't all allocas have the same issue?

aeubanks updated this revision to Diff 459605.Sep 12 2022, 5:46 PM

all allocas

aeubanks retitled this revision from [SimplifyCFG] Don't hoist inalloca allocas to [SimplifyCFG] Don't hoist allocas.Sep 12 2022, 5:46 PM
aeubanks edited the summary of this revision. (Show Details)
aeubanks added a reviewer: efriedma.
chill accepted this revision.Sep 13 2022, 1:59 AM

Thanks! LGTM.

There's a comment about mayHaveSideEffects that's not entirely correct, maybe it can be reworded somewhat?
https://github.com/llvm/llvm-project/blob/1f7b94e0ec7fae446e2ef9fcc41968fc711fb2c7/llvm/include/llvm/IR/Instruction.h#L630

This revision is now accepted and ready to land.Sep 13 2022, 1:59 AM
rnk accepted this revision.Sep 13 2022, 8:35 AM

There's a comment about mayHaveSideEffects that's not entirely correct, maybe it can be reworded somewhat?
https://github.com/llvm/llvm-project/blob/1f7b94e0ec7fae446e2ef9fcc41968fc711fb2c7/llvm/include/llvm/IR/Instruction.h#L630

The comment suggests isSafeToSpeculativelyExecute. Perhaps that is more appropriate for this transform, which hoists? Either way, correctness first, let's land the fix and you can iterate on improvements and simplifications.

This revision was automatically updated to reflect the committed changes.