This is an archive of the discontinued LLVM Phabricator instance.

Pointer types were treated as zero-size by MergeICmps
ClosedPublic

Authored by clin1 on Oct 22 2018, 3:59 PM.

Details

Summary

The visitICmp analysis function would record compares of pointer types, as size 0. This causes the resulting memcmp() call to have the wrong total size.
Found with "self-build" of clang/LLVM on Windows.

Diff Detail

Repository
rL LLVM

Event Timeline

clin1 created this revision.Oct 22 2018, 3:59 PM
courbet accepted this revision.Oct 26 2018, 12:36 AM

Thanks !

test/Transforms/MergeICmps/X86/int64-and-ptr.ll
2 ↗(On Diff #170517)

move this after the comment ?

; 8-byte int and 8-byte pointer should merge into a 16-byte memcpy.
; X86: memcmp(i8* {{.*}}, i8* {{.*}}, i64 16)
This revision is now accepted and ready to land.Oct 26 2018, 12:36 AM
clin1 updated this revision to Diff 171320.Oct 26 2018, 10:51 AM

Thanks! I've made the suggested test change.

One more favor to ask: Could I please have some help committing this fix? I'm new to the project and don't have write access yet...

One more favor to ask: Could I please have some help committing this fix? I'm new to the project and don't have write access yet...

No problem, I'll commit that for you.

This revision was automatically updated to reflect the committed changes.