Skip to content

Commit 49c66ab

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:b590ba73a76609bace9949ea8195d2ee8213cb3f into amd-gfx:300e9c581b42
Local branch amd-gfx 300e9c5 Manually merged main:bafda89a0944d947fc4b3b5663185e07a397ac30 into amd-gfx:2e4aa61a46dc Remote branch main b590ba7 [NFC] Rename DependentModules in ModuleFile to `TransitiveImports`
2 parents 300e9c5 + b590ba7 commit 49c66ab

File tree

10 files changed

+41
-16
lines changed

10 files changed

+41
-16
lines changed

clang/include/clang/Serialization/ASTReader.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,11 +601,11 @@ class ASTReader
601601

602602
/// An array of lexical contents of a declaration context, as a sequence of
603603
/// Decl::Kind, DeclID pairs.
604-
using unalighed_decl_id_t =
604+
using unaligned_decl_id_t =
605605
llvm::support::detail::packed_endian_specific_integral<
606606
serialization::DeclID, llvm::endianness::native,
607607
llvm::support::unaligned>;
608-
using LexicalContents = ArrayRef<unalighed_decl_id_t>;
608+
using LexicalContents = ArrayRef<unaligned_decl_id_t>;
609609

610610
/// Map from a DeclContext to its lexical contents.
611611
llvm::DenseMap<const DeclContext*, std::pair<ModuleFile*, LexicalContents>>
@@ -2246,7 +2246,7 @@ class ASTReader
22462246

22472247
auto [Loc, ModuleFileIndex] = ReadUntranslatedSourceLocation(Raw, Seq);
22482248
ModuleFile *OwningModuleFile =
2249-
ModuleFileIndex == 0 ? &MF : MF.DependentModules[ModuleFileIndex - 1];
2249+
ModuleFileIndex == 0 ? &MF : MF.TransitiveImports[ModuleFileIndex - 1];
22502250

22512251
assert(!SourceMgr.isLoadedSourceLocation(Loc) &&
22522252
"Run out source location space");

