You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can eliminate the branch, but it doesn't. To my surprise, re-executing the output once simplifycfg eliminates this branch: https://llvm.godbolt.org/z/85zKbMdxe.
I've noticed that the user order is different after inlining and reading the text IR. See: #98799 (comment).
The passingValueIsAlwaysUndefined only considers the first user:
I think I know why the order of uses is different. Refer to: ef55a1a. All uses are added to the front, so when reading the textual IR, this order is the reverse of the instruction order, and it reverses again during inlining.
I'm not sure how to fix it. Perhaps we need a method to sort them according to the instruction order?
I tried the following IR:
We can eliminate the branch, but it doesn't. To my surprise, re-executing the output once simplifycfg eliminates this branch: https://llvm.godbolt.org/z/85zKbMdxe.
I've noticed that the user order is different after inlining and reading the text IR. See: #98799 (comment).
The
passingValueIsAlwaysUndefined
only considers the first user:llvm-project/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Lines 7567 to 7577 in 92f4001
Of course there are many ways to solve this problem, for example:
passingValueIsAlwaysUndefined
can handle (I'd go with this one first.)assume(%p == null)
But my biggest concern here is whether the user order needs to be consistent. I don't like it when an optimization happens randomly.
The text was updated successfully, but these errors were encountered: