OSDN Git Service

Stop lying about pointers' required alignments.
authorTim Northover <tnorthover@apple.com>
Mon, 12 Dec 2016 23:29:07 +0000 (23:29 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 12 Dec 2016 23:29:07 +0000 (23:29 +0000)
commit620dd6f6a9b49210903cda1754f9bb935b3cf9a6
tree31ae0c24d9c4e33d4595e102adebc24193970259
parentbeb753026adc1b14e3ef6f8823395b190d3d159e
Stop lying about pointers' required alignments.

These extra specializations were added in the depths of history (r67984 from
2009) and are clearly problematic now. The pointers actually are aligned to the
default (8 bytes), since otherwise UBsan would be complaining loudly.

I *think* it originally made sense because there was no "alignof" to infer the
correct value so the generic case went with what malloc returned (8-byte
aliged objects), and on 32-bit machines this specialization was correct. It
became wrong when we started compiling for 64-bit, and caused a UBSan failure
when we tried to put a ValueHandle into a DenseMap.

Should fix the Green Dragon UBSan bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289496 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Instruction.h
include/llvm/IR/Use.h
include/llvm/IR/Value.h
include/llvm/IR/ValueHandle.h