This is an archive of the discontinued LLVM Phabricator instance.

[LVI][CVP] Don't compute CR at SelectInst Use if Cond value may not be well-defined
ClosedPublic

Authored by StephenFan on Apr 19 2023, 5:22 AM.

Details

Summary

If the condition value of SelectInst may be a poison or undef value,
infer constant range at SelectInst use is in correct.

See https://alive2.llvm.org/ce/z/MWMTYn

Fixes: https://github.com/llvm/llvm-project/issues/62200

Diff Detail

Event Timeline

StephenFan created this revision.Apr 19 2023, 5:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2023, 5:22 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
StephenFan requested review of this revision.Apr 19 2023, 5:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2023, 5:22 AM
nikic added a comment.Apr 19 2023, 5:24 AM

The tests should all be updated to use noundef, plus one representative test without it.

StephenFan edited the summary of this revision. (Show Details)

add noundef and add new test.

nikic accepted this revision.Apr 20 2023, 1:46 AM

LGTM

llvm/lib/Analysis/LazyValueInfo.cpp
1670–1673

This issue is only about undef, it does not affect poison. This is why it's mostly a theoretical problem.

This revision is now accepted and ready to land.Apr 20 2023, 1:46 AM