Skip to content

Commit 6f42d31

Browse files
committed
Merge branch 'users/meinersbur/flang_runtime' into users/meinersbur/flang_runtime_shared
2 parents c87b596 + faf5ddc commit 6f42d31

File tree

209 files changed

+10471
-6176
lines changed

Some content is hidden

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

209 files changed

+10471
-6176
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Improvements to Clang's diagnostics
127127
- The ``-Wunique-object-duplication`` warning has been added to warn about objects
128128
which are supposed to only exist once per program, but may get duplicated when
129129
built into a shared library.
130+
- Fixed a bug where Clang's Analysis did not correctly model the destructor behavior of ``union`` members (#GH119415).
130131

131132
Improvements to Clang's time-trace
132133
----------------------------------

clang/include/clang/AST/OperationKinds.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,6 @@ CAST_OPERATION(HLSLVectorTruncation)
367367
// Non-decaying array RValue cast (HLSL only).
368368
CAST_OPERATION(HLSLArrayRValue)
369369

370-
// Aggregate by Value cast (HLSL only).
371-
CAST_OPERATION(HLSLElementwiseCast)
372-
373370
//===- Binary Operations -------------------------------------------------===//
374371
// Operators listed in order of precedence.
375372
// Note that additions to this should also update the StmtVisitor class,

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ CODEGENOPT(TimePassesPerRun , 1, 0) ///< Set when -ftime-report=per-pass-run is
320320
CODEGENOPT(TimeTrace , 1, 0) ///< Set when -ftime-trace is enabled.
321321
VALUE_CODEGENOPT(TimeTraceGranularity, 32, 500) ///< Minimum time granularity (in microseconds),
322322
///< traced by time profiler
323+
CODEGENOPT(InterchangeLoops , 1, 0) ///< Run loop-interchange.
323324
CODEGENOPT(UnrollLoops , 1, 0) ///< Control whether loops are unrolled.
324325
CODEGENOPT(RerollLoops , 1, 0) ///< Control whether loops are rerolled.
325326
CODEGENOPT(NoUseJumpTables , 1, 0) ///< Set when -fno-jump-tables is enabled.

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4069,6 +4069,10 @@ def ftrap_function_EQ : Joined<["-"], "ftrap-function=">, Group<f_Group>,
40694069
Visibility<[ClangOption, CC1Option]>,
40704070
HelpText<"Issue call to specified function rather than a trap instruction">,
40714071
MarshallingInfoString<CodeGenOpts<"TrapFuncName">>;
4072+
def floop_interchange : Flag<["-"], "floop-interchange">, Group<f_Group>,
4073+
HelpText<"Enable the loop interchange pass">, Visibility<[ClangOption, CC1Option]>;
4074+
def fno_loop_interchange: Flag<["-"], "fno-loop-interchange">, Group<f_Group>,
4075+
HelpText<"Disable the loop interchange pass">, Visibility<[ClangOption, CC1Option]>;
40724076
def funroll_loops : Flag<["-"], "funroll-loops">, Group<f_Group>,
40734077
HelpText<"Turn on loop unroller">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>;
40744078
def fno_unroll_loops : Flag<["-"], "fno-unroll-loops">, Group<f_Group>,

