[PATCH] D50039: [LibCalls] Added nonnull atribute to libc function args
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 31 09:01:12 PDT 2018
xbolva00 added a comment.
Calls which are not reorded in IR works ok, and transformation already works (memset, etc..)
int foo(char *s) {
memset(s, 0, 10);
if (!s) // eliminated
abort();
return l;
}
int foo(char *s) {
int l = strlen(s);
if (!s)
abort();
return l;
}
for strlen, we have IR:
; Function Attrs: nounwind
define dso_local i32 @foo(i8* readonly %s) local_unnamed_addr #0 {
entry:
%tobool = icmp eq i8* %s, null
br i1 %tobool, label %if.then, label %if.end
if.then: ; preds = %entry
tail call void @abort() #3
unreachable
if.end: ; preds = %entry
%call = tail call i32 @strlen(i8* %s) #4
ret i32 %call
}
; Function Attrs: argmemonly nounwind readonly
declare dso_local i32 @strlen(i8* nocapture nonnull) local_unnamed_addr #
Where should we work on above case? SCCP?
Repository:
rL LLVM
https://reviews.llvm.org/D50039
More information about the llvm-commits
mailing list