Skip to content

Commit a05af56

Browse files
authored
Merge branch 'main' into p/libc-hdrgen-noargs
2 parents de22bcc + 1fa02b9 commit a05af56

File tree

75 files changed

+3596
-1899
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3596
-1899
lines changed

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,12 @@ class BinaryContext {
13631363
if (std::optional<uint32_t> Size = MIB->getSize(Inst))
13641364
return *Size;
13651365

1366+
if (MIB->isPseudo(Inst))
1367+
return 0;
1368+
1369+
if (std::optional<uint32_t> Size = MIB->getInstructionSize(Inst))
1370+
return *Size;
1371+
13661372
if (!Emitter)
13671373
Emitter = this->MCE.get();
13681374
SmallString<256> Code;

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,11 @@ class MCPlusBuilder {
12041204
/// Get instruction size specified via annotation.
12051205
std::optional<uint32_t> getSize(const MCInst &Inst) const;
12061206

1207+
/// Get target-specific instruction size.
1208+
virtual std::optional<uint32_t> getInstructionSize(const MCInst &Inst) const {
1209+
return std::nullopt;
1210+
}
1211+
12071212
/// Set instruction size.
12081213
void setSize(MCInst &Inst, uint32_t Size) const;
12091214

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,11 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
17921792
}
17931793

17941794
uint16_t getMinFunctionAlignment() const override { return 4; }
1795+
1796+
std::optional<uint32_t>
1797+
getInstructionSize(const MCInst &Inst) const override {
1798+
return 4;
1799+
}
17951800
};
17961801

17971802
} // end anonymous namespace

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3607,18 +3607,15 @@ void CodeGenFunction::EmitCheck(
36073607
llvm::Value *RecoverableCond = nullptr;
36083608
llvm::Value *TrapCond = nullptr;
36093609
bool NoMerge = false;
3610-
for (int i = 0, n = Checked.size(); i < n; ++i) {
3611-
llvm::Value *Check = Checked[i].first;
3610+
for (auto &[Check, Ord] : Checked) {
36123611
// -fsanitize-trap= overrides -fsanitize-recover=.
3613-
llvm::Value *&Cond =
3614-
CGM.getCodeGenOpts().SanitizeTrap.has(Checked[i].second)
3615-
? TrapCond
3616-
: CGM.getCodeGenOpts().SanitizeRecover.has(Checked[i].second)
3617-
? RecoverableCond
3618-
: FatalCond;
3612+
llvm::Value *&Cond = CGM.getCodeGenOpts().SanitizeTrap.has(Ord) ? TrapCond
3613+
: CGM.getCodeGenOpts().SanitizeRecover.has(Ord)
3614+
? RecoverableCond
3615+
: FatalCond;
36193616
Cond = Cond ? Builder.CreateAnd(Cond, Check) : Check;
36203617

3621-
if (!CGM.getCodeGenOpts().SanitizeMergeHandlers.has(Checked[i].second))
3618+
if (!CGM.getCodeGenOpts().SanitizeMergeHandlers.has(Ord))
36223619
NoMerge = true;
36233620
}
36243621

flang/include/flang/Optimizer/Builder/HLFIRTools.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -513,12 +513,6 @@ genTypeAndKindConvert(mlir::Location loc, fir::FirOpBuilder &builder,
513513
Entity loadElementAt(mlir::Location loc, fir::FirOpBuilder &builder,
514514
Entity entity, mlir::ValueRange oneBasedIndices);
515515

516-
/// Return a vector of extents for the given entity.
517-
/// The function creates new operations, but tries to clean-up
518-
/// after itself.
519-
llvm::SmallVector<mlir::Value>
520-
genExtentsVector(mlir::Location loc, fir::FirOpBuilder &builder, Entity entity);
521-
522516
} // namespace hlfir
523517

524518
#endif // FORTRAN_OPTIMIZER_BUILDER_HLFIRTOOLS_H

flang/lib/Optimizer/Builder/HLFIRTools.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,15 +1421,3 @@ hlfir::Entity hlfir::loadElementAt(mlir::Location loc,
14211421
return loadTrivialScalar(loc, builder,
14221422
getElementAt(loc, builder, entity, oneBasedIndices));
14231423
}
1424-
1425-
llvm::SmallVector<mlir::Value>
1426-
hlfir::genExtentsVector(mlir::Location loc, fir::FirOpBuilder &builder,
1427-
hlfir::Entity entity) {
1428-
entity = hlfir::derefPointersAndAllocatables(loc, builder, entity);
1429-
mlir::Value shape = hlfir::genShape(loc, builder, entity);
1430-
llvm::SmallVector<mlir::Value, Fortran::common::maxRank> extents =
1431-
hlfir::getExplicitExtentsFromShape(shape, builder);
1432-
if (shape.getUses().empty())
1433-
shape.getDefiningOp()->erase();
1434-
return extents;
1435-
}

0 commit comments

Comments
 (0)