rjmccall wrote:

> > On the target hook, it's a shame we can't easily get this information from 
> > LLVM. I believe it's already there — `TargetLowering` has an 
> > `allowsMisalignedMemoryAccesses` method that includes some approximation of 
> > how fast a particular access would be. In practice, it seems to be quite 
> > complex and often specific to the type and subtarget. Maybe it'd be worth 
> > starting a conversation with LLVM folks to see if this could reasonably be 
> > lifted somewhere we could use it?
> 
> Agreed, I did look at that, and AFAICT the allowsMisalignedMemoryAccess is a 
> property of the llvm subtarget, which can, IIUC, change on a per-function 
> basis? One at least needs a function codegen context around? And, clang needs 
> to generate the llvm-structure in non-function contexts (eg namespace-scope 
> variables). I'd really like to not tangle this particular change with a 
> complex reorg.

Yeah, LLVM supports changing subtarget options on a per-function basis.  We 
would presumably make the query based on the global setting.

Anyway, getting this information from LLVM doesn't seem tractable in the 
short-to-medium term; it's just unfortunate.

https://github.com/llvm/llvm-project/pull/65742
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to