Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Added a test, which fails without my fix. I named it i386-bug-fix.ll, let me know if you prefer a better name.
The culprit is the 'target datalayout' statement. I didn't dig deeper, but it somehow makes the max pointer size to be 64.
llvm/lib/Analysis/StackSafetyAnalysis.cpp | ||
---|---|---|
157 | The pointer size depends on the address space, you probably want DL.getPointerTypeSizeInBits(AI.getType()). |
llvm/lib/Analysis/StackSafetyAnalysis.cpp | ||
---|---|---|
157 | getPointerSizeInBits() should be fine but we need to checks that address space is default. I am not sure this analysis is true for alternative address spaces and current users also ignore non default ones. |
Made the test run using FileCheck and changed one place to use DL.getPointerTypeSizeInBits(AI.getType()).
llvm/lib/Analysis/StackSafetyAnalysis.cpp | ||
---|---|---|
157 | I can change it back if you think getPointerSizeInBits() is the right approach. | |
756 | I don't think we have access to AllocaInst here, right? I will keep it like this. | |
llvm/test/Analysis/StackSafetyAnalysis/i386-bug-fix.ll | ||
2 | Added the test instructions, PTAL. |
llvm/lib/Analysis/StackSafetyAnalysis.cpp | ||
---|---|---|
825 | I guess here, if AddressSpace is not 0, then skip it for now. |
llvm/lib/Analysis/StackSafetyAnalysis.cpp | ||
---|---|---|
157 | I'd prefer assert( getAddressSpace() == 0 with change at line ~825 to skip them |
llvm/lib/Analysis/StackSafetyAnalysis.cpp | ||
---|---|---|
756 | yes |
LGTM with skip/assert
I guess in a separate patch we need to review how we handle accesses of different address spaces.
@nikic Thanks for pointing to address space issue.
llvm/lib/Analysis/StackSafetyAnalysis.cpp | ||
---|---|---|
157 | The issue is that this function is also called from another place and will fail if I add a check there too. I will keep the code as is. |
The pointer size depends on the address space, you probably want DL.getPointerTypeSizeInBits(AI.getType()).