[llvm-branch-commits] [DXIL][Analysis] Make alignment on StructuredBuffer optional (PR #100697)

Xiang Li via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 26 07:12:55 PDT 2024


================
@@ -284,7 +286,8 @@ MDTuple *ResourceInfo::getAsMetadata(LLVMContext &Ctx) const {
 
 std::pair<uint32_t, uint32_t> ResourceInfo::getAnnotateProps() const {
   uint32_t ResourceKind = llvm::to_underlying(Kind);
-  uint32_t AlignLog2 = isStruct() ? Log2(Struct.Alignment) : 0;
+  uint32_t AlignLog2 =
+      isStruct() && Struct.Alignment ? Log2(*Struct.Alignment) : 0;
----------------
python3kgae wrote:

Could we change it to 
```
(isStruct() && Struct.Alignment) ? Log2(*Struct.Alignment) : 0;
```
 so it is easier to read?


https://github.com/llvm/llvm-project/pull/100697


More information about the llvm-branch-commits mailing list