[llvm] [SeparateConstOffsetFromGEP] Decompose constant xor operand if possible (PR #135788)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu May 22 02:43:19 PDT 2025
================
@@ -1162,6 +1202,165 @@ bool SeparateConstOffsetFromGEP::splitGEP(GetElementPtrInst *GEP) {
return true;
}
+// Helper function to check if an instruction has at least one GEP user
+bool XorToOrDisjointTransformer::hasGEPUser(const Value *V) {
+ for (const User *U : V->users()) {
+ if (isa<GetElementPtrInst>(U)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool XorToOrDisjointTransformer::dominatesAllXors(
+ BinaryOperator *BaseXor, const XorOpList &XorsInGroup) {
+ for (const auto &XorEntry : XorsInGroup) {
+ BinaryOperator *XorInst = XorEntry.first;
+ if (XorInst != BaseXor && !DT.dominates(BaseXor, XorInst)) {
----------------
jayfoad wrote:
I don't think you need the `!=` check, do you?
```suggestion
if (!DT.dominates(BaseXor, XorInst)) {
```
Also: use `all_of`?
https://github.com/llvm/llvm-project/pull/135788
More information about the llvm-commits
mailing list