[all-commits] [llvm/llvm-project] 259593: [IndVars] Support shl by constant and or disjoint ...
Craig Topper via All-commits
all-commits at lists.llvm.org
Thu Mar 14 12:52:33 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 25959310a50240c320283d1e4b23046fed152313
https://github.com/llvm/llvm-project/commit/25959310a50240c320283d1e4b23046fed152313
Author: Craig Topper <craig.topper at sifive.com>
Date: 2024-03-14 (Thu, 14 Mar 2024)
Changed paths:
M llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
M llvm/test/Transforms/IndVarSimplify/iv-widen-elim-ext.ll
Log Message:
-----------
[IndVars] Support shl by constant and or disjoint in getExtendedOperandRecurrence. (#84282)
We can treat a shift by constant as a multiply by a power of 2
and we can treat an or disjoint as a 'add nsw nuw'.
I've added a helper struct similar to a struct used in
ScalarEvolution.cpp
to represent the opcode, operands, and NSW/NUW flags for normal
add/sub/mul
and shl/or that are being treated as mul/add.
I don't think we need to teach cloneIVUser about this. It will continue
to clone them using cloneBitwiseIVUser. After the cloning we will ask
for the SCEV expression for the cloned IV user and verify that it
matches
the AddRec returned by getExtendedOperandRecurrence. Since SCEV also
knows how to convert shl to mul and or disjoint to add nsw nuw, this
should
usually match. If it doesn't match, the cloned IV user will be deleted.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list