@@ -2276,27 +2276,18 @@ void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) {
22762276 // failure.
22772277 llvm::BasicBlock *DefaultBlock = createBasicBlock (" sw.default" );
22782278 SwitchInsn = Builder.CreateSwitch (CondV, DefaultBlock);
2279- switch (HLSLControlFlowAttr) {
2280- case HLSLControlFlowHintAttr::Microsoft_branch:
2281- case HLSLControlFlowHintAttr::Microsoft_flatten: {
2279+ if (HLSLControlFlowAttr != HLSLControlFlowHintAttr::SpellingNotCalculated) {
22822280 llvm::MDBuilder MDHelper (CGM.getLLVMContext ());
2283-
22842281 llvm::ConstantInt *BranchHintConstant =
22852282 HLSLControlFlowAttr ==
22862283 HLSLControlFlowHintAttr::Spelling::Microsoft_branch
22872284 ? llvm::ConstantInt::get (CGM.Int32Ty , 1 )
22882285 : llvm::ConstantInt::get (CGM.Int32Ty , 2 );
2289-
2290- SmallVector<llvm::Metadata *, 2 > Vals (
2286+ llvm::Metadata * Vals[] =
22912287 {MDHelper.createString (" hlsl.controlflow.hint" ),
2292- MDHelper.createConstant (BranchHintConstant)}) ;
2288+ MDHelper.createConstant (BranchHintConstant)};
22932289 SwitchInsn->setMetadata (" hlsl.controlflow.hint" ,
22942290 llvm::MDNode::get (CGM.getLLVMContext (), Vals));
2295- break ;
2296- }
2297- // This is required to avoid warnings during compilation
2298- case HLSLControlFlowHintAttr::SpellingNotCalculated:
2299- break ;
23002291 }
23012292
23022293 if (PGO.haveRegionCounts ()) {
0 commit comments