[InstSimplify] Replace calls to null with undef
Calling null is undefined behavior, we can simplify the resulting value
to undef.
llvm-svn: 273777
diff --git a/llvm/test/Transforms/InstSimplify/call.ll b/llvm/test/Transforms/InstSimplify/call.ll
index b360ecb..814f1f2 100644
--- a/llvm/test/Transforms/InstSimplify/call.ll
+++ b/llvm/test/Transforms/InstSimplify/call.ll
@@ -187,4 +187,20 @@
; CHECK: br i1 %cmp, label %cast.end, label %cast.notnull
}
+define i32 @call_null() {
+entry:
+ %call = call i32 null()
+ ret i32 %call
+}
+; CHECK-LABEL: define i32 @call_null(
+; CHECK: ret i32 undef
+
+define i32 @call_undef() {
+entry:
+ %call = call i32 undef()
+ ret i32 %call
+}
+; CHECK-LABEL: define i32 @call_undef(
+; CHECK: ret i32 undef
+
declare noalias i8* @malloc(i64)