Skip to content

Commit ba4bd9e

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#3608)
2 parents 250e45d + 5f19228 commit ba4bd9e

File tree

6 files changed

+45
-65
lines changed

6 files changed

+45
-65
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6745,6 +6745,22 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
67456745
// value.
67466746
bool IsReference = D->getType()->isReferenceType();
67476747

6748+
// Function parameters.
6749+
// Note that it's important to check them first since we might have a local
6750+
// variable created for a ParmVarDecl as well.
6751+
if (const auto *PVD = dyn_cast<ParmVarDecl>(D)) {
6752+
if (Ctx.getLangOpts().CPlusPlus && !Ctx.getLangOpts().CPlusPlus11 &&
6753+
!D->getType()->isIntegralOrEnumerationType()) {
6754+
return this->emitInvalidDeclRef(cast<DeclRefExpr>(E),
6755+
/*InitializerFailed=*/false, E);
6756+
}
6757+
if (auto It = this->Params.find(PVD); It != this->Params.end()) {
6758+
if (IsReference || !It->second.IsPtr)
6759+
return this->emitGetParam(classifyPrim(E), It->second.Offset, E);
6760+
6761+
return this->emitGetPtrParam(It->second.Offset, E);
6762+
}
6763+
}
67486764
// Local variables.
67496765
if (auto It = Locals.find(D); It != Locals.end()) {
67506766
const unsigned Offset = It->second.Offset;
@@ -6762,20 +6778,6 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
67626778

67636779
return this->emitGetPtrGlobal(*GlobalIndex, E);
67646780
}
6765-
// Function parameters.
6766-
if (const auto *PVD = dyn_cast<ParmVarDecl>(D)) {
6767-
if (Ctx.getLangOpts().CPlusPlus && !Ctx.getLangOpts().CPlusPlus11 &&
6768-
!D->getType()->isIntegralOrEnumerationType()) {
6769-
return this->emitInvalidDeclRef(cast<DeclRefExpr>(E),
6770-
/*InitializerFailed=*/false, E);
6771-
}
6772-
if (auto It = this->Params.find(PVD); It != this->Params.end()) {
6773-
if (IsReference || !It->second.IsPtr)
6774-
return this->emitGetParam(classifyPrim(E), It->second.Offset, E);
6775-
6776-
return this->emitGetPtrParam(It->second.Offset, E);
6777-
}
6778-
}
67796781

