diff options
author | Zain Jaffal <z_jaffal@apple.com> | 2022-08-17 11:12:15 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2022-08-17 11:12:15 +0100 |
commit | f61f99a105914c7060baf4161ffacc96a0995764 (patch) | |
tree | 17392f9f6bc262a5814979e8a7c1f285cceef33f /llvm/lib/Analysis/ValueTracking.cpp | |
parent | bcb2740f415b0f825402f656dda3271414121a0e (diff) | |
download | llvm-f61f99a105914c7060baf4161ffacc96a0995764.zip llvm-f61f99a105914c7060baf4161ffacc96a0995764.tar.gz llvm-f61f99a105914c7060baf4161ffacc96a0995764.tar.bz2 |
[instcombine] Optimise for zero initialisation of product given fast flags are enabled
Currently, clang ignores the 0 initialisation in finite math
For example:
```
double f_prod = 0;
double arr[1000];
for (size_t i = 0; i < 1000; i++) {
f_prod *= arr[i];
}
```
Clang will ignore that `f_prod` is set to zero and it will generate assembly to iterate over the loop.
Reviewed By: fhahn, spatel
Differential Revision: https://reviews.llvm.org/D131672
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index c4f6781..b2393de 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -6538,7 +6538,8 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO, case Instruction::Sub: case Instruction::And: case Instruction::Or: - case Instruction::Mul: { + case Instruction::Mul: + case Instruction::FMul: { Value *LL = LU->getOperand(0); Value *LR = LU->getOperand(1); // Find a recurrence. |