Fill in the TODO in CodeGenPrepare::OptimizeCallInst so that global variables that are passed to memory intrinsics are aligned in the same way that allocas are.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/CodeGenPrepare.cpp | ||
---|---|---|
1249 ↗ | (On Diff #22198) | If you add a continue here, then you might end up skipping some logic further down that would otherwise apply, no? |
1257 ↗ | (On Diff #22198) | Why? Do the alignments need to match? |
1260 ↗ | (On Diff #22198) | Do you want this or hasUniqueInitializer() or hasDefinitiveInitializer()? |
lib/CodeGen/CodeGenPrepare.cpp | ||
---|---|---|
1249 ↗ | (On Diff #22198) | That's what we want: this is the 'offset must be a multiple of the alignment' check, and if it's not true we don't want to align for both allocas and global variables. |
1257 ↗ | (On Diff #22198) | http://llvm.org/docs/LangRef.html#global-variables says: |
1260 ↗ | (On Diff #22198) | I think that hasUniqueInitializer is what we want. We want to make sure that increasing the alignment of this GlobalVariable will definitely increase the alignment in the final executable, i.e. we won't get a definition of this variable from another object that doesn't have this increased alignment. |
lib/CodeGen/CodeGenPrepare.cpp | ||
---|---|---|
1261 ↗ | (On Diff #22198) | As I said to Hal previously, http://llvm.org/docs/LangRef.html#global-variables says: |
LGTM. But please, let Hal reply to your questions before commit.
lib/CodeGen/CodeGenPrepare.cpp | ||
---|---|---|
1261 ↗ | (On Diff #22198) | Sorry, I missed the "section" part when I read that. :) |