Browse Source

Disable merge undef for HLSL. (#1833)

Xiang Li 6 years ago
parent
commit
4658a46a64
2 changed files with 4 additions and 6 deletions
  1. 0 5
      lib/Transforms/IPO/PassManagerBuilder.cpp
  2. 4 1
      lib/Transforms/Utils/Local.cpp

+ 0 - 5
lib/Transforms/IPO/PassManagerBuilder.cpp

@@ -257,11 +257,6 @@ static void addHLSLPasses(bool HLSLHighLevel, unsigned OptLevel, hlsl::HLSLExten
     MPM.add(createLoopUnrollPass());
   }
 
-  if (!NoOpt) {
-    // Verify no undef resource path before simplify, since that can remove undef
-    // paths.  For NoOpt, resources are unpromoted here, so this will not work.
-    MPM.add(createFailUndefResourcePass());
-  }
   MPM.add(createSimplifyInstPass());
 
   MPM.add(createCFGSimplificationPass());

+ 4 - 1
lib/Transforms/Utils/Local.cpp

@@ -548,7 +548,10 @@ void llvm::MergeBasicBlockIntoOnlyPred(BasicBlock *DestBB, DominatorTree *DT) {
 /// in place of the other. Note that we will always choose the non-undef
 /// value to keep.
 static bool CanMergeValues(Value *First, Value *Second) {
-  return First == Second || isa<UndefValue>(First) || isa<UndefValue>(Second);
+  return First == Second;
+   // HLSL Change Begin -Not merge undef.
+   //  || isa<UndefValue>(First) || isa<UndefValue>(Second);
+   // HLSL Change End.
 }
 
 /// CanPropagatePredecessorsForPHIs - Return true if we can fold BB, an