diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-12-09 13:28:42 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-12-09 13:28:42 +0000 |
| commit | b1c73532ee8997fe5dfbeb7d223027bdf99758a0 (patch) | |
| tree | 7d6e51c294ab6719475d660217aa0c0ad0526292 /llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | |
| parent | 7fa27ce4a07f19b07799a767fc29416f3b625afb (diff) | |
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index 1d0a03ccfcdc..1128ecfd860d 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -64,11 +64,18 @@ static ISD::NodeType getPreferredExtendForValue(const Instruction *I) { // can be exposed. ISD::NodeType ExtendKind = ISD::ANY_EXTEND; unsigned NumOfSigned = 0, NumOfUnsigned = 0; - for (const User *U : I->users()) { - if (const auto *CI = dyn_cast<CmpInst>(U)) { + for (const Use &U : I->uses()) { + if (const auto *CI = dyn_cast<CmpInst>(U.getUser())) { NumOfSigned += CI->isSigned(); NumOfUnsigned += CI->isUnsigned(); } + if (const auto *CallI = dyn_cast<CallBase>(U.getUser())) { + if (!CallI->isArgOperand(&U)) + continue; + unsigned ArgNo = CallI->getArgOperandNo(&U); + NumOfUnsigned += CallI->paramHasAttr(ArgNo, Attribute::ZExt); + NumOfSigned += CallI->paramHasAttr(ArgNo, Attribute::SExt); + } } if (NumOfSigned > NumOfUnsigned) ExtendKind = ISD::SIGN_EXTEND; |
