[PATCH] D144445: [ConstantFold][InstSimplify] folding load for constant global patterened arrays and structs

Kohei Asano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 25 01:50:00 PST 2023


khei4 added a comment.

add inline comments for check and review.



================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:778
+  auto CATy = dyn_cast<ArrayType>(CTy);
+  // TODO: Current implementation can't handle unpacked struct and pointer
+  // elements
----------------
although I'm not sure it's possible to fold pointer structs and arrays, note here.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:813
+
+      // swap bytes if on big endian
+      if (!DL.isLittleEndian())
----------------
Conversion from bytes to the load type seems a bit ugly. Are there any better ways?


================
Comment at: llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll:22
 
-;.
 define void @f0() {
----------------
update these tests `llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll` and `llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll` by following commands 

```

llvm/utils/update_test_checks.py --opt-binary ./build/bin/opt \
                                                                llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll
llvm/utils/update_llc_test_checks.py --llc-binary ./build/bin/llc \
                                                                llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll
```
and tweak head comments, as comments in these files say
Is this ok?


================
Comment at: llvm/test/Transforms/InstSimplify/load-patterned-aggregates.ll:52
-}
-
 ; TODO: this should be ret i8 1
----------------
these tests are dupplicate to the following tests, sorry for the noises


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144445/new/

https://reviews.llvm.org/D144445



More information about the llvm-commits mailing list