diff options
author | Vyacheslav Klochkov <vyacheslav.n.klochkov@gmail.com> | 2016-11-22 20:52:53 +0000 |
---|---|---|
committer | Vyacheslav Klochkov <vyacheslav.n.klochkov@gmail.com> | 2016-11-22 20:52:53 +0000 |
commit | 9a630dfb57385284bfc78f396ec977f51980b685 (patch) | |
tree | 27167cf1e965eb1c82b8ef94b6a9ba8cbc6eb6c8 /llvm/lib/Transforms/Scalar/GVN.cpp | |
parent | f4de3b68bb5bc44d7f8c5634185a62d701219b74 (diff) | |
download | bcm5719-llvm-9a630dfb57385284bfc78f396ec977f51980b685.tar.gz bcm5719-llvm-9a630dfb57385284bfc78f396ec977f51980b685.zip |
Fixed the lost FastMathFlags in GVN(Global Value Numbering).
Reviewer: Hal Finkel.
Differential Revision: https://reviews.llvm.org/D26952
llvm-svn: 287700
Diffstat (limited to 'llvm/lib/Transforms/Scalar/GVN.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index b6591531265..d5234c0f7e3 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1731,7 +1731,12 @@ static void patchReplacementInstruction(Instruction *I, Value *Repl) { // Patch the replacement so that it is not more restrictive than the value // being replaced. - ReplInst->andIRFlags(I); + // Note that if 'I' is a load being replaced by some operation, + // for example, by an arithmetic operation, then andIRFlags() + // would just erase all math flags from the original arithmetic + // operation, which is clearly not wanted and not needed. + if (!isa<LoadInst>(I)) + ReplInst->andIRFlags(I); // FIXME: If both the original and replacement value are part of the // same control-flow region (meaning that the execution of one |