[Reassociation] Fix miscompile for va_arg arguments.
authorQuentin Colombet <qcolombet@apple.com>
Thu, 6 Aug 2015 18:44:34 +0000 (18:44 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Thu, 6 Aug 2015 18:44:34 +0000 (18:44 +0000)
commitf5232c2a9bb8977857ea6ace4cc374240fa9fe88
tree7454cabac4d468a72301587b0e5f970012ae6e90
parentdcfc69899756f56739f18ebbe7b4bc8622bc54cb
[Reassociation] Fix miscompile for va_arg arguments.

iisUnmovableInstruction() had a list of instructions hardcoded which are
considered unmovable. The list lacked (at least) an entry for the va_arg
and cmpxchg instructions.
Fix this by introducing a new Instruction::mayBeMemoryDependent()
instead of maintaining another instruction list.

Patch by Matthias Braun <matze@braunis.de>.

Differential Revision: http://reviews.llvm.org/D11577

rdar://problem/22118647

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244244 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ValueTracking.h
lib/Analysis/ValueTracking.cpp
lib/Transforms/Scalar/Reassociate.cpp
test/Transforms/Reassociate/vaarg_movable.ll [new file with mode: 0644]