Reassociate drops NSW/NUW flags #13357
Labels
bugzilla
Issues migrated from bugzilla
code-quality
confirmed
Verified by a second party
llvm:transforms
Extended Description
The Reassociate pass unnecessarily drops NSW/NUW flags during canonicalization. If we really want to drop the flags, we should probably do it after indvars where we eliminate sign/zero extension.
I noticed three situations where Reassociation drops flags in a single test case:
Attached unit tests:
rtest.ll
rtest2.ll
rtest.ll does some legitimate reassociation in order to fold constants (exhibits case #3).
rtest2.ll has an additional use of %sub, so doesn't do any actual reassociation or folding, and is closer to the real test case, but it still drops flags everywhere.
rtest2.ll would probably be easier to fix (no case #3), but it would be nice to handle rtest.ll too. It would be a nice property to preserve the flags if possible regardless of the number of uses
The text was updated successfully, but these errors were encountered: