[llvm] [FuzzMutate] Prevent the mutator from generating illegal memory operations (PR #144885)

Peter Rong via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 11:15:23 PDT 2025


================
@@ -763,4 +772,35 @@ TEST(AllStrategies, SpecialTerminator) {
   mutateAndVerifyModule<SinkInstructionStrategy>(Source);
 }
 
+TEST(AllStrategies, AMDGCNLegalAddrspace) {
+  StringRef Source = "\n\
+    target triple = \"amdgcn-amd-amdhsa\"\n\
+    ; minimum values required by the fuzzer (e.g., default addrspace for allocas and globals)\n\
+    target datalayout = \"A5-G1\"\n\
+    define amdgpu_gfx void @strict_wwm_amdgpu_cs_main(<4 x i32> inreg %desc, i32 %index) {\n\
+    %desc.int = bitcast <4 x i32> %desc to i128\n\
+    %desc.ptr = inttoptr i128 %desc.int to ptr addrspace(8)\n\
+    ret void\n\
+  }\n\
+  ";
+
+  std::function<void(Module &)> AddrSpaceCheck = [](Module &M) {
----------------
DataCorrupted wrote:

```suggestion
  ModuleVerifier AddrSpaceVerifier = [](Module &M) {
```

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


More information about the llvm-commits mailing list