67806782
// In case we need to re-visit a declaration.
67816783
auto revisit = [&](const VarDecl *VD) -> bool {

clang/test/AST/ByteCode/functions.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,3 +713,22 @@ namespace EnableIfWithTemporary {
713713
struct A { ~A(); };
714714
int &h() __attribute__((enable_if((A(), true), ""))); // both-warning {{clang extension}}
715715
}
716+
717+
namespace LocalVarForParmVarDecl {
718+
struct Iter {
719+
void *p;
720+
};
721+
constexpr bool bar2(Iter A) {
722+
return true;
723+
}
724+
constexpr bool bar(Iter A, bool b) {
725+
if (b)
726+
return true;
727+
728+
return bar(A, true);
729+
}
730+
constexpr int foo() {
731+
return bar(Iter(), false);
732+
}
733+
static_assert(foo(), "");
734+
}

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,11 +1787,8 @@ const char *PPCTargetLowering::getTargetNodeName(unsigned Opcode) const {
17871787
case PPCISD::ADDI_DTPREL_L: return "PPCISD::ADDI_DTPREL_L";
17881788
case PPCISD::PADDI_DTPREL:
17891789
return "PPCISD::PADDI_DTPREL";
1790-
case PPCISD::VADD_SPLAT: return "PPCISD::VADD_SPLAT";
1791-
case PPCISD::SC: return "PPCISD::SC";
1792-
case PPCISD::CLRBHRB: return "PPCISD::CLRBHRB";
1793-
case PPCISD::MFBHRBE: return "PPCISD::MFBHRBE";
1794-
case PPCISD::RFEBB: return "PPCISD::RFEBB";
1790+
case PPCISD::VADD_SPLAT:
1791+
return "PPCISD::VADD_SPLAT";
17951792
case PPCISD::XXSWAPD: return "PPCISD::XXSWAPD";
17961793
case PPCISD::SWAP_NO_CHAIN: return "PPCISD::SWAP_NO_CHAIN";
17971794
case PPCISD::BUILD_FP128: return "PPCISD::BUILD_FP128";

llvm/lib/Target/PowerPC/PPCISelLowering.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -430,20 +430,6 @@ namespace llvm {
430430
/// optimizations due to constant folding.
431431
VADD_SPLAT,
432432

433-
/// CHAIN = SC CHAIN, Imm128 - System call. The 7-bit unsigned
434-
/// operand identifies the operating system entry point.
435-
SC,
436-
437-
/// CHAIN = CLRBHRB CHAIN - Clear branch history rolling buffer.
438-
CLRBHRB,
439-
440-
/// GPRC, CHAIN = MFBHRBE CHAIN, Entry, Dummy - Move from branch
441-
/// history rolling buffer entry.
442-
MFBHRBE,
443-
444-
/// CHAIN = RFEBB CHAIN, State - Return from event-based branch.
445-
RFEBB,
446-
447433
/// VSRC, CHAIN = XXSWAPD CHAIN, VSRC - Occurs only for little
448434
/// endian. Maps to an xxswapd instruction that corrects an lxvd2x
449435
/// or stxvd2x instruction. The chain is necessary because the

llvm/lib/Target/PowerPC/PPCInstrInfo.td

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,6 @@ def PPCeh_sjlj_longjmp : SDNode<"PPCISD::EH_SJLJ_LONGJMP",
365365
SDTypeProfile<0, 1, [SDTCisPtrTy<0>]>,
366366
[SDNPHasChain, SDNPSideEffect]>;
367367

368-
def SDT_PPCsc : SDTypeProfile<0, 1, [SDTCisInt<0>]>;
369-
def PPCsc : SDNode<"PPCISD::SC", SDT_PPCsc,
370-
[SDNPHasChain, SDNPSideEffect]>;
371-
372-
def PPCclrbhrb : SDNode<"PPCISD::CLRBHRB", SDTNone,
373-
[SDNPHasChain, SDNPSideEffect]>;
374-
def PPCmfbhrbe : SDNode<"PPCISD::MFBHRBE", SDTIntBinOp, [SDNPHasChain]>;
375-
def PPCrfebb : SDNode<"PPCISD::RFEBB", SDT_PPCsc,
376-
[SDNPHasChain, SDNPSideEffect]>;
377-
378368
def PPCvcmp : SDNode<"PPCISD::VCMP" , SDT_PPCvcmp, []>;
379369
def PPCvcmp_rec : SDNode<"PPCISD::VCMP_rec", SDT_PPCvcmp, [SDNPOutGlue]>;
380370

@@ -1673,7 +1663,7 @@ let isBranch = 1, isTerminator = 1, Size = 0 in {
16731663
// System call.
16741664
let PPC970_Unit = 7 in {
16751665
def SC : SCForm<17, 1, 0, (outs), (ins i32imm:$LEV),
1676-
"sc $LEV", IIC_BrB, [(PPCsc (i32 imm:$LEV))]>;
1666+
"sc $LEV", IIC_BrB, []>;
16771667
}
16781668

16791669
// We mark SCV as having no scheduling model since it is only meant to be used
@@ -1685,21 +1675,14 @@ let Predicates = [IsISA3_0], hasNoSchedulingInfo = 1 in {
16851675
}
16861676

16871677
// Branch history rolling buffer.
1688-
def CLRBHRB : XForm_0<31, 430, (outs), (ins), "clrbhrb", IIC_BrB,
1689-
[(PPCclrbhrb)]>,
1678+
def CLRBHRB : XForm_0<31, 430, (outs), (ins), "clrbhrb", IIC_BrB, []>,
16901679
PPC970_DGroup_Single;
1691-
// The $dmy argument used for MFBHRBE is not needed; however, including
1692-
// it avoids automatic generation of PPCFastISel::fastEmit_i(), which
1693-
// interferes with necessary special handling (see PPCFastISel.cpp).
1694-
def MFBHRBE : XFXForm_3p<31, 302, (outs gprc:$RT),
1695-
(ins u10imm:$imm, u10imm:$dmy),
1696-
"mfbhrbe $RT, $imm", IIC_BrB,
1697-
[(set i32:$RT,
1698-
(PPCmfbhrbe imm:$imm, imm:$dmy))]>,
1680+
1681+
def MFBHRBE : XFXForm_3p<31, 302, (outs gprc:$RT), (ins u10imm:$imm),
1682+
"mfbhrbe $RT, $imm", IIC_BrB, []>,
16991683
PPC970_DGroup_First;
17001684

1701-
def RFEBB : XLForm_S<19, 146, (outs), (ins u1imm:$S), "rfebb $S",
1702-
IIC_BrB, [(PPCrfebb (i32 imm:$S))]>,
1685+
def RFEBB : XLForm_S<19, 146, (outs), (ins u1imm:$S), "rfebb $S", IIC_BrB, []>,
17031686
PPC970_DGroup_Single;
17041687

17051688
def : InstAlias<"rfebb", (RFEBB 1)>;

mlir/lib/Dialect/SparseTensor/Pipelines/SparseTensorPipelines.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,13 @@ void mlir::sparse_tensor::buildSparsifier(OpPassManager &pm,
7171
pm.addPass(createLowerAffinePass());
7272
pm.addPass(
7373
createConvertVectorToLLVMPass(options.convertVectorToLLVMOptions()));
74-
pm.addPass(createFinalizeMemRefToLLVMConversionPass());
7574
pm.addNestedPass<func::FuncOp>(createConvertComplexToStandardPass());
7675
pm.addNestedPass<func::FuncOp>(arith::createArithExpandOpsPass());
7776
pm.addNestedPass<func::FuncOp>(createConvertMathToLLVMPass());
7877
pm.addPass(createConvertMathToLibmPass());
7978
pm.addPass(createConvertComplexToLibm());
8079
pm.addPass(
8180
createConvertVectorToLLVMPass(options.convertVectorToLLVMOptions()));
82-
pm.addPass(createConvertComplexToLLVMPass());
83-
pm.addPass(
84-
createConvertVectorToLLVMPass(options.convertVectorToLLVMOptions()));
85-
pm.addPass(createConvertFuncToLLVMPass());
86-
pm.addPass(createArithToLLVMConversionPass());
87-
pm.addPass(createConvertControlFlowToLLVMPass());
8881

8982
// Finalize GPU code generation.
9083
if (gpuCodegen) {
@@ -99,8 +92,8 @@ void mlir::sparse_tensor::buildSparsifier(OpPassManager &pm,
9992
pm.addPass(createGpuModuleToBinaryPass(gpuModuleToBinaryPassOptions));
10093
}
10194

102-
// Convert poison values.
103-
pm.addPass(createUBToLLVMConversionPass());
95+
// Convert to LLVM.
96+
pm.addPass(createConvertToLLVMPass());
10497

10598
// Ensure all casts are realized.
10699
pm.addPass(createReconcileUnrealizedCastsPass());

0 commit comments

Comments
 (0)