clang/include/clang/Serialization/ModuleFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,11 @@ class ModuleFile {
513513

514514
/// List of modules which this modules dependent on. Different
515515
/// from `Imports`, this includes indirectly imported modules too.
516-
/// The order of DependentModules is significant. It should keep
516+
/// The order of TransitiveImports is significant. It should keep
517517
/// the same order with that module file manager when we write
518518
/// the current module file. The value of the member will be initialized
519519
/// in `ASTReader::ReadModuleOffsetMap`.
520-
llvm::SmallVector<ModuleFile *, 16> DependentModules;
520+
llvm::SmallVector<ModuleFile *, 16> TransitiveImports;
521521

522522
/// Determine whether this module was directly imported at
523523
/// any point during translation.

clang/lib/Serialization/ASTReader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ bool ASTReader::ReadLexicalDeclContextStorage(ModuleFile &M,
12641264
if (!Lex.first) {
12651265
Lex = std::make_pair(
12661266
&M, llvm::ArrayRef(
1267-
reinterpret_cast<const unalighed_decl_id_t *>(Blob.data()),
1267+
reinterpret_cast<const unaligned_decl_id_t *>(Blob.data()),
12681268
Blob.size() / sizeof(DeclID)));
12691269
}
12701270
DC->setHasExternalLexicalStorage(true);
@@ -3401,7 +3401,7 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F,
34013401
case TU_UPDATE_LEXICAL: {
34023402
DeclContext *TU = ContextObj->getTranslationUnitDecl();
34033403
LexicalContents Contents(
3404-
reinterpret_cast<const unalighed_decl_id_t *>(Blob.data()),
3404+
reinterpret_cast<const unaligned_decl_id_t *>(Blob.data()),
34053405
static_cast<unsigned int>(Blob.size() / sizeof(DeclID)));
34063406
TULexicalDecls.push_back(std::make_pair(&F, Contents));
34073407
TU->setHasExternalLexicalStorage(true);
@@ -4059,7 +4059,7 @@ void ASTReader::ReadModuleOffsetMap(ModuleFile &F) const {
40594059
RemapBuilder DeclRemap(F.DeclRemap);
40604060
RemapBuilder TypeRemap(F.TypeRemap);
40614061

4062-
auto &ImportedModuleVector = F.DependentModules;
4062+
auto &ImportedModuleVector = F.TransitiveImports;
40634063
assert(ImportedModuleVector.empty());
40644064

40654065
while (Data < DataEnd) {

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 499824
19+
#define LLVM_MAIN_REVISION 499830
2020

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

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,8 +1801,11 @@ void DAGCombiner::Run(CombineLevel AtLevel) {
18011801

18021802
if (N->getNumValues() == RV->getNumValues())
18031803
DAG.ReplaceAllUsesWith(N, RV.getNode());
1804-
else
1804+
else {
1805+
assert(N->getValueType(0) == RV.getValueType() &&
1806+
N->getNumValues() == 1 && "Type mismatch");
18051807
DAG.ReplaceAllUsesWith(N, &RV);
1808+
}
18061809

18071810
// Push the new node and any users onto the worklist. Omit this if the
18081811
// new node is the EntryToken (e.g. if a store managed to get optimized

llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,9 +723,10 @@ void X86AsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
723723
bool X86AsmBackend::mayNeedRelaxation(const MCInst &MI,
724724
const MCSubtargetInfo &STI) const {
725725
unsigned Opcode = MI.getOpcode();
726+
unsigned SkipOperands = X86::isCCMPCC(Opcode) ? 2 : 0;
726727
return isRelaxableBranch(Opcode) ||
727728
(X86::getOpcodeForLongImmediateForm(Opcode) != Opcode &&
728-
MI.getOperand(MI.getNumOperands() - 1).isExpr());
729+
MI.getOperand(MI.getNumOperands() - 1 - SkipOperands).isExpr());
729730
}
730731

731732
bool X86AsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,

llvm/lib/Target/X86/MCTargetDesc/X86EncodingOptimizationForImmediate.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ ENTRY(CMP32mi, CMP32mi8)
1818
ENTRY(CMP32ri, CMP32ri8)
1919
ENTRY(CMP64mi32, CMP64mi8)
2020
ENTRY(CMP64ri32, CMP64ri8)
21+
ENTRY(CCMP16mi, CCMP16mi8)
22+
ENTRY(CCMP16ri, CCMP16ri8)
23+
ENTRY(CCMP32mi, CCMP32mi8)
24+
ENTRY(CCMP32ri, CCMP32ri8)
25+
ENTRY(CCMP64mi32, CCMP64mi8)
26+
ENTRY(CCMP64ri32, CCMP64ri8)
2127
ENTRY(PUSH16i, PUSH16i8)
2228
ENTRY(PUSH32i, PUSH32i8)
2329
ENTRY(PUSH64i32, PUSH64i8)

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49239,8 +49239,7 @@ static SDValue combineX86SubCmpForFlags(SDNode *N, SDValue Flag,
4923949239

4924049240
SDValue SetCC = N->getOperand(0);
4924149241

49242-
// TODO: Remove the check hasCCMP() and update the non-APX tests.
49243-
if (!ST.hasCCMP() || SetCC.getOpcode() != X86ISD::SETCC || !Flag.hasOneUse())
49242+
if (SetCC.getOpcode() != X86ISD::SETCC || !Flag.hasOneUse())
4924449243
return SDValue();
4924549244

4924649245
// Check the only user of flag is `brcond ne`.
@@ -49253,8 +49252,10 @@ static SDValue combineX86SubCmpForFlags(SDNode *N, SDValue Flag,
4925349252
return SDValue();
4925449253

4925549254
SDValue X = SetCC.getOperand(1);
49256-
// Replace API is called manually here b/c the number of results may change.
49257-
DAG.ReplaceAllUsesOfValueWith(Flag, X);
49255+
// sub has two results while X only have one. DAG combine assumes the value
49256+
// type matches.
49257+
if (N->getOpcode() == X86ISD::SUB)
49258+
X = DAG.getMergeValues({N->getOperand(0), X}, SDLoc(N));
4925849259

4925949260
SDValue CCN = SetCC.getOperand(0);
4926049261
X86::CondCode CC =

llvm/lib/Target/X86/X86Subtarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef TuneCPU,
252252
CPU = "generic";
253253

254254
if (TuneCPU.empty())
255-
TuneCPU = HasX86_64 ? "generic" : "i586";
255+
TuneCPU = "i586"; // FIXME: "generic" is more modern than llc tests expect.
256256

257257
std::string FullFS = X86_MC::ParseX86Triple(TargetTriple);
258258
assert(!FullFS.empty() && "Failed to parse X86 triple");

llvm/test/MC/X86/apx/ccmp-reloc.s

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: llvm-mc -triple x86_64-linux-gnu -filetype=obj %s | llvm-readobj -r - | FileCheck %s
2+
3+
// CHECK: Relocations [
4+
// CHECK-NEXT: Section ({{[0-9]+}}) .rela.text {
5+
ccmpbb {dfv=of} $foo, %bl // CHECK-NEXT: R_X86_64_8
6+
ccmpbb {dfv=of} $foo, 123(%r8,%rax,4) // CHECK-NEXT: R_X86_64_8
7+
ccmpbw {dfv=of} $foo, %bx // CHECK-NEXT: R_X86_64_16
8+
ccmpbw {dfv=of} $foo, 123(%r8,%rax,4) // CHECK-NEXT: R_X86_64_16
9+
ccmpbl {dfv=of} $foo, %ebx // CHECK-NEXT: R_X86_64_32
10+
ccmpbl {dfv=of} $foo, 123(%r8,%rax,4) // CHECK-NEXT: R_X86_64_32
11+
ccmpbq {dfv=of} $foo, %rbx // CHECK-NEXT: R_X86_64_32S
12+
ccmpbq {dfv=of} $foo, 123(%r8,%rax,4) // CHECK-NEXT: R_X86_64_32S
13+
// CHECK-NEXT: }
14+
// CHECK-NEXT: ]

0 commit comments

Comments
 (0)