[llvm] AMDGPU: Add instruction flags when lowering ctor/dtor (PR #111652)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 06:31:19 PDT 2024


================
@@ -112,9 +112,13 @@ static void createInitOrFiniCalls(Function &F, bool IsCtor) {
     Type *Int64Ty = IntegerType::getInt64Ty(C);
     auto *EndPtr = IRB.CreatePtrToInt(End, Int64Ty);
     auto *BeginPtr = IRB.CreatePtrToInt(Begin, Int64Ty);
-    auto *ByteSize = IRB.CreateSub(EndPtr, BeginPtr);
-    auto *Size = IRB.CreateAShr(ByteSize, ConstantInt::get(Int64Ty, 3));
-    auto *Offset = IRB.CreateSub(Size, ConstantInt::get(Int64Ty, 1));
+    auto *ByteSize = IRB.CreateSub(EndPtr, BeginPtr, "", /*HasNUW=*/true,
+                                   /*HasNSW=*/true);
+    auto *Size = IRB.CreateAShr(ByteSize, ConstantInt::get(Int64Ty, 3), "",
----------------
jhuber6 wrote:

I think it's because I typed the GEP so I had to do `arr[size / sizeof(void *)]` or something, don't remember exactly.

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


More information about the llvm-commits mailing list