This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyIndVars] Ignore dead users
ClosedPublic

Authored by mkazantsev on Jun 8 2018, 11:05 PM.

Details

Summary

IndVarSimplify sometimes makes transforms basing on users that are trivially dead. In particular,
if DCE wasn't run before it, there may be a dead sext/zext in loop that will trigger widening
transforms, however it makes no sense to do it.

This patch teaches IndVarsSimplify ignore the mist trivial cases of that.

Diff Detail

Repository
rL LLVM

Event Timeline

mkazantsev created this revision.Jun 8 2018, 11:05 PM
sanjoy accepted this revision.Jun 9 2018, 10:55 PM

lgtm

lib/Transforms/Utils/SimplifyIndVar.cpp
839 ↗(On Diff #150608)

How about isInstructionTriviallyDead?

Also, please add a short comment here on why this is needed.

This revision is now accepted and ready to land.Jun 9 2018, 10:55 PM
This revision was automatically updated to reflect the committed changes.