[PATCH] D81854: [InstCombine] Don't let an alignment assume prevent new/delete removals.
Hiroshi Yamauchi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 26 10:55:48 PDT 2020
yamauchi updated this revision to Diff 273782.
yamauchi added a comment.
Update past D71739 <https://reviews.llvm.org/D71739>.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81854/new/
https://reviews.llvm.org/D81854
Files:
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/malloc-free-delete.ll
Index: llvm/test/Transforms/InstCombine/malloc-free-delete.ll
===================================================================
--- llvm/test/Transforms/InstCombine/malloc-free-delete.ll
+++ llvm/test/Transforms/InstCombine/malloc-free-delete.ll
@@ -276,6 +276,8 @@
; delete[](void*, unsigned long, align_val_t)
declare void @_ZdaPvmSt11align_val_t(i8*, i64, i64) nobuiltin
+declare void @llvm.assume(i1)
+
define void @test8() {
; CHECK-LABEL: @test8(
; CHECK-NEXT: ret void
@@ -317,6 +319,12 @@
call void @_ZdaPvmSt11align_val_t(i8* %naa2, i64 32, i64 8) builtin
%naja2 = call i8* @_ZnajSt11align_val_t(i32 32, i32 8) builtin
call void @_ZdaPvjSt11align_val_t(i8* %naja2, i32 32, i32 8) builtin
+
+ ; Check that the alignment assume does not prevent the removal.
+ %nwa3 = call i8* @_ZnwmSt11align_val_t(i64 32, i64 16) builtin
+ call void @llvm.assume(i1 true) [ "align"(i8* %nwa3, i64 16) ]
+ call void @_ZdlPvmSt11align_val_t(i8* %nwa3, i64 32, i64 16) builtin
+
ret void
}
@@ -343,7 +351,7 @@
define void @test11() {
; CHECK-LABEL: @test11(
-; CHECK-NEXT: [[CALL:%.*]] = call dereferenceable(8) i8* @_Znwm(i64 8) #6
+; CHECK-NEXT: [[CALL:%.*]] = call dereferenceable(8) i8* @_Znwm(i64 8) #7
; CHECK-NEXT: call void @_ZdlPv(i8* nonnull [[CALL]])
; CHECK-NEXT: ret void
;
Index: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2480,6 +2480,7 @@
return false;
LLVM_FALLTHROUGH;
}
+ case Intrinsic::assume:
case Intrinsic::invariant_start:
case Intrinsic::invariant_end:
case Intrinsic::lifetime_start:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81854.273782.patch
Type: text/x-patch
Size: 1839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200626/5ccee0e9/attachment.bin>
More information about the llvm-commits
mailing list