[clang] bfd41c3 - [LinkerWrapper][Obvious] Fix missing use of texture data type

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 7 14:55:19 PST 2023


Author: Joseph Huber
Date: 2023-12-07T16:55:14-06:00
New Revision: bfd41c3f8cc70bd65461a6d767f55c14d72150d9

URL: https://github.com/llvm/llvm-project/commit/bfd41c3f8cc70bd65461a6d767f55c14d72150d9
DIFF: https://github.com/llvm/llvm-project/commit/bfd41c3f8cc70bd65461a6d767f55c14d72150d9.diff

LOG: [LinkerWrapper][Obvious] Fix missing use of texture data type

Summary:
This was accidentally linked to the wrong pointer, causing unused
variable warnings and registering the wrong thing.

Added: 
    

Modified: 
    clang/test/Driver/linker-wrapper-image.c
    clang/tools/clang-linker-wrapper/OffloadWrapper.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/Driver/linker-wrapper-image.c b/clang/test/Driver/linker-wrapper-image.c
index 4a17a8324b462..a2a1996f66430 100644
--- a/clang/test/Driver/linker-wrapper-image.c
+++ b/clang/test/Driver/linker-wrapper-image.c
@@ -90,7 +90,7 @@
 // CUDA-NEXT:   %4 = getelementptr inbounds %struct.__tgt_offload_entry, ptr %entry1, i64 0, i32 3
 // CUDA-NEXT:   %flags = load i32, ptr %4, align 4
 // CUDA-NEXT:   %5 = getelementptr inbounds %struct.__tgt_offload_entry, ptr %entry1, i64 0, i32 4
-// CUDA-NEXT:   %textype = load i32, ptr %4, align 4
+// CUDA-NEXT:   %textype = load i32, ptr %5, align 4
 // CUDA-NEXT:   %type = and i32 %flags, 7
 // CUDA-NEXT:   %6 = and i32 %flags, 8
 // CUDA-NEXT:   %extern = lshr i32 %6, 3
@@ -189,7 +189,7 @@
 // HIP-NEXT:   %4 = getelementptr inbounds %struct.__tgt_offload_entry, ptr %entry1, i64 0, i32 3
 // HIP-NEXT:   %flags = load i32, ptr %4, align 4
 // HIP-NEXT:   %5 = getelementptr inbounds %struct.__tgt_offload_entry, ptr %entry1, i64 0, i32 4
-// HIP-NEXT:   %textype = load i32, ptr %4, align 4
+// HIP-NEXT:   %textype = load i32, ptr %5, align 4
 // HIP-NEXT:   %type = and i32 %flags, 7
 // HIP-NEXT:   %6 = and i32 %flags, 8
 // HIP-NEXT:   %extern = lshr i32 %6, 3

diff  --git a/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp b/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp
index 58d9e1e85ceff..f4f500b173572 100644
--- a/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/OffloadWrapper.cpp
@@ -385,7 +385,7 @@ Function *createRegisterGlobalsFunction(Module &M, bool IsHIP) {
       Builder.CreateInBoundsGEP(offloading::getEntryTy(M), Entry,
                                 {ConstantInt::get(getSizeTTy(M), 0),
                                  ConstantInt::get(Type::getInt32Ty(C), 4)});
-  auto *Data = Builder.CreateLoad(Type::getInt32Ty(C), FlagsPtr, "textype");
+  auto *Data = Builder.CreateLoad(Type::getInt32Ty(C), DataPtr, "textype");
   auto *Kind = Builder.CreateAnd(
       Flags, ConstantInt::get(Type::getInt32Ty(C), 0x7), "type");
 


        


More information about the cfe-commits mailing list