This is an archive of the discontinued LLVM Phabricator instance.

[IR] Move willReturn() to Instruction
ClosedPublic

Authored by nikic on Feb 18 2021, 1:25 PM.

Details

Summary

This moves the willReturn() helper from CallBase to Instruction, so that it can be used in a more generic manner. This will make it easier to fix additional passes (ADCE and BDCE), and will give us one place to change if additional instructions should become non-willreturn (e.g. there has been talk about handling volatile operations this way).

I have also included the IntrinsicInst workaround directly in here, so that it gets applied consistently. (As such this change is not entirely NFC -- FuncAttrs will now use this as well.)

Diff Detail

Event Timeline

nikic created this revision.Feb 18 2021, 1:25 PM
nikic requested review of this revision.Feb 18 2021, 1:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2021, 1:25 PM
nikic edited the summary of this revision. (Show Details)Feb 18 2021, 1:25 PM
jdoerfert added inline comments.Feb 18 2021, 1:36 PM
llvm/lib/Analysis/ValueTracking.cpp
5064

Where did this logic go?

nikic added inline comments.Feb 18 2021, 1:40 PM
llvm/lib/Analysis/ValueTracking.cpp
5064

This repeated the logic of Instruction::mayThrow() (https://github.com/llvm/llvm-project/blob/b7e05c874b5b2a77c87df71ee3442abc2569cbb9/llvm/lib/IR/Instruction.cpp#L621-L629), so I folded it into the call below.

jdoerfert accepted this revision.Feb 18 2021, 2:18 PM

LG, nice cleanup

This revision is now accepted and ready to land.Feb 18 2021, 2:18 PM
This revision was landed with ongoing or failed builds.Feb 19 2021, 3:05 AM
This revision was automatically updated to reflect the committed changes.