llvm-6502/test/Transforms/GVN/newoperator.ll
Nadav Rotem 0a9b452aa4 c++ new operators are not malloc-like functions because they do not return uninitialized memory.
Users may overide new-operators and implement any function that they like.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179071 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-08 23:40:47 +00:00

21 lines
631 B
LLVM

; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
; We can't remove the load because new operators are overideable and can return non-undefined memory.
;CHECK: main
;CHECK: load
;CHECK: ret
define i32 @main(i32 %argc, i8** nocapture %argv) ssp uwtable {
%1 = tail call noalias i8* @_Znam(i64 800)
%2 = bitcast i8* %1 to i32**
%3 = load i32** %2, align 8, !tbaa !0
%4 = icmp eq i32* %3, null
%5 = zext i1 %4 to i32
ret i32 %5
}
declare noalias i8* @_Znam(i64)
!0 = metadata !{metadata !"any pointer", metadata !1}
!1 = metadata !{metadata !"omnipotent char", metadata !2}
!2 = metadata !{metadata !"Simple C/C++ TBAA"}