Skip to content

Commit 7fe17b5

Browse files
authored
Merge branch 'main' into dev/dajusto/dont-asanize-catch-params-on-windows
2 parents 7d93177 + a99e32b commit 7fe17b5

File tree

10 files changed

+97
-192
lines changed

10 files changed

+97
-192
lines changed

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit,
344344
uint64_t SliceSizeInBits, Instruction *OldInst,
345345
Instruction *Inst, Value *Dest, Value *Value,
346346
const DataLayout &DL) {
347+
// If we want allocas to be migrated using this helper then we need to ensure
348+
// that the BaseFragments map code still works. A simple solution would be
349+
// to choose to always clone alloca dbg_assigns (rather than sometimes
350+
// "stealing" them).
351+
assert(!isa<AllocaInst>(Inst) && "Unexpected alloca");
352+
347353
auto DVRAssignMarkerRange = at::getDVRAssignmentMarkers(OldInst);
348354
// Nothing to do if OldInst has no linked dbg.assign intrinsics.
349355
if (DVRAssignMarkerRange.empty())
@@ -429,11 +435,22 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit,
429435
Inst->setMetadata(LLVMContext::MD_DIAssignID, NewID);
430436
}
431437

432-
::Value *NewValue = Value ? Value : DbgAssign->getValue();
433-
DbgVariableRecord *NewAssign = cast<DbgVariableRecord>(cast<DbgRecord *>(
434-
DIB.insertDbgAssign(Inst, NewValue, DbgAssign->getVariable(), Expr,
435-
Dest, DIExpression::get(Expr->getContext(), {}),
436-
DbgAssign->getDebugLoc())));
438+
DbgVariableRecord *NewAssign;
439+
if (IsSplit) {
440+
::Value *NewValue = Value ? Value : DbgAssign->getValue();
441+
NewAssign = cast<DbgVariableRecord>(cast<DbgRecord *>(
442+
DIB.insertDbgAssign(Inst, NewValue, DbgAssign->getVariable(), Expr,
443+
Dest, DIExpression::get(Expr->getContext(), {}),
444+
DbgAssign->getDebugLoc())));
445+
} else {
446+
// The store is not split, simply steal the existing dbg_assign.
447+
NewAssign = DbgAssign;
448+
NewAssign->setAssignId(NewID); // FIXME: Can we avoid generating new IDs?
449+
NewAssign->setAddress(Dest);
450+
if (Value)
451+
NewAssign->replaceVariableLocationOp(0u, Value);
452+
assert(Expr == NewAssign->getExpression());
453+
}
437454

438455
// If we've updated the value but the original dbg.assign has an arglist
439456
// then kill it now - we can't use the requested new value.
@@ -464,9 +481,10 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit,
464481
// noted as slightly offset (in code) from the store. In practice this
465482
// should have little effect on the debugging experience due to the fact
466483
// that all the split stores should get the same line number.
467-
NewAssign->moveBefore(DbgAssign->getIterator());
468-
469-
NewAssign->setDebugLoc(DbgAssign->getDebugLoc());
484+
if (NewAssign != DbgAssign) {
485+
NewAssign->moveBefore(DbgAssign->getIterator());
486+
NewAssign->setDebugLoc(DbgAssign->getDebugLoc());
487+
}
470488
LLVM_DEBUG(dbgs() << "Created new assign: " << *NewAssign << "\n");
471489
};
472490

polly/docs/ReleaseNotes.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,3 @@ In Polly |version| the following important changes have been incorporated.
1111
the new features that have recently been committed to our development
1212
branch.
1313

14-
* ScopInliner has been updated for the New Pass Manager.
15-

