Skip to content

Commit

Permalink
Merge branch 'llvm:main' into macPro
Browse files Browse the repository at this point in the history
  • Loading branch information
ghehg authored Nov 22, 2024
2 parents d125844 + dbd3e03 commit 95166ad
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 48 deletions.
4 changes: 2 additions & 2 deletions clang/lib/CIR/Dialect/IR/CIRDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2023,8 +2023,8 @@ LogicalResult
cir::GetGlobalOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
// Verify that the result type underlying pointer type matches the type of
// the referenced cir.global or cir.func op.
auto op = symbolTable.lookupNearestSymbolFrom(*this, getNameAttr());
if (!(isa<GlobalOp>(op) || isa<FuncOp>(op)))
auto *op = symbolTable.lookupNearestSymbolFrom(*this, getNameAttr());
if (op == nullptr || !(isa<GlobalOp>(op) || isa<FuncOp>(op)))
return emitOpError("'")
<< getName()
<< "' does not reference a valid cir.global or cir.func";
Expand Down
135 changes: 89 additions & 46 deletions clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3859,55 +3859,98 @@ void populateCIRToLLVMConversionPatterns(
stringGlobalsMap, argStringGlobalsMap,
argsVarMap, patterns.getContext());
patterns.add<
CIRToLLVMCmpOpLowering, CIRToLLVMSelectOpLowering,
CIRToLLVMBitClrsbOpLowering, CIRToLLVMBitClzOpLowering,
CIRToLLVMBitCtzOpLowering, CIRToLLVMBitFfsOpLowering,
CIRToLLVMBitParityOpLowering, CIRToLLVMBitPopcountOpLowering,
CIRToLLVMAtomicCmpXchgLowering, CIRToLLVMAtomicXchgLowering,
CIRToLLVMAtomicFetchLowering, CIRToLLVMByteswapOpLowering,
CIRToLLVMRotateOpLowering, CIRToLLVMBrCondOpLowering,
CIRToLLVMPtrStrideOpLowering, CIRToLLVMCallOpLowering,
CIRToLLVMTryCallOpLowering, CIRToLLVMEhInflightOpLowering,
CIRToLLVMUnaryOpLowering, CIRToLLVMBinOpLowering,
CIRToLLVMBinOpOverflowOpLowering, CIRToLLVMShiftOpLowering,
CIRToLLVMLoadOpLowering, CIRToLLVMConstantOpLowering,
CIRToLLVMStoreOpLowering, CIRToLLVMFuncOpLowering,
CIRToLLVMCastOpLowering, CIRToLLVMGlobalOpLowering,
CIRToLLVMGetGlobalOpLowering, CIRToLLVMComplexCreateOpLowering,
CIRToLLVMComplexRealOpLowering, CIRToLLVMComplexImagOpLowering,
CIRToLLVMComplexRealPtrOpLowering, CIRToLLVMComplexImagPtrOpLowering,
CIRToLLVMVAStartOpLowering, CIRToLLVMVAEndOpLowering,
CIRToLLVMVACopyOpLowering, CIRToLLVMVAArgOpLowering,
CIRToLLVMBrOpLowering, CIRToLLVMGetMemberOpLowering,
CIRToLLVMGetRuntimeMemberOpLowering, CIRToLLVMSwitchFlatOpLowering,
CIRToLLVMPtrDiffOpLowering, CIRToLLVMCopyOpLowering,
CIRToLLVMMemCpyOpLowering, CIRToLLVMMemChrOpLowering,
CIRToLLVMAbsOpLowering, CIRToLLVMExpectOpLowering,
CIRToLLVMVTableAddrPointOpLowering, CIRToLLVMVecCreateOpLowering,
CIRToLLVMVecCmpOpLowering, CIRToLLVMVecSplatOpLowering,
CIRToLLVMVecTernaryOpLowering, CIRToLLVMVecShuffleDynamicOpLowering,
CIRToLLVMVecShuffleOpLowering, CIRToLLVMStackSaveOpLowering,
CIRToLLVMUnreachableOpLowering, CIRToLLVMTrapOpLowering,
CIRToLLVMInlineAsmOpLowering, CIRToLLVMSetBitfieldOpLowering,
CIRToLLVMGetBitfieldOpLowering, CIRToLLVMPrefetchOpLowering,
CIRToLLVMObjSizeOpLowering, CIRToLLVMIsConstantOpLowering,
CIRToLLVMCmpThreeWayOpLowering, CIRToLLVMMemCpyOpLowering,
CIRToLLVMIsConstantOpLowering, CIRToLLVMCmpThreeWayOpLowering,
CIRToLLVMReturnAddrOpLowering, CIRToLLVMClearCacheOpLowering,
CIRToLLVMEhTypeIdOpLowering, CIRToLLVMCatchParamOpLowering,
CIRToLLVMResumeOpLowering, CIRToLLVMAllocExceptionOpLowering,
CIRToLLVMFreeExceptionOpLowering, CIRToLLVMThrowOpLowering,
CIRToLLVMLLVMIntrinsicCallOpLowering, CIRToLLVMAssumeOpLowering,
CIRToLLVMAssumeAlignedOpLowering, CIRToLLVMAssumeSepStorageOpLowering,
CIRToLLVMBaseClassAddrOpLowering, CIRToLLVMDerivedClassAddrOpLowering,
CIRToLLVMVTTAddrPointOpLowering, CIRToLLVMIsFPClassOpLowering,
CIRToLLVMAbsOpLowering, CIRToLLVMMemMoveOpLowering,
CIRToLLVMMemSetOpLowering, CIRToLLVMMemSetInlineOpLowering,
CIRToLLVMMemCpyInlineOpLowering, CIRToLLVMSignBitOpLowering,
CIRToLLVMPtrMaskOpLowering
// clang-format off
CIRToLLVMAbsOpLowering,
CIRToLLVMAllocExceptionOpLowering,
CIRToLLVMAssumeAlignedOpLowering,
CIRToLLVMAssumeOpLowering,
CIRToLLVMAssumeSepStorageOpLowering,
CIRToLLVMAtomicCmpXchgLowering,
CIRToLLVMAtomicFetchLowering,
CIRToLLVMAtomicXchgLowering,
CIRToLLVMBaseClassAddrOpLowering,
CIRToLLVMBinOpLowering,
CIRToLLVMBinOpOverflowOpLowering,
CIRToLLVMBitClrsbOpLowering,
CIRToLLVMBitClzOpLowering,
CIRToLLVMBitCtzOpLowering,
CIRToLLVMBitFfsOpLowering,
CIRToLLVMBitParityOpLowering,
CIRToLLVMBitPopcountOpLowering,
CIRToLLVMBrCondOpLowering,
CIRToLLVMBrOpLowering,
CIRToLLVMByteswapOpLowering,
CIRToLLVMCallOpLowering,
CIRToLLVMCastOpLowering,
CIRToLLVMCatchParamOpLowering,
CIRToLLVMClearCacheOpLowering,
CIRToLLVMCmpOpLowering,
CIRToLLVMCmpThreeWayOpLowering,
CIRToLLVMComplexCreateOpLowering,
CIRToLLVMComplexImagOpLowering,
CIRToLLVMComplexImagPtrOpLowering,
CIRToLLVMComplexRealOpLowering,
CIRToLLVMComplexRealPtrOpLowering,
CIRToLLVMConstantOpLowering,
CIRToLLVMCopyOpLowering,
CIRToLLVMDerivedClassAddrOpLowering,
CIRToLLVMEhInflightOpLowering,
CIRToLLVMEhTypeIdOpLowering,
CIRToLLVMExpectOpLowering,
CIRToLLVMFreeExceptionOpLowering,
CIRToLLVMFuncOpLowering,
CIRToLLVMGetBitfieldOpLowering,
CIRToLLVMGetGlobalOpLowering,
CIRToLLVMGetMemberOpLowering,
CIRToLLVMGetRuntimeMemberOpLowering,
CIRToLLVMGlobalOpLowering,
CIRToLLVMInlineAsmOpLowering,
CIRToLLVMIsConstantOpLowering,
CIRToLLVMIsFPClassOpLowering,
CIRToLLVMLLVMIntrinsicCallOpLowering,
CIRToLLVMLoadOpLowering,
CIRToLLVMMemChrOpLowering,
CIRToLLVMMemCpyInlineOpLowering,
CIRToLLVMMemCpyOpLowering,
CIRToLLVMMemMoveOpLowering,
CIRToLLVMMemSetInlineOpLowering,
CIRToLLVMMemSetOpLowering,
CIRToLLVMObjSizeOpLowering,
CIRToLLVMPrefetchOpLowering,
CIRToLLVMPtrDiffOpLowering,
CIRToLLVMPtrMaskOpLowering,
CIRToLLVMPtrStrideOpLowering,
CIRToLLVMResumeOpLowering,
CIRToLLVMReturnAddrOpLowering,
CIRToLLVMRotateOpLowering,
CIRToLLVMSelectOpLowering,
CIRToLLVMSetBitfieldOpLowering,
CIRToLLVMShiftOpLowering,
CIRToLLVMSignBitOpLowering,
CIRToLLVMStackSaveOpLowering,
CIRToLLVMStoreOpLowering,
CIRToLLVMSwitchFlatOpLowering,
CIRToLLVMThrowOpLowering,
CIRToLLVMTrapOpLowering,
CIRToLLVMTryCallOpLowering,
CIRToLLVMUnaryOpLowering,
CIRToLLVMUnreachableOpLowering,
CIRToLLVMVAArgOpLowering,
CIRToLLVMVACopyOpLowering,
CIRToLLVMVAEndOpLowering,
CIRToLLVMVAStartOpLowering,
CIRToLLVMVecCmpOpLowering,
CIRToLLVMVecCreateOpLowering,
CIRToLLVMVecShuffleDynamicOpLowering,
CIRToLLVMVecShuffleOpLowering,
CIRToLLVMVecSplatOpLowering,
CIRToLLVMVecTernaryOpLowering,
CIRToLLVMVTableAddrPointOpLowering,
CIRToLLVMVTTAddrPointOpLowering
#define GET_BUILTIN_LOWERING_LIST
#include "clang/CIR/Dialect/IR/CIRBuiltinsLowering.inc"
#undef GET_BUILTIN_LOWERING_LIST
// clang-format on
>(converter, patterns.getContext());
}

Expand Down
9 changes: 9 additions & 0 deletions clang/test/CIR/IR/invalid.cir
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,15 @@ module {

// -----

!s8i = !cir.int<s, 8>
cir.func @no_reference_global() {
// expected-error @below {{'cir.get_global' op 'str' does not reference a valid cir.global or cir.func}}
%0 = cir.get_global @str : !cir.ptr<!s8i>
cir.return
}

// -----

// expected-error@+1 {{invalid underlying type for long double}}
cir.func @bad_long_double(%arg0 : !cir.long_double<!cir.float>) -> () {
cir.return
Expand Down

0 comments on commit 95166ad

Please sign in to comment.