[PATCH] D103992: [InstCombine / BuildLibCalls] Add parameter attributes from the prototype.
Jonas Paulsson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 9 17:43:33 PDT 2021
jonpa updated this revision to Diff 351014.
jonpa added a comment.
Herald added a subscriber: pengfei.
Thanks for review!
This was not quite complete to commit as it was a suggestion and there were still the tests updates to do...
I could update most of the tests with update_test_checks.py, and most of the remaining manually (not quite sure if the function attribute '#0' tag should be part of the test line or not, but I think it shouldn't matter).
However, there are now two remaining tests that the verifier rejects, but I am not quite sure how to fix them:
LLVM :: Transforms/InstCombine/strcpy_chk-1.ll
LLVM :: Transforms/InstCombine/strncpy_c
Instcombiner builds the memcpy, but this time the 'returned' attribute is included as a parameter attribute. That makes Verifier.cpp (line 1962) do the check (which it simply omitted before)
Assert(Ty->canLosslesslyBitCastTo(FT->getReturnType())
where Ty is '*i8', and FT->getReturnType() is 'void'.
There doesn't really seem to be an error as the call looks like
call void @llvm.memcpy.p0i8.p0i8.i32(i8* noalias noundef nonnull returned ...
I suppose getReturnType() should in this case return '*i8' and not void. Or possibly the Verifier could be adapted to understand this check?
Given that the problematic patch was reverted, I wonder now if this is still relevant and needed and we should fix the above problem now?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103992/new/
https://reviews.llvm.org/D103992
Files:
llvm/lib/Transforms/Utils/BuildLibCalls.cpp
llvm/test/CodeGen/X86/no-plt-libcalls.ll
llvm/test/Other/cgscc-libcall-update.ll
llvm/test/Transforms/InstCombine/2010-05-30-memcpy-Struct.ll
llvm/test/Transforms/InstCombine/ARM/strcmp.ll
llvm/test/Transforms/InstCombine/debug-line.ll
llvm/test/Transforms/InstCombine/exp2-1.ll
llvm/test/Transforms/InstCombine/fdiv-cos-sin.ll
llvm/test/Transforms/InstCombine/fdiv-sin-cos.ll
llvm/test/Transforms/InstCombine/float-shrink-compare.ll
llvm/test/Transforms/InstCombine/fortify-folding.ll
llvm/test/Transforms/InstCombine/fprintf-1.ll
llvm/test/Transforms/InstCombine/fputs-1.ll
llvm/test/Transforms/InstCombine/fputs-opt-size.ll
llvm/test/Transforms/InstCombine/fwrite-1.ll
llvm/test/Transforms/InstCombine/libcall-param-attrs.ll
llvm/test/Transforms/InstCombine/memcmp-1.ll
llvm/test/Transforms/InstCombine/memset-1.ll
llvm/test/Transforms/InstCombine/memset_chk-1.ll
llvm/test/Transforms/InstCombine/objsize.ll
llvm/test/Transforms/InstCombine/pow_fp_int.ll
llvm/test/Transforms/InstCombine/pow_fp_int16.ll
llvm/test/Transforms/InstCombine/printf-1.ll
llvm/test/Transforms/InstCombine/printf-2.ll
llvm/test/Transforms/InstCombine/printf-3.ll
llvm/test/Transforms/InstCombine/puts-1.ll
llvm/test/Transforms/InstCombine/realloc.ll
llvm/test/Transforms/InstCombine/simplify-libcalls.ll
llvm/test/Transforms/InstCombine/sprintf-1.ll
llvm/test/Transforms/InstCombine/sqrt.ll
llvm/test/Transforms/InstCombine/stpcpy-1.ll
llvm/test/Transforms/InstCombine/stpcpy_chk-1.ll
llvm/test/Transforms/InstCombine/strchr-1.ll
llvm/test/Transforms/InstCombine/strcmp-1.ll
llvm/test/Transforms/InstCombine/strcmp-memcmp.ll
llvm/test/Transforms/InstCombine/strcspn-1.ll
llvm/test/Transforms/InstCombine/strncat-2.ll
llvm/test/Transforms/InstCombine/strndup.ll
llvm/test/Transforms/InstCombine/strstr-1.ll
llvm/test/Transforms/MergeICmps/X86/alias-merge-blocks.ll
llvm/test/Transforms/MergeICmps/X86/entry-block-shuffled.ll
llvm/test/Transforms/MergeICmps/X86/gep-references-bb.ll
llvm/test/Transforms/MergeICmps/X86/int64-and-ptr.ll
llvm/test/Transforms/MergeICmps/X86/multiple-blocks-does-work.ll
llvm/test/Transforms/MergeICmps/X86/pair-int32-int32.ll
llvm/test/Transforms/MergeICmps/X86/pr41917.ll
llvm/test/Transforms/MergeICmps/X86/split-block-does-work.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103992.351014.patch
Type: text/x-patch
Size: 130601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210610/9511071f/attachment.bin>
More information about the llvm-commits
mailing list