polly/include/polly/LinkAllPasses.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ struct PollyForcePassLinking {
119119

120120
namespace llvm {
121121
void initializeCodePreparationPass(llvm::PassRegistry &);
122-
void initializeScopInlinerWrapperPassPass(llvm::PassRegistry &);
122+
void initializeScopInlinerPass(llvm::PassRegistry &);
123123
void initializeScopDetectionWrapperPassPass(llvm::PassRegistry &);
124124
void initializeScopDetectionPrinterLegacyPassPass(llvm::PassRegistry &);
125125
void initializeScopInfoRegionPassPass(PassRegistry &);

polly/include/polly/ScopInliner.h

Lines changed: 0 additions & 34 deletions
This file was deleted.

polly/lib/Support/PollyPasses.def

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
#ifndef CGSCC_PASS
2-
#define CGSCC_PASS(NAME, CREATE_PASS, PARSER)
3-
#endif
4-
CGSCC_PASS("polly-inline", ScopInlinerPass(), parseNoOptions)
5-
#undef CGSCC_PASS
6-
71
#ifndef FUNCTION_ANALYSIS
82
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS)
93
#endif

polly/lib/Support/RegisterPasses.cpp

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "polly/ScopDetection.h"
3636
#include "polly/ScopGraphPrinter.h"
3737
#include "polly/ScopInfo.h"
38-
#include "polly/ScopInliner.h"
3938
#include "polly/Simplify.h"
4039
#include "polly/Support/DumpFunctionPass.h"
4140
#include "polly/Support/DumpModulePass.h"
@@ -47,13 +46,10 @@
4746
#include "llvm/Passes/PassBuilder.h"
4847
#include "llvm/Passes/PassPlugin.h"
4948
#include "llvm/Support/CommandLine.h"
50-
#include "llvm/Support/Error.h"
5149
#include "llvm/Support/TargetSelect.h"
5250
#include "llvm/Transforms/IPO.h"
5351

54-
using namespace llvm;
5552
namespace cl = llvm::cl;
56-
using namespace polly;
5753

5854
using llvm::FunctionPassManager;
5955
using llvm::OptimizationLevel;
@@ -237,7 +233,7 @@ void initializePollyPasses(llvm::PassRegistry &Registry) {
237233
initializePollyCanonicalizePass(Registry);
238234
initializeScopDetectionWrapperPassPass(Registry);
239235
initializeScopDetectionPrinterLegacyPassPass(Registry);
240-
initializeScopInlinerWrapperPassPass(Registry);
236+
initializeScopInlinerPass(Registry);
241237
initializeScopInfoRegionPassPass(Registry);
242238
initializeScopInfoPrinterLegacyRegionPassPass(Registry);
243239
initializeScopInfoWrapperPassPass(Registry);
@@ -438,16 +434,6 @@ static void buildLatePollyPipeline(FunctionPassManager &PM,
438434
false);
439435
}
440436

441-
static llvm::Expected<std::monostate> parseNoOptions(StringRef Params) {
442-
if (!Params.empty())
443-
return make_error<StringError>(
444-
formatv("'{0}' passed to pass that does not take any options", Params)
445-
.str(),
446-
inconvertibleErrorCode());
447-
448-
return std::monostate{};
449-
}
450-
451437
static OwningScopAnalysisManagerFunctionProxy
452438
createScopAnalyses(FunctionAnalysisManager &FAM,
453439
PassInstrumentationCallbacks *PIC) {
@@ -475,25 +461,6 @@ static void registerFunctionAnalyses(FunctionAnalysisManager &FAM,
475461
FAM.registerPass([&FAM, PIC] { return createScopAnalyses(FAM, PIC); });
476462
}
477463

478-
static llvm::Expected<bool>
479-
parseCGPipeline(StringRef Name, llvm::CGSCCPassManager &CGPM,
480-
PassInstrumentationCallbacks *PIC,
481-
ArrayRef<PassBuilder::PipelineElement> Pipeline) {
482-
assert(Pipeline.empty());
483-
484-
#define CGSCC_PASS(NAME, CREATE_PASS, PARSER) \
485-
if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
486-
auto Params = PassBuilder::parsePassParameters(PARSER, Name, NAME); \
487-
if (!Params) \
488-
return Params.takeError(); \
489-
CGPM.addPass(CREATE_PASS); \
490-
return true; \
491-
}
492-
#include "PollyPasses.def"
493-
494-
return false;
495-
}
496-
497464
static bool
498465
parseFunctionPipeline(StringRef Name, FunctionPassManager &FPM,
499466
ArrayRef<PassBuilder::PipelineElement> Pipeline) {
@@ -631,12 +598,6 @@ void registerPollyPasses(PassBuilder &PB) {
631598
ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
632599
return parseScopPipeline(Name, FPM, PIC, Pipeline);
633600
});
634-
PB.registerPipelineParsingCallback(
635-
[PIC](StringRef Name, CGSCCPassManager &CGPM,
636-
ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {
637-
ExitOnError Err("Unable to parse Polly call graph pass: ");
638-
return Err(parseCGPipeline(Name, CGPM, PIC, Pipeline));
639-
});
640601
PB.registerParseTopLevelPipelineCallback(
641602
[PIC](llvm::ModulePassManager &MPM,
642603
ArrayRef<PassBuilder::PipelineElement> Pipeline) -> bool {

0 commit comments

Comments
 (0)