Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate dxcapi v2 and other changes from internal (#2575)
* Integrate changes from internal. - dxcapi v2 - new dxc options - DxilValueCache - PDB and NoOpt improvements - noop / llvm::donothing() support * Update dxrfallbacklayer for dxcapi internal changes * Reorder diag block based on whether pDiag is set first. * llvm::donothing() requires dxil 1.6 / SM 6.6 for now, lib as well. * Fixes for spir-v, non-VC compiler and non-Windows builds - DEFINE_CROSS_PLATFORM_UUIDOF for new interfaces - add SAL annotations - turn output argument validation for -P into warning - handle warnings without concatenating them to main output - update spirv preprocessing and compilation paths - return E_NOTIMPL from IDxcUtils::CreateReflection - cleanup: DxcContainerBuilder back to uft8, DxcTestUtils: remove comment * Fix some warnings from clang/gcc. * Fix unicode conversion problems on linux, where sizeof(wchar_t) == 4 Note this is an intermediate fix. On linux, what we are calling utf16 is actually a wide string that's probably utf32. This change fixes issues introduced by the new interface changes so things are consistent and pass tests. A future fix should correct the encodings so they are correctly labeled on platforms where wchar_t doesn't mean UTF16. * Return false for IsBufferNullTerminated when CP_ACP. One test for Disassembler was crashing because it created a pinned blob with a size of 1 << 31 + 1 without actual memory backing this. The IsBufferNullTerminated would attempt to see if this was null terminated, causing AV. This change also removes CP_UTF8 from this test when it was creating binary blobs, not UTF8 text blobs.
- Loading branch information
1 parent
48d3b17
commit f4965b7
Showing
128 changed files
with
6,272 additions
and
1,503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
//===--------- DxilValueCache.cpp - Dxil Constant Value Cache ------------===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "llvm/Pass.h" | ||
#include "llvm/Transforms/Utils/ValueMapper.h" | ||
|
||
namespace llvm { | ||
|
||
class Module; | ||
class DominatorTree; | ||
|
||
struct DxilValueCache : public ModulePass { | ||
static char ID; | ||
|
||
// Special Weak Value to Weak Value map. | ||
struct WeakValueMap { | ||
struct ValueVH : public CallbackVH { | ||
ValueVH(Value *V) : CallbackVH(V) {} | ||
void allUsesReplacedWith(Value *) override { setValPtr(nullptr); } | ||
}; | ||
struct ValueEntry { | ||
WeakVH Value; | ||
ValueVH Self; | ||
ValueEntry() : Value(nullptr), Self(nullptr) {} | ||
inline void Set(llvm::Value *Key, llvm::Value *V) { Self = Key; Value = V; } | ||
inline bool IsStale() const { return Self == nullptr; } | ||
}; | ||
ValueMap<const Value *, ValueEntry> Map; | ||
Value *Get(Value *V); | ||
void Set(Value *Key, Value *V); | ||
bool Seen(Value *v); | ||
void SetSentinel(Value *V); | ||
void dump() const; | ||
private: | ||
Value *GetSentinel(LLVMContext &Ctx); | ||
std::unique_ptr<Value> Sentinel; | ||
}; | ||
|
||
private: | ||
|
||
WeakValueMap ValueMap; | ||
|
||
void MarkAlwaysReachable(BasicBlock *BB); | ||
void MarkNeverReachable(BasicBlock *BB); | ||
bool IsAlwaysReachable_(BasicBlock *BB); | ||
bool IsNeverReachable_(BasicBlock *BB); | ||
Value *OptionallyGetValue(Value *V); | ||
Value *ProcessValue(Value *V, DominatorTree *DT); | ||
|
||
Value *ProcessAndSimplify_PHI(Instruction *I, DominatorTree *DT); | ||
Value *ProcessAndSimpilfy_Br(Instruction *I, DominatorTree *DT); | ||
Value *SimplifyAndCacheResult(Instruction *I, DominatorTree *DT); | ||
|
||
public: | ||
|
||
const char *getPassName() const override; | ||
DxilValueCache(); | ||
|
||
bool runOnModule(Module &M) override { return false; } // Doesn't do anything by itself. | ||
void dump() const; | ||
Value *GetValue(Value *V, DominatorTree *DT=nullptr); | ||
bool IsAlwaysReachable(BasicBlock *BB, DominatorTree *DT=nullptr); | ||
bool IsNeverReachable(BasicBlock *BB, DominatorTree *DT=nullptr); | ||
}; | ||
|
||
void initializeDxilValueCachePass(class llvm::PassRegistry &); | ||
ModulePass *createDxilValueCachePass(); | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.