This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] Replace an always false condition with an assert.
ClosedPublic

Authored by craig.topper on Feb 9 2023, 1:14 PM.

Details

Summary

The one caller of this function already checked that V isn't a
Constant.

Alternatively, we could remove the check from the caller if reviewers
prefer.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 9 2023, 1:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 9 2023, 1:14 PM
craig.topper requested review of this revision.Feb 9 2023, 1:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 9 2023, 1:14 PM
spatel added inline comments.Feb 9 2023, 2:11 PM
llvm/lib/Analysis/ValueTracking.cpp
2302

Change the function signature to take "Constant *C" instead of a generic "Value *"?

craig.topper added inline comments.Feb 9 2023, 2:25 PM
llvm/lib/Analysis/ValueTracking.cpp
2302

We want to exclude constants.

craig.topper retitled this revision from [ValueTracking] Replace an always true condition with an assert. to [ValueTracking] Replace an always false condition with an assert..Feb 9 2023, 2:28 PM
spatel accepted this revision.Feb 9 2023, 2:33 PM

LGTM

llvm/lib/Analysis/ValueTracking.cpp
2302

Oops. :)

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