[llvm] e7432bc - [InstCombine] Add aligned_alloc with pointer icmp as only use.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 08:10:06 PDT 2023


Author: Florian Hahn
Date: 2023-10-18T16:09:47+01:00
New Revision: e7432bc343655e1251773f9421ef76d2629e8eb8

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

LOG: [InstCombine] Add aligned_alloc with pointer icmp as only use.

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/malloc-free.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/malloc-free.ll b/llvm/test/Transforms/InstCombine/malloc-free.ll
index dc918a7fc8080b3..29c757f82564ad8 100644
--- a/llvm/test/Transforms/InstCombine/malloc-free.ll
+++ b/llvm/test/Transforms/InstCombine/malloc-free.ll
@@ -26,6 +26,15 @@ define i32 @dead_aligned_alloc(i32 %size, i32 %alignment, i8 %value) {
   ret i32 0
 }
 
+define i1 @aligned_alloc_only_pointe(i32 %size, i32 %alignment, i8 %value) {
+; CHECK-LABEL: @aligned_alloc_only_pointe(
+; CHECK-NEXT:    ret i1 true
+;
+  %aligned_allocation = tail call ptr @aligned_alloc(i32 %alignment, i32 %size)
+  %cmp = icmp ne ptr %aligned_allocation, null
+  ret i1 %cmp
+}
+
 declare noalias ptr @calloc(i32, i32) nounwind allockind("alloc,zeroed") allocsize(0,1) "alloc-family"="malloc"
 declare noalias ptr @malloc(i32) allockind("alloc,uninitialized") allocsize(0) "alloc-family"="malloc"
 declare noalias ptr @aligned_alloc(i32, i32) allockind("alloc,uninitialized,aligned") allocsize(1) "alloc-family"="malloc"


        


More information about the llvm-commits mailing list