[llvm] [AMDGPU] Quit PromoteAllocaToVector if intrinsic is used (PR #68744)

Mariusz Sikora via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 14:12:01 PDT 2023


================
@@ -771,7 +771,8 @@ bool AMDGPUPromoteAllocaImpl::tryPromoteAllocaToVector(AllocaInst &Alloca) {
     }
 
     // Ignore assume-like intrinsics and comparisons used in assumes.
-    if (isAssumeLikeIntrinsic(Inst)) {
+    // Make sure that intrinsics do not have any use like e.g. llvm.objectsize
+    if (isAssumeLikeIntrinsic(Inst) && Inst->use_empty()) {
----------------
mariusz-sikora-at-amd wrote:

This change will fix the crash, but I'm not sure about it overall.
We have at least three intrinsics from `isAssumeLikeIntrinsic` which are returning something.
`objectsize`, `invariant.start` and `ptr.annotation`. Maybe we should allow `objectsize` to pass this check and add `objectsize` to the `WorkList` and later in `promoteAllocaUserToVector` we could just calculate the size of the alloca ?. If IR contains `invariant.start` or `ptr.annotation` we will just quit.

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


More information about the llvm-commits mailing list