[LLVMbugs] [Bug 23301] New: InstCombine: objectsize of alloca optimized to undef returns unknown
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Apr 20 17:32:25 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23301
Bug ID: 23301
Summary: InstCombine: objectsize of alloca optimized to undef
returns unknown
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: ahmed.bougacha at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Reported by Daniel Micay in PR23280:
#include <stdio.h>
#include <stdlib.h>
static inline __attribute__((always_inline)) size_t object_size(char *p) {
return __builtin_object_size(p, 0);
}
int main(int argc, char **argv) {
char buf[2];
printf("%zu\n", object_size(buf));
return 0;
}
This returns -1 because buf is optimized to undef by InstCombine.
When InstCombine tries to erase an alloca, the isAllocSiteRemovable logic is
smarter than the RAUW-undef logic: when there's a (objectsize (GEP/bitcast
(alloca))), we should look through the alloca users to properly lower the
objectsize calls. We currently just do something like alloca->RAUW(undef).
Perhaps the RAUW-undef logic and isAllocSiteRemovable should match? This would
let the above example print 2 instead of the current -1.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150421/ee6b65b2/attachment.html>
More information about the llvm-bugs
mailing list