This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Fix crash in checking the identical of PHI nodes
AbandonedPublic

Authored by Allen on Aug 11 2022, 7:17 PM.

Details

Reviewers
fhahn
nikic
Summary

With the commit 20d798b, we generate the node %val_i1_62.lcssa1, which has different
incoming values for the same basic block. But in fact, the two incoming values are equal,
so they should be allowed, eg:

  %val_i1_62.lcssa1 = phi i1 [ %val_i1_52.lcssa2, %bb_3 ], [ %val_i1_52.lcssa3, %bb_3 ]
label %bb_3
  %val_i1_52.lcssa3 = phi i1 [ %val_i1_52, %bb_2 ]
  %val_i1_52.lcssa2 = phi i1 [ %val_i1_52, %bb_2 ]

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

Diff Detail

Event Timeline

Allen created this revision.Aug 11 2022, 7:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2022, 7:17 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Allen requested review of this revision.Aug 11 2022, 7:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 11 2022, 7:17 PM
fhahn requested changes to this revision.Aug 16 2022, 1:40 AM

Unfortunately I don't think this is the right fix, as we might end up with scenarios where we end up with chains of phis we need to look through. Indvars shouldn't create those redundant phi nodes if possible.

This revision now requires changes to proceed.Aug 16 2022, 1:40 AM
Allen abandoned this revision.Aug 16 2022, 5:26 AM