This is an archive of the discontinued LLVM Phabricator instance.

[WIP][IC][DebugInfo] Preserve DI value when folding cast into phi
Needs ReviewPublic

Authored by gramanas on Jul 23 2018, 10:11 AM.

Details

Reviewers
vsk
Summary

This patch tries to incorporate the new replaceAllDbgUsersWith
function while folding a cast into a phi instruction.

Diff Detail

Event Timeline

gramanas created this revision.Jul 23 2018, 10:11 AM
vsk added a comment.Jul 23 2018, 10:31 AM

Thanks, a few comments inline --

test/Transforms/InstCombine/phi_cast.ll
8

Why not define in 'i1 %cond' etc. as function parameters? Then the icmp and sdiv become unnecessary.

20

Hold on, if this is a phi i1, then doesn't that mean that 'foldOpIntoPhi' didn't trigger?

25

Doesn't "i" mean "An integer constant (of target-specific width)"? I'm not sure whether the instruction is well-formed without a constraint, but if it isn't, then the "r" (register) constraint seems like the appropriate one here.

gramanas updated this revision to Diff 156845.Jul 23 2018, 11:32 AM
gramanas marked 3 inline comments as done.
  • Update test according to comments.

The result of instcombine doesn't seem to be affected by the asm sideeffect or
by the replaceAllDbgUsersWith though.

vsk added a comment.Jul 23 2018, 11:34 AM
  • Update test according to comments.

The result of instcombine doesn't seem to be affected by the asm sideeffect or
by the replaceAllDbgUsersWith though.

Why is the side-effecting use necessary? Have you tried using any other constructions to get to a minimal test?