Globals that are promoted to an ARM constant pool may alias with another
existing constant pool entry. We need to keep a reference to all globals that
were promoted to each constant pool value so that we can emit a distinct label
for each promoted global. These labels are necessary so that debug info can
refer to the promoted global without an undefined reference during linking.
Details
- Reviewers
compnerd t.p.northover rengolin
Diff Detail
- Build Status
Buildable 9957 Build 9957: arc lint + arc unit
Event Timeline
Didn't realize llvm-commits needed to be added as a sub. Done now.
I just wanted to ping this patch and see if someone had time to review it. The bug seems fairly hard to trigger, but I have real code that can't build with LTO because of this problem (libXML2 linked statically into another lib, all built with LTO). I also have a reduced C test case, but the IR test is simpler.
Thanks in advance!
Please trim down the test. I dont think that any of the debug info metadata is needed to validate the CPE is coalesced nor are the attributes.
lib/Target/ARM/ARMAsmPrinter.cpp | ||
---|---|---|
868–873 | Shouldn't this be const auto *GV? | |
lib/Target/ARM/ARMConstantPoolValue.cpp | ||
196 | Please use C++ style casts (static_cast). Renaming the type doesn't offer much here, why not use auto? | |
211 | This should probably be const auto * or const auto &. | |
lib/Target/ARM/ARMConstantPoolValue.h | ||
179–180 | If these aren't used right now, we could just inline them into the promotedGlobals call. |
Address review comments
- Mark auto pointers explicitly const
- Remove unncessary iterator begin and end functions
- Remove debug info from IR test
Thanks for the review. I think I've addressed all comments.
I originally had the debug info in the IR test because I was also testing compiling the IR with clang to make sure the output binary could be linked. I've removed it now since it's not needed for the regression test.
LG with the further test changes.
test/CodeGen/ARM/constantpool-promote-duplicate.ll | ||
---|---|---|
2 | Please add an explicit triple. It makes debugging things easier (when the test fails, the command itself is printed, and the host may be different). | |
4–5 | I think that you can drop these. I dont think that there is anything Linux specific about this. I think that thumbv7-unknown-none-eabi is a better target. | |
27–28 | Are the attributes really necessary? Im pretty sure that you should be able to drop them and the annotations. |
Thanks, addressed test changes. Can someone commit this patch?
test/CodeGen/ARM/constantpool-promote-duplicate.ll | ||
---|---|---|
4–5 | I used arm-eabi since it seems to be used in other ARM tests and this test doesn't depend on any thumb behavior. Is that alright? |
Sure, I can commit it on your behalf.
test/CodeGen/ARM/constantpool-promote-duplicate.ll | ||
---|---|---|
4–5 | The other tests using it isn't the best argument. However, armv7-eabi is as good as thumbv7-eabi in this case. |
Shouldn't this be const auto *GV?