clang/include/clang/Sema/SemaHLSL.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ class SemaHLSL : public SemaBase {
141141
// Diagnose whether the input ID is uint/unit2/uint3 type.
142142
bool diagnoseInputIDType(QualType T, const ParsedAttr &AL);
143143

144-
bool CanPerformScalarCast(QualType SrcTy, QualType DestTy);
145-
bool ContainsBitField(QualType BaseTy);
146-
bool CanPerformElementwiseCast(Expr *Src, QualType DestType);
147144
ExprResult ActOnOutParamExpr(ParmVarDecl *Param, Expr *Arg);
148145

149146
QualType getInoutParameterType(QualType Ty);

clang/lib/AST/Expr.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,6 @@ bool CastExpr::CastConsistency() const {
19561956
case CK_FixedPointToBoolean:
19571957
case CK_HLSLArrayRValue:
19581958
case CK_HLSLVectorTruncation:
1959-
case CK_HLSLElementwiseCast:
19601959
CheckNoBasePath:
19611960
assert(path_empty() && "Cast kind should not have a base path!");
19621961
break;

clang/lib/AST/ExprConstant.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15047,7 +15047,6 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
1504715047
case CK_NoOp:
1504815048
case CK_LValueToRValueBitCast:
1504915049
case CK_HLSLArrayRValue:
15050-
case CK_HLSLElementwiseCast:
1505115050
return ExprEvaluatorBaseTy::VisitCastExpr(E);
1505215051

1505315052
case CK_MemberPointerToBoolean:
@@ -15906,7 +15905,6 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
1590615905
case CK_IntegralToFixedPoint:
1590715906
case CK_MatrixCast:
1590815907
case CK_HLSLVectorTruncation:
15909-
case CK_HLSLElementwiseCast:
1591015908
llvm_unreachable("invalid cast kind for complex value");
1591115909

1591215910
case CK_LValueToRValue:

clang/lib/Analysis/CFG.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,8 @@ void CFGBuilder::addImplicitDtorsForDestructor(const CXXDestructorDecl *DD) {
20412041
}
20422042

20432043
// First destroy member objects.
2044+
if (RD->isUnion())
2045+
return;
20442046
for (auto *FI : RD->fields()) {
20452047
// Check for constant size array. Set type to array element type.
20462048
QualType QT = FI->getType();

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
890890

891891
PipelineTuningOptions PTO;
892892
PTO.LoopUnrolling = CodeGenOpts.UnrollLoops;
893+
PTO.LoopInterchange = CodeGenOpts.InterchangeLoops;
893894
// For historical reasons, loop interleaving is set to mirror setting for loop
894895
// unrolling.
895896
PTO.LoopInterleaving = CodeGenOpts.UnrollLoops;
@@ -1314,6 +1315,7 @@ runThinLTOBackend(CompilerInstance &CI, ModuleSummaryIndex *CombinedIndex,
13141315
initTargetOptions(CI, Diags, Conf.Options);
13151316
Conf.SampleProfile = std::move(SampleProfile);
13161317
Conf.PTO.LoopUnrolling = CGOpts.UnrollLoops;
1318+
Conf.PTO.LoopInterchange = CGOpts.InterchangeLoops;
13171319
// For historical reasons, loop interleaving is set to mirror setting for loop
13181320
// unrolling.
13191321
Conf.PTO.LoopInterleaving = CGOpts.UnrollLoops;

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3567,6 +3567,10 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
35673567
DBuilder.createEnumerator(Enum->getName(), Enum->getInitVal()));
35683568
}
35693569

3570+
std::optional<EnumExtensibilityAttr::Kind> EnumKind;
3571+
if (auto *Attr = ED->getAttr<EnumExtensibilityAttr>())
3572+
EnumKind = Attr->getExtensibility();
3573+
35703574
// Return a CompositeType for the enum itself.
35713575
llvm::DINodeArray EltArray = DBuilder.getOrCreateArray(Enumerators);
35723576

@@ -3576,7 +3580,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
35763580
llvm::DIType *ClassTy = getOrCreateType(ED->getIntegerType(), DefUnit);
35773581
return DBuilder.createEnumerationType(
35783582
EnumContext, ED->getName(), DefUnit, Line, Size, Align, EltArray, ClassTy,
3579-
/*RunTimeLang=*/0, Identifier, ED->isScoped());
3583+
/*RunTimeLang=*/0, Identifier, ED->isScoped(), EnumKind);
35803584
}
35813585

