[PATCH] D157305: [ValueTracking] Use switch for Intrinsics in `isKnownToBePowerOfTwo`; NFC
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 7 11:46:14 PDT 2023
goldstein.w.n updated this revision to Diff 547888.
goldstein.w.n added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157305/new/
https://reviews.llvm.org/D157305
Files:
llvm/lib/Analysis/ValueTracking.cpp
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -2129,11 +2129,20 @@
return isKnownToBeAPowerOfTwo(U.get(), OrZero, NewDepth, RecQ);
});
}
+ case Instruction::Invoke:
case Instruction::Call: {
- Value *X, *Y;
- if (match(I, m_MaxOrMin(m_Value(X), m_Value(Y))))
- return isKnownToBeAPowerOfTwo(X, OrZero, Depth, Q) &&
- isKnownToBeAPowerOfTwo(Y, OrZero, Depth, Q);
+ if (auto *II = dyn_cast<IntrinsicInst>(I)) {
+ switch (II->getIntrinsicID()) {
+ case Intrinsic::umax:
+ case Intrinsic::smax:
+ case Intrinsic::umin:
+ case Intrinsic::smin:
+ return isKnownToBeAPowerOfTwo(II->getArgOperand(1), OrZero, Depth, Q) &&
+ isKnownToBeAPowerOfTwo(II->getArgOperand(0), OrZero, Depth, Q);
+ default:
+ break;
+ }
+ }
return false;
}
default:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157305.547888.patch
Type: text/x-patch
Size: 1003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230807/1e3b2068/attachment.bin>
More information about the llvm-commits
mailing list