[llvm] 37c0aac - [SelectionDAG] Make getPreferredExtendForValue take a Instruction * instead of Value *.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 21 12:15:44 PDT 2022
Author: Craig Topper
Date: 2022-03-21T12:15:22-07:00
New Revision: 37c0aacd71871658786435c5d6b6273784d26f72
URL: https://github.com/llvm/llvm-project/commit/37c0aacd71871658786435c5d6b6273784d26f72
DIFF: https://github.com/llvm/llvm-project/commit/37c0aacd71871658786435c5d6b6273784d26f72.diff
LOG: [SelectionDAG] Make getPreferredExtendForValue take a Instruction * instead of Value *.
This is only called for instructions and the caller is already holding
an Instruction *. This makes the code more explicit and makes it
obvious the code doesn't make decisions about constants.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index 771e09d9c3a25..b49455111a468 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -54,7 +54,7 @@ static bool isUsedOutsideOfDefiningBlock(const Instruction *I) {
return false;
}
-static ISD::NodeType getPreferredExtendForValue(const Value *V) {
+static ISD::NodeType getPreferredExtendForValue(const Instruction *I) {
// For the users of the source value being used for compare instruction, if
// the number of signed predicate is greater than unsigned predicate, we
// prefer to use SIGN_EXTEND.
@@ -64,7 +64,7 @@ static ISD::NodeType getPreferredExtendForValue(const Value *V) {
// can be exposed.
ISD::NodeType ExtendKind = ISD::ANY_EXTEND;
unsigned NumOfSigned = 0, NumOfUnsigned = 0;
- for (const User *U : V->users()) {
+ for (const User *U : I->users()) {
if (const auto *CI = dyn_cast<CmpInst>(U)) {
NumOfSigned += CI->isSigned();
NumOfUnsigned += CI->isUnsigned();
More information about the llvm-commits
mailing list