<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Aug 4, 2014, at 5:39 PM, John McCall <<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">On Aug 4, 2014, at 2:58 PM, jahanian <<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>> wrote:<br><blockquote type="cite">New patch which is a simplified version of the previous patch. Simplified by using the existing<br>isAlignmentRequired. No other changes.<br></blockquote><br>+VALUE_LANGOPT(MaxTypeAlign , 32, 0,<br>+ "default maximum alignment for types")<br><br>+def fmax_type_align_EQ : Joined<["-"], "fmax-type-align=">, Group<f_Group>, Flags<[CC1Option]>,<br>+ HelpText<"Specify the default maximum alignment for types">;<br>+def fno_max_type_align : Flag<["-"], "fno-max-type-align">, Group<f_Group>;<br><br>I wordsmithed the option name and help text a little with Doug, and we settled on this:<br><br> -fmax-unknown-pointer-align=N<br> “Specify the maximum alignment to enforce on pointers lacking an explicit alignment"<br><br>You should also document this in docs/UsersManual.rst, in the Controlling<br>Code Generation section. I would recommend the following text:<br><br> -fmax-unknown-pointer-align=[number]<br> -fno-max-unknown-pointer-align<br> Instruct the code generator to not enforce a higher alignment than the given<br> number (of bytes) when accessing memory via an opaque pointer or reference.<br> This cap is ignored when directly accessing a variable or when the pointee<br> type has an explicit “aligned” attribute.<br><br> The value should usually be determined by the properties of the system allocator.<br> Some builtin types, especially vector types, have very high natural alignments;<br> when working with values of those types, Clang usually wants to use instructions<br> that take advantage of that alignment. However, many system allocators do<br> not promise to return memory that is more than 8-byte or 16-byte-aligned. Use<br> this option to limit the alignment that the compiler can assume for an arbitrary<br> pointer, which may point onto the heap.<br><br> This option does not affect the ABI alignment of types; the layout of structs and<br> unions and the value returned by the alignof operator remain the same.<br><br> This option can be overridden on a case-by-case basis by putting an explicit<br> “aligned” alignment on a struct, union, or typedef. For example:<br><br> ::<br> #include <immintrin.h><br> // Make an aligned typedef of the AVX-512 16-int vector type.<br> typedef __v16si __aligned_v16si __attribute__((aligned(64)));<br><br> void initialize_vector(__aligned_v16si *v) {<br> // The compiler may assume that ‘v’ is 64-byte aligned, regardless of the<br> // value of -fmax-unknown-pointer-align.<br> }<br><br>+ ASTContext &Context = CGM.getContext();<br>+ if (const UnaryOperator *UOPE = dyn_cast<UnaryOperator>(E))<br>+ if (UOPE->getOpcode() == UO_Deref) {<br><br>This is far too specific. In your first patch, you were modifying<br>MakeNaturalAlignAddrLValue, which I think was fine; why did you<br>change your mind?<br></blockquote><div><br></div>Checked in r<span style="font-family: Menlo; font-size: 11px;">214911. Please do a post-commit review.</span></div><div><font face="Menlo"><span style="font-size: 11px;">- Thanks, Fariborz</span></font></div><div><font face="Menlo"><span style="font-size: 11px;"><br></span></font><blockquote type="cite"><br>John.</blockquote></div><br></body></html>