-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InstCombine adds incompatible attributes to call site #48154
Comments
This is a bug, but not an Attributor one ;) Looking where the attribute needs to be dropped now. |
Somewhere in instcombine but I didn't find it immediately, I hope someone knows and gives an update tomorrow. |
Thanks for pointing it out. I'll give it a try. |
It might be as simple as this https://reviews.llvm.org/D87306 I haven't tried it though. We might not need to know where it comes from ;) |
Minimal test: define i32 @#48810 (i32* %x) { declare i8* @mempcpy(i8*, i32*, i64) Instcombine tries to convert that to a memcpy intrinsic: Value *LibCallSimplifier::optimizeMemPCpy(CallInst *CI, IRBuilderBase &B) { But IIUC, we can't apply "dereferenceable" to a void return. |
We need something like this (taken from InstCombineCalls.cpp:2281):
|
Thanks for the pointer! |
No, I am not. |
Minimally fixed the crash: |
Thanks for the quick fix. |
Extended Description
Here is the minimum repro.
repro.c:
a, b;
void *mempcpy(void *, , long);
c() {
char *d = mempcpy(d, a, b);
*d = '\0';
c(d);
}
repro.sh:
clang -mllvm -attributor-enable=module -O2 repro.c
error:
Wrong types for attribute: inalloca nest noalias nocapture noundef nonnull readnone readonly signext zeroext byref(void) byval(void) preallocated(void) sret(void) align 1 dereferenceable(1) dereferenceable_or_null(1)
tail call nonnull dereferenceable(1) void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 undef, i8* readonly align 1 %3, i64 %conv1, i1 false) #3
in function c
fatal error: error in backend: Broken function found, compilation aborted!
clang-12: error: clang frontend command failed with exit code 70 (use -v to see invocation)
The text was updated successfully, but these errors were encountered: