diff --git a/lib/HLSL/DxilCondenseResources.cpp b/lib/HLSL/DxilCondenseResources.cpp index 117526a2a3..050dbc898f 100644 --- a/lib/HLSL/DxilCondenseResources.cpp +++ b/lib/HLSL/DxilCondenseResources.cpp @@ -493,7 +493,7 @@ bool LegalizeResourcesPHIs(Module &M, DxilValueCache *DVC) { Br->dropAllReferences(); Br->eraseFromParent(); - + auto PhiEnd = PHIs.end(); for (Instruction &I : *Succ) if (PHINode *PN = dyn_cast(&I)) { if (Instruction *IncomingI = dyn_cast(PN->getIncomingValueForBlock(BB))) { @@ -504,7 +504,7 @@ bool LegalizeResourcesPHIs(Module &M, DxilValueCache *DVC) { if (PN->getNumIncomingValues() == 1) { PN->replaceAllUsesWith(PN->getIncomingValue(0)); - std::remove(PHIs.begin(), PHIs.end(), PN); + PhiEnd = std::remove(PHIs.begin(), PhiEnd, PN); AddCleanupValues(PN); // Mark for deletion } } @@ -515,7 +515,7 @@ bool LegalizeResourcesPHIs(Module &M, DxilValueCache *DVC) { while (!BB->empty()){ Instruction *ChildI = &*BB->rbegin(); if (PHINode *PN = dyn_cast(ChildI)) - std::remove(PHIs.begin(), PHIs.end(), PN); + PhiEnd = std::remove(PHIs.begin(), PhiEnd, PN); ChildI->eraseFromParent(); } BB->eraseFromParent(); diff --git a/tools/clang/unittests/HLSL/DxilContainerTest.cpp b/tools/clang/unittests/HLSL/DxilContainerTest.cpp index f907e07470..a625647f71 100644 --- a/tools/clang/unittests/HLSL/DxilContainerTest.cpp +++ b/tools/clang/unittests/HLSL/DxilContainerTest.cpp @@ -32,8 +32,13 @@ #include #include #pragma comment(lib, "d3dcompiler.lib") +#if _MSC_VER >= 1920 +#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING +#include +#else #include #endif +#endif #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" @@ -60,6 +65,7 @@ using namespace std; using namespace hlsl_test; #ifdef _WIN32 + using namespace std::experimental::filesystem; static uint8_t MaskCount(uint8_t V) {