Skip to content

Commit 577c5c7

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:1b9805c14dba into amd-gfx:0cab57531d07
Local branch amd-gfx 0cab575 Merged main:9423961f259f into amd-gfx:4b57b2fc3a59 Remote branch main 1b9805c [ELF] Move PT_OPENBSD_NOBTCFI check to readConfigs() (llvm#120678)
2 parents 0cab575 + 1b9805c commit 577c5c7

File tree

9 files changed

+41
-47
lines changed

9 files changed

+41
-47
lines changed

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -696,13 +696,11 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
696696

697697
// What this is a specialization of.
698698
auto SpecOf = CTSD->getSpecializedTemplateOrPartial();
699-
if (SpecOf.is<ClassTemplateDecl *>()) {
700-
Specialization.SpecializationOf =
701-
getUSRForDecl(SpecOf.get<ClassTemplateDecl *>());
702-
} else if (SpecOf.is<ClassTemplatePartialSpecializationDecl *>()) {
703-
Specialization.SpecializationOf =
704-
getUSRForDecl(SpecOf.get<ClassTemplatePartialSpecializationDecl *>());
705-
}
699+
if (auto *CTD = dyn_cast<ClassTemplateDecl *>(SpecOf))
700+
Specialization.SpecializationOf = getUSRForDecl(CTD);
701+
else if (auto *CTPSD =
702+
dyn_cast<ClassTemplatePartialSpecializationDecl *>(SpecOf))
703+
Specialization.SpecializationOf = getUSRForDecl(CTPSD);
706704

707705
// Parameters to the specilization. For partial specializations, get the
708706
// parameters "as written" from the ClassTemplatePartialSpecializationDecl

lld/ELF/Config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ struct Config {
363363
bool zInterpose;
364364
bool zKeepTextSectionPrefix;
365365
bool zLrodataAfterBss;
366-
bool zNoBtCfi = false;
366+
bool zNoBtCfi;
367367
bool zNodefaultlib;
368368
bool zNodelete;
369369
bool zNodlopen;

lld/ELF/Driver.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,7 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
14871487
args, "keep-text-section-prefix", "nokeep-text-section-prefix", false);
14881488
ctx.arg.zLrodataAfterBss =
14891489
getZFlag(args, "lrodata-after-bss", "nolrodata-after-bss", false);
1490+
ctx.arg.zNoBtCfi = hasZOption(args, "nobtcfi");
14901491
ctx.arg.zNodefaultlib = hasZOption(args, "nodefaultlib");
14911492
ctx.arg.zNodelete = hasZOption(args, "nodelete");
14921493
ctx.arg.zNodlopen = hasZOption(args, "nodlopen");
@@ -1897,9 +1898,6 @@ static void setConfigs(Ctx &ctx, opt::InputArgList &args) {
18971898
ErrAlways(ctx) << "cannot open --why-extract= file " << ctx.arg.whyExtract
18981899
<< ": " << e.message();
18991900
}
1900-
1901-
if (ctx.arg.osabi == ELFOSABI_OPENBSD)
1902-
ctx.arg.zNoBtCfi = hasZOption(args, "nobtcfi");
19031901
}
19041902

