Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Analysis] improve function signature checking for calloc
This would crash later if we thought the parameters were valid for the standard library call as shown in: https://llvm.org/PR50846
- Loading branch information
1 parent
f45eee2
commit 7414bbe
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; RUN: opt < %s -instcombine -S | FileCheck %s | ||
|
||
; The argument types should match if it is the standard library calloc. | ||
; Don't crash analyzing an imposter. | ||
|
||
declare i8* @calloc(i64, i32) | ||
|
||
define void @PR50846() { | ||
; CHECK-LABEL: @PR50846( | ||
; CHECK-NEXT: [[CALL:%.*]] = call i8* @calloc(i64 1, i32 1) | ||
; CHECK-NEXT: ret void | ||
; | ||
%call = call i8* @calloc(i64 1, i32 1) | ||
ret void | ||
} |