aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunctionSplitter.cpp
diff options
context:
space:
mode:
authormahtohappy <Happy.Kumar@Windriver.com>2024-04-23 20:07:07 +0530
committerGitHub <noreply@github.com>2024-04-23 07:37:07 -0700
commit74cab546825b32f24e44d69942cdbdd129160471 (patch)
tree02b9a20b1da606dcdfb86c381a9a8662589c8763 /llvm/lib/CodeGen/MachineFunctionSplitter.cpp
parent282ab543a92740100c1119c701258c2900c5d00c (diff)
downloadllvm-74cab546825b32f24e44d69942cdbdd129160471.zip
llvm-74cab546825b32f24e44d69942cdbdd129160471.tar.gz
llvm-74cab546825b32f24e44d69942cdbdd129160471.tar.bz2
Reapply "[Clang][Sema] placement new initializes typedef array with correct size (#83124)" (#89036)
When in-place new-ing a local variable of an array of trivial type, the generated code calls 'memset' with the correct size of the array, earlier it was generating size (squared of the typedef array + size). The cause: typedef TYPE TArray[8]; TArray x; The type of declarator is Tarray[8] and in SemaExprCXX.cpp::BuildCXXNew we check if it's of typedef and of constant size then we get the original type and it works fine for non-dependent cases. But in case of template we do TreeTransform.h:TransformCXXNEWExpr and there we again check the allocated type which is TArray[8] and it stays that way, so ArraySize=(Tarray[8] type, alloc Tarray[8*type]) so the squared size allocation. ArraySize gets calculated earlier in TreeTransform.h so that if(!ArraySize) condition was failing. fix: I changed that condition to if(ArraySize). fixes https://github.com/llvm/llvm-project/issues/41441 --------- Co-authored-by: erichkeane <ekeane@nvidia.com>
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunctionSplitter.cpp')
0 files changed, 0 insertions, 0 deletions