19051903
static bool isFormatBinary(Ctx &ctx, StringRef s) {

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 522240
19+
#define LLVM_MAIN_REVISION 522244
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3211,11 +3211,6 @@ class VPCanonicalIVPHIRecipe : public VPHeaderPHIRecipe {
32113211
return true;
32123212
}
32133213

3214-
/// Check if the induction described by \p Kind, /p Start and \p Step is
3215-
/// canonical, i.e. has the same start and step (of 1) as the canonical IV.
3216-
bool isCanonical(InductionDescriptor::InductionKind Kind, VPValue *Start,
3217-
VPValue *Step) const;
3218-
32193214
/// Return the cost of this VPCanonicalIVPHIRecipe.
32203215
InstructionCost computeCost(ElementCount VF,
32213216
VPCostContext &Ctx) const override {

llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ template <unsigned BitWidth = 0> struct specific_intval {
7878
if (!VPV->isLiveIn())
7979
return false;
8080
Value *V = VPV->getLiveInIRValue();
81+
if (!V)
82+
return false;
8183
const auto *CI = dyn_cast<ConstantInt>(V);
8284
if (!CI && V->getType()->isVectorTy())
8385
if (const auto *C = dyn_cast<Constant>(V))
@@ -136,7 +138,8 @@ struct MatchRecipeAndOpcode<Opcode, RecipeTy> {
136138
// Check for recipes that do not have opcodes.
137139
if constexpr (std::is_same<RecipeTy, VPScalarIVStepsRecipe>::value ||
138140
std::is_same<RecipeTy, VPCanonicalIVPHIRecipe>::value ||
139-
std::is_same<RecipeTy, VPWidenSelectRecipe>::value)
141+
std::is_same<RecipeTy, VPWidenSelectRecipe>::value ||
142+
std::is_same<RecipeTy, VPDerivedIVRecipe>::value)
140143
return DefR;
141144
else
142145
return DefR && DefR->getOpcode() == Opcode;
@@ -382,6 +385,17 @@ inline VPScalarIVSteps_match<Op0_t, Op1_t> m_ScalarIVSteps(const Op0_t &Op0,
382385
const Op1_t &Op1) {
383386
return VPScalarIVSteps_match<Op0_t, Op1_t>(Op0, Op1);
384387
}
388+
389+
template <typename Op0_t, typename Op1_t, typename Op2_t>
390+
using VPDerivedIV_match =
391+
Recipe_match<std::tuple<Op0_t, Op1_t, Op2_t>, 0, false, VPDerivedIVRecipe>;
392+
393+
template <typename Op0_t, typename Op1_t, typename Op2_t>
394+
inline VPDerivedIV_match<Op0_t, Op1_t, Op2_t>
395+
m_DerivedIV(const Op0_t &Op0, const Op1_t &Op1, const Op2_t &Op2) {
396+
return VPDerivedIV_match<Op0_t, Op1_t, Op2_t>({Op0, Op1, Op2});
397+
}
398+
385399
} // namespace VPlanPatternMatch
386400
} // namespace llvm
387401

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3124,24 +3124,6 @@ void VPCanonicalIVPHIRecipe::print(raw_ostream &O, const Twine &Indent,
31243124
}
31253125
#endif
31263126

3127-
bool VPCanonicalIVPHIRecipe::isCanonical(
3128-
InductionDescriptor::InductionKind Kind, VPValue *Start,
3129-
VPValue *Step) const {
3130-
// Must be an integer induction.
3131-
if (Kind != InductionDescriptor::IK_IntInduction)
3132-
return false;
3133-
// Start must match the start value of this canonical induction.
3134-
if (Start != getStartValue())
3135-
return false;
3136-
3137-
// If the step is defined by a recipe, it is not a ConstantInt.
3138-
if (Step->getDefiningRecipe())
3139-
return false;
3140-
3141-
ConstantInt *StepC = dyn_cast<ConstantInt>(Step->getLiveInIRValue());
3142-
return StepC && StepC->isOne();
3143-
}
3144-
31453127
bool VPWidenPointerInductionRecipe::onlyScalarsGenerated(bool IsScalable) {
31463128
return IsScalarAfterVectorization &&
31473129
(!IsScalable || vputils::onlyFirstLaneUsed(this));

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -528,11 +528,8 @@ createScalarIVSteps(VPlan &Plan, InductionDescriptor::InductionKind Kind,
528528
VPValue *StartV, VPValue *Step, VPBuilder &Builder) {
529529
VPBasicBlock *HeaderVPBB = Plan.getVectorLoopRegion()->getEntryBasicBlock();
530530
VPCanonicalIVPHIRecipe *CanonicalIV = Plan.getCanonicalIV();
531-
VPSingleDefRecipe *BaseIV = CanonicalIV;
532-
if (!CanonicalIV->isCanonical(Kind, StartV, Step)) {
533-
BaseIV = Builder.createDerivedIV(Kind, FPBinOp, StartV, CanonicalIV, Step,
534-
"offset.idx");
535-
}
531+
VPSingleDefRecipe *BaseIV = Builder.createDerivedIV(
532+
Kind, FPBinOp, StartV, CanonicalIV, Step, "offset.idx");
536533

537534
// Truncate base induction if needed.
538535
Type *CanonicalIVType = CanonicalIV->getScalarType();
@@ -1064,6 +1061,15 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
10641061

10651062
if (match(&R, m_Not(m_Not(m_VPValue(A)))))
10661063
return R.getVPSingleValue()->replaceAllUsesWith(A);
1064+
1065+
// Remove redundant DerviedIVs, that is 0 + A * 1 -> A and 0 + 0 * x -> 0.
1066+
if ((match(&R,
1067+
m_DerivedIV(m_SpecificInt(0), m_VPValue(A), m_SpecificInt(1))) ||
1068+
match(&R,
1069+
m_DerivedIV(m_SpecificInt(0), m_SpecificInt(0), m_VPValue()))) &&
1070+
TypeInfo.inferScalarType(R.getOperand(1)) ==
1071+
TypeInfo.inferScalarType(R.getVPSingleValue()))
1072+
return R.getVPSingleValue()->replaceAllUsesWith(R.getOperand(1));
10671073
}
10681074

10691075
/// Move loop-invariant recipes out of the vector loop region in \p Plan.
@@ -1252,11 +1258,11 @@ void VPlanTransforms::optimize(VPlan &Plan) {
12521258

12531259
simplifyRecipes(Plan);
12541260
legalizeAndOptimizeInductions(Plan);
1261+
removeRedundantExpandSCEVRecipes(Plan);
1262+
simplifyRecipes(Plan);
12551263
removeDeadRecipes(Plan);
12561264

12571265
createAndOptimizeReplicateRegions(Plan);
1258-
1259-
removeRedundantExpandSCEVRecipes(Plan);
12601266
mergeBlocksIntoPredecessors(Plan);
12611267
licm(Plan);
12621268
}

llvm/utils/TableGen/CallingConvEmitter.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,11 @@ void CallingConvEmitter::emitArgRegisterLists(raw_ostream &O) {
378378
const std::string &InnerCCName = InnerEntry.first;
379379
std::set<std::string> &InnerRegisters = InnerEntry.second;
380380

381-
if (InnerRegisters.find(CCName) != InnerRegisters.end()) {
382-
AssignedRegsMap[InnerCCName].insert(AssignedRegsMap[CCName].begin(),
383-
AssignedRegsMap[CCName].end());
384-
InnerRegisters.erase(CCName);
381+
auto It = InnerRegisters.find(CCName);
382+
if (It != InnerRegisters.end()) {
383+
const auto &Src = AssignedRegsMap[CCName];
384+
AssignedRegsMap[InnerCCName].insert(Src.begin(), Src.end());
385+
InnerRegisters.erase(It);
385386
}
386387
}
387388

0 commit comments

Comments
 (0)