This is an archive of the discontinued LLVM Phabricator instance.

[LoopDeletion] Don't delete loops with blocks that have their address taken
AbandonedPublic

Authored by aeubanks on Apr 15 2022, 12:44 PM.

Details

Summary

Otherwise we may end up making the blockaddress invalid and passing it to other functions.

Diff Detail

Event Timeline

aeubanks created this revision.Apr 15 2022, 12:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2022, 12:44 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
aeubanks requested review of this revision.Apr 15 2022, 12:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 15 2022, 12:44 PM
aeubanks added a reviewer: reames.
aeubanks added a reviewer: mkazantsev.

Should we be replacing the blockaddress with a Constant 1 in such cases? We do that elsewhere in a couple places. @efriedma ?

Should we be replacing the blockaddress with a Constant 1 in such cases? We do that elsewhere in a couple places. @efriedma ?

Oh, that's what the previous behavior of llvm/test/Transforms/LoopDeletion/blockaddress.ll was testing.

Should we be replacing the blockaddress with a Constant 1 in such cases? We do that elsewhere in a couple places. @efriedma ?

Oh, that's what the previous behavior of llvm/test/Transforms/LoopDeletion/blockaddress.ll was testing.

Ah, this test was precommitted recently: https://github.com/llvm/llvm-project/commit/4d85859ff48d16fc0ca8199676f7417a2c6dfe43

In general, transformations are allowed to delete unreachable blocks that have their address taken. See https://llvm.org/docs/LangRef.html#addresses-of-basic-blocks etc. So I don't see a bug here.

nickdesaulniers requested changes to this revision.Apr 15 2022, 1:40 PM

In general, transformations are allowed to delete unreachable blocks that have their address taken. See https://llvm.org/docs/LangRef.html#addresses-of-basic-blocks etc. So I don't see a bug here.

That's what I thought. Throwing a gentle -1 on this until convinced otherwise.

This revision now requires changes to proceed.Apr 15 2022, 1:40 PM

https://crsrc.org/c/base/debug/stack_trace.cc;drc=dd12c1c88dda05cccfb2bf9b9c9341ca8bdb3d1b;l=395

we're comparing the pc against two labels in a function to maybe skip stack frames. I guess label addresses aren't meant to do that? http://theochem.ki.ku.dk/on_line_docs/gcc/gcc_4.html suggests that they're only used for computed gotos?

aeubanks abandoned this revision.Apr 15 2022, 3:26 PM