35823586
llvm::DIMacro *CGDebugInfo::CreateMacro(llvm::DIMacroFile *Parent,

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -5338,7 +5338,6 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
53385338
case CK_MatrixCast:
53395339
case CK_HLSLVectorTruncation:
53405340
case CK_HLSLArrayRValue:
5341-
case CK_HLSLElementwiseCast:
53425341
return EmitUnsupportedLValue(E, "unexpected cast lvalue");
53435342

53445343
case CK_Dependent:
@@ -6377,75 +6376,3 @@ RValue CodeGenFunction::EmitPseudoObjectRValue(const PseudoObjectExpr *E,
63776376
LValue CodeGenFunction::EmitPseudoObjectLValue(const PseudoObjectExpr *E) {
63786377
return emitPseudoObjectExpr(*this, E, true, AggValueSlot::ignored()).LV;
63796378
}
6380-
6381-
void CodeGenFunction::FlattenAccessAndType(
6382-
Address Addr, QualType AddrType,
6383-
SmallVectorImpl<std::pair<Address, llvm::Value *>> &AccessList,
6384-
SmallVectorImpl<QualType> &FlatTypes) {
6385-
// WorkList is list of type we are processing + the Index List to access
6386-
// the field of that type in Addr for use in a GEP
6387-
llvm::SmallVector<std::pair<QualType, llvm::SmallVector<llvm::Value *, 4>>,
6388-
16>
6389-
WorkList;
6390-
llvm::IntegerType *IdxTy = llvm::IntegerType::get(getLLVMContext(), 32);
6391-
// Addr should be a pointer so we need to 'dereference' it
6392-
WorkList.push_back({AddrType, {llvm::ConstantInt::get(IdxTy, 0)}});
6393-
6394-
while (!WorkList.empty()) {
6395-
auto [T, IdxList] = WorkList.pop_back_val();
6396-
T = T.getCanonicalType().getUnqualifiedType();
6397-
assert(!isa<MatrixType>(T) && "Matrix types not yet supported in HLSL");
6398-
if (const auto *CAT = dyn_cast<ConstantArrayType>(T)) {
6399-
uint64_t Size = CAT->getZExtSize();
6400-
for (int64_t I = Size - 1; I > -1; I--) {
6401-
llvm::SmallVector<llvm::Value *, 4> IdxListCopy = IdxList;
6402-
IdxListCopy.push_back(llvm::ConstantInt::get(IdxTy, I));
6403-
WorkList.emplace_back(CAT->getElementType(), IdxListCopy);
6404-
}
6405-
} else if (const auto *RT = dyn_cast<RecordType>(T)) {
6406-
const RecordDecl *Record = RT->getDecl();
6407-
assert(!Record->isUnion() && "Union types not supported in flat cast.");
6408-
6409-
const CXXRecordDecl *CXXD = dyn_cast<CXXRecordDecl>(Record);
6410-
6411-
llvm::SmallVector<QualType, 16> FieldTypes;
6412-
if (CXXD && CXXD->isStandardLayout())
6413-
Record = CXXD->getStandardLayoutBaseWithFields();
6414-
6415-
// deal with potential base classes
6416-
if (CXXD && !CXXD->isStandardLayout()) {
6417-
for (auto &Base : CXXD->bases())
6418-
FieldTypes.push_back(Base.getType());
6419-
}
6420-
6421-
for (auto *FD : Record->fields())
6422-
FieldTypes.push_back(FD->getType());
6423-
6424-
for (int64_t I = FieldTypes.size() - 1; I > -1; I--) {
6425-
llvm::SmallVector<llvm::Value *, 4> IdxListCopy = IdxList;
6426-
IdxListCopy.push_back(llvm::ConstantInt::get(IdxTy, I));
6427-
WorkList.insert(WorkList.end(), {FieldTypes[I], IdxListCopy});
6428-
}
6429-
} else if (const auto *VT = dyn_cast<VectorType>(T)) {
6430-
llvm::Type *LLVMT = ConvertTypeForMem(T);
6431-
CharUnits Align = getContext().getTypeAlignInChars(T);
6432-
Address GEP =
6433-
Builder.CreateInBoundsGEP(Addr, IdxList, LLVMT, Align, "vector.gep");
6434-
for (unsigned I = 0, E = VT->getNumElements(); I < E; I++) {
6435-
llvm::Value *Idx = llvm::ConstantInt::get(IdxTy, I);
6436-
// gep on vector fields is not recommended so combine gep with
6437-
// extract/insert
6438-
AccessList.emplace_back(GEP, Idx);
6439-
FlatTypes.push_back(VT->getElementType());
6440-
}
6441-
} else {
6442-
// a scalar/builtin type
6443-
llvm::Type *LLVMT = ConvertTypeForMem(T);
6444-
CharUnits Align = getContext().getTypeAlignInChars(T);
6445-
Address GEP =
6446-
Builder.CreateInBoundsGEP(Addr, IdxList, LLVMT, Align, "gep");
6447-
AccessList.emplace_back(GEP, nullptr);
6448-
FlatTypes.push_back(T);
6449-
}
6450-
}
6451-
}

clang/lib/CodeGen/CGExprAgg.cpp

Lines changed: 1 addition & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -491,79 +491,6 @@ static bool isTrivialFiller(Expr *E) {
491491
return false;
492492
}
493493

494-
// emit a flat cast where the RHS is a scalar, including vector
495-
static void EmitHLSLScalarFlatCast(CodeGenFunction &CGF, Address DestVal,
496-
QualType DestTy, llvm::Value *SrcVal,
497-
QualType SrcTy, SourceLocation Loc) {
498-
// Flatten our destination
499-
SmallVector<QualType, 16> DestTypes; // Flattened type
500-
SmallVector<std::pair<Address, llvm::Value *>, 16> StoreGEPList;
501-
// ^^ Flattened accesses to DestVal we want to store into
502-
CGF.FlattenAccessAndType(DestVal, DestTy, StoreGEPList, DestTypes);
503-
504-
assert(SrcTy->isVectorType() && "HLSL Flat cast doesn't handle splatting.");
505-
const VectorType *VT = SrcTy->getAs<VectorType>();
506-
SrcTy = VT->getElementType();
507-
assert(StoreGEPList.size() <= VT->getNumElements() &&
508-
"Cannot perform HLSL flat cast when vector source \
509-
object has less elements than flattened destination \
510-
object.");
511-
for (unsigned I = 0, Size = StoreGEPList.size(); I < Size; I++) {
512-
llvm::Value *Load = CGF.Builder.CreateExtractElement(SrcVal, I, "vec.load");
513-
llvm::Value *Cast =
514-
CGF.EmitScalarConversion(Load, SrcTy, DestTypes[I], Loc);
515-
516-
// store back
517-
llvm::Value *Idx = StoreGEPList[I].second;
518-
if (Idx) {
519-
llvm::Value *V =
520-
CGF.Builder.CreateLoad(StoreGEPList[I].first, "load.for.insert");
521-
Cast = CGF.Builder.CreateInsertElement(V, Cast, Idx);
522-
}
523-
CGF.Builder.CreateStore(Cast, StoreGEPList[I].first);
524-
}
525-
return;
526-
}
527-
528-
// emit a flat cast where the RHS is an aggregate
529-
static void EmitHLSLElementwiseCast(CodeGenFunction &CGF, Address DestVal,
530-
QualType DestTy, Address SrcVal,
531-
QualType SrcTy, SourceLocation Loc) {
532-
// Flatten our destination
533-
SmallVector<QualType, 16> DestTypes; // Flattened type
534-
SmallVector<std::pair<Address, llvm::Value *>, 16> StoreGEPList;
535-
// ^^ Flattened accesses to DestVal we want to store into
536-
CGF.FlattenAccessAndType(DestVal, DestTy, StoreGEPList, DestTypes);
537-
// Flatten our src
538-
SmallVector<QualType, 16> SrcTypes; // Flattened type
539-
SmallVector<std::pair<Address, llvm::Value *>, 16> LoadGEPList;
540-
// ^^ Flattened accesses to SrcVal we want to load from
541-
CGF.FlattenAccessAndType(SrcVal, SrcTy, LoadGEPList, SrcTypes);
542-
543-
assert(StoreGEPList.size() <= LoadGEPList.size() &&
544-
"Cannot perform HLSL flat cast when flattened source object \
545-
has less elements than flattened destination object.");
546-
// apply casts to what we load from LoadGEPList
547-
// and store result in Dest
548-
for (unsigned I = 0, E = StoreGEPList.size(); I < E; I++) {
549-
llvm::Value *Idx = LoadGEPList[I].second;
550-
llvm::Value *Load = CGF.Builder.CreateLoad(LoadGEPList[I].first, "load");
551-
Load =
552-
Idx ? CGF.Builder.CreateExtractElement(Load, Idx, "vec.extract") : Load;
553-
llvm::Value *Cast =
554-
CGF.EmitScalarConversion(Load, SrcTypes[I], DestTypes[I], Loc);
555-
556-
// store back
557-
Idx = StoreGEPList[I].second;
558-
if (Idx) {
559-
llvm::Value *V =
560-
CGF.Builder.CreateLoad(StoreGEPList[I].first, "load.for.insert");
561-
Cast = CGF.Builder.CreateInsertElement(V, Cast, Idx);
562-
}
563-
CGF.Builder.CreateStore(Cast, StoreGEPList[I].first);
564-
}
565-
}
566-
567494
/// Emit initialization of an array from an initializer list. ExprToVisit must
568495
/// be either an InitListEpxr a CXXParenInitListExpr.
569496
void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType,
@@ -963,25 +890,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
963890
case CK_HLSLArrayRValue:
964891
Visit(E->getSubExpr());
965892
break;
966-
case CK_HLSLElementwiseCast: {
967-
Expr *Src = E->getSubExpr();
968-
QualType SrcTy = Src->getType();
969-
RValue RV = CGF.EmitAnyExpr(Src);
970-
QualType DestTy = E->getType();
971-
Address DestVal = Dest.getAddress();
972-
SourceLocation Loc = E->getExprLoc();
973-
974-
if (RV.isScalar()) {
975-
llvm::Value *SrcVal = RV.getScalarVal();
976-
EmitHLSLScalarFlatCast(CGF, DestVal, DestTy, SrcVal, SrcTy, Loc);
977-
} else {
978-
assert(RV.isAggregate() &&
979-
"Can't perform HLSL Aggregate cast on a complex type.");
980-
Address SrcVal = RV.getAggregateAddress();
981-
EmitHLSLElementwiseCast(CGF, DestVal, DestTy, SrcVal, SrcTy, Loc);
982-
}
983-
break;
984-
}
893+
985894
case CK_NoOp:
986895
case CK_UserDefinedConversion:
987896
case CK_ConstructorConversion:
@@ -1552,7 +1461,6 @@ static bool castPreservesZero(const CastExpr *CE) {
15521461
case CK_NonAtomicToAtomic:
15531462
case CK_AtomicToNonAtomic:
15541463
case CK_HLSLVectorTruncation:
1555-
case CK_HLSLElementwiseCast:
15561464
return true;
15571465

15581466
case CK_BaseToDerivedMemberPointer:

clang/lib/CodeGen/CGExprComplex.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,6 @@ ComplexPairTy ComplexExprEmitter::EmitCast(CastKind CK, Expr *Op,
610610
case CK_MatrixCast:
611611
case CK_HLSLVectorTruncation:
612612
case CK_HLSLArrayRValue:
613-
case CK_HLSLElementwiseCast:
614613
llvm_unreachable("invalid cast kind for complex value");
615614

616615
case CK_FloatingRealToComplex:

clang/lib/CodeGen/CGExprConstant.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,6 @@ class ConstExprEmitter
13351335
case CK_MatrixCast:
13361336
case CK_HLSLVectorTruncation:
13371337
case CK_HLSLArrayRValue:
1338-
case CK_HLSLElementwiseCast:
13391338
return nullptr;
13401339
}
13411340
llvm_unreachable("Invalid CastKind");

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,42 +2269,6 @@ bool CodeGenFunction::ShouldNullCheckClassCastValue(const CastExpr *CE) {
22692269
return true;
22702270
}
22712271

2272-
// RHS is an aggregate type
2273-
static Value *EmitHLSLElementwiseCast(CodeGenFunction &CGF, Address RHSVal,
2274-
QualType RHSTy, QualType LHSTy,
2275-
SourceLocation Loc) {
2276-
SmallVector<std::pair<Address, llvm::Value *>, 16> LoadGEPList;
2277-
SmallVector<QualType, 16> SrcTypes; // Flattened type
2278-
CGF.FlattenAccessAndType(RHSVal, RHSTy, LoadGEPList, SrcTypes);
2279-
// LHS is either a vector or a builtin?
2280-
// if its a vector create a temp alloca to store into and return that
2281-
if (auto *VecTy = LHSTy->getAs<VectorType>()) {
2282-
assert(SrcTypes.size() >= VecTy->getNumElements() &&
2283-
"Flattened type on RHS must have more elements than vector on LHS.");
2284-
llvm::Value *V =
2285-
CGF.Builder.CreateLoad(CGF.CreateIRTemp(LHSTy, "flatcast.tmp"));
2286-
// write to V.
2287-
for (unsigned I = 0, E = VecTy->getNumElements(); I < E; I++) {
2288-
llvm::Value *Load = CGF.Builder.CreateLoad(LoadGEPList[I].first, "load");
2289-
llvm::Value *Idx = LoadGEPList[I].second;
2290-
Load = Idx ? CGF.Builder.CreateExtractElement(Load, Idx, "vec.extract")
2291-
: Load;
2292-
llvm::Value *Cast = CGF.EmitScalarConversion(
2293-
Load, SrcTypes[I], VecTy->getElementType(), Loc);
2294-
V = CGF.Builder.CreateInsertElement(V, Cast, I);
2295-
}
2296-
return V;
2297-
}
2298-
// i its a builtin just do an extract element or load.
2299-
assert(LHSTy->isBuiltinType() &&
2300-
"Destination type must be a vector or builtin type.");
2301-
llvm::Value *Load = CGF.Builder.CreateLoad(LoadGEPList[0].first, "load");
2302-
llvm::Value *Idx = LoadGEPList[0].second;
2303-
Load =
2304-
Idx ? CGF.Builder.CreateExtractElement(Load, Idx, "vec.extract") : Load;
2305-
return CGF.EmitScalarConversion(Load, LHSTy, SrcTypes[0], Loc);
2306-
}
2307-
23082272
// VisitCastExpr - Emit code for an explicit or implicit cast. Implicit casts
23092273
// have to handle a more broad range of conversions than explicit casts, as they
23102274
// handle things like function to ptr-to-function decay etc.
@@ -2795,16 +2759,7 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
27952759
llvm::Value *Zero = llvm::Constant::getNullValue(CGF.SizeTy);
27962760
return Builder.CreateExtractElement(Vec, Zero, "cast.vtrunc");
27972761
}
2798-
case CK_HLSLElementwiseCast: {
2799-
RValue RV = CGF.EmitAnyExpr(E);
2800-
SourceLocation Loc = CE->getExprLoc();
2801-
QualType SrcTy = E->getType();
28022762

2803-
assert(RV.isAggregate() && "Not a valid HLSL Flat Cast.");
2804-
// RHS is an aggregate
2805-
Address SrcVal = RV.getAggregateAddress();
2806-
return EmitHLSLElementwiseCast(CGF, SrcVal, SrcTy, DestTy, Loc);
2807-
}
28082763
} // end of switch
28092764

28102765
llvm_unreachable("unknown scalar cast");

0 commit comments

Comments
 (0)