In getArgumentAlignment check if the ImmutableCallSite pointer CS is non-null before dereferencing. If CS is 0x0 fall back to the ABI type alignment else compute the alignment as before.
Details
Diff Detail
Event Timeline
I have a potential test-case for this, but the patch doesn't apply cleanly to master so I was unable to test if this solves the problem.
Oh, sorry, I didn't see your response before I clicked abandoned. It has been a while, so this patch is pretty stale.
This is my first contribution to llvm so please let me know if I did something wrong in the process
Cool. I didn't know the review system allows having the patch updated like this :) It still reports me as the author and you as a subscriber. I don't think that matters.
lib/Target/NVPTX/NVPTXISelLowering.cpp | ||
---|---|---|
1051 | There is a preference to early exits. So perhaps: if (!CS) return DL.getABITTypeAlignment(Ty); | |
1132–1133 | Move this to a new line to avoid exceeding 80 chars. There are a couple of other formatting changes needed to. The simplest way is to use clang-format. To have the changes you added reformatted you could use clang-format-diff.py: | |
test/CodeGen/NVPTX/zero-cs.ll | ||
2 | Could you add a comment explaining what this test is testing? So this test case would fail previously (dereference null pointer) and now pass (return error)? |
You don't own revision D9168: "[NVPTX] Check if callsite is defined when computing argument allignment". Normally, you should only update revisions you own. You can "Commandeer" this revision from the web interface if you want to become the owner.
I was not able to figure out how to comandeer a revision, so i just went ahead and pushed it.
Looks good to me, do you need help submitting?
lib/Target/NVPTX/NVPTXISelLowering.cpp | ||
---|---|---|
1032 | s/callsize/Call site/ ? |
@jpienaar Since I don't have commit access, I think somebody else needs to commit this.
FWIW I have run into this in the past and just not managed to muster up the energy to fix it. So, thank you!
I was not able to figure out how to comandeer a revision, so i just went ahead and pushed it.
Under "leap into action", one of the options is to commandeer the revision.
s/callsize/Call site/ ?