Fix a logic bug when copying fast-math flags.
authorSanjay Patel <spatel@rotateright.com>
Tue, 2 Sep 2014 20:03:00 +0000 (20:03 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 2 Sep 2014 20:03:00 +0000 (20:03 +0000)
commit4211bbc568c8642c6261c1d29bc73a64868514ca
tree1e273c1d5e1ad211c3d096927efd6eec8ad71793
parent6cae39f28465bd6a438aa27d9bdfdf92f0c72086
Fix a logic bug when copying fast-math flags.

"Setting" does not equal "copying". This bug has sat dormant for 2 reasons:
1. The unit test was not adequate.
2. Every current user of the "copyFastMathFlags" API is operating on a new instruction.
   (ie, all existing fast-math flags are off). If you copy flags to an existing
   instruction that has some flags on already, you will not necessarily turn them off
   as expected.

I uncovered this bug while trying to implement a fix for PR20802.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216939 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/InstrTypes.h
include/llvm/IR/Instruction.h
include/llvm/IR/Operator.h
lib/IR/Instruction.cpp
lib/IR/Instructions.cpp
unittests/IR/IRBuilderTest.cpp