<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62095>62095</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[NewGVN] Fast math flags dropped
</td>
</tr>
<tr>
<th>Labels</th>
<td>
performance,
llvm:GVN
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
piotrAMD
</td>
</tr>
</table>
<pre>
NewGVN drops fast math flags - see the reproducer with `fdiv` below:
```define void @repro(float %.i2240) {
.entry:
%0 = fdiv reassoc nnan nsz arcp contract afn float %.i2240, 0.000000e+00
br label %.cont.1
.cont.1: ; preds = %.entry
br i1 false, label %.cont.2, label %.else.2
.else.2: ; preds = %.cont.1
br label %.cont.2
.cont.2: ; preds = %.else.2, %.cont.1
%.sroa.12.1.2 = phi float [ %0, %.else.2 ], [ 0.000000e+00, %.cont.1 ]
%1 = fcmp olt float %.sroa.12.1.2, 0.000000e+00
br i1 %1, label %2, label %.preheader.3
2: ; preds = %.cont.2
br label %.preheader.3
.preheader.3: ; preds = %2, %.cont.2
ret void
}
```
opt -S -passes="newgvn"
```
define void @repro(float %.i2240) {
.entry:
%0 = fdiv float %.i2240, 0.000000e+00
br label %.cont.1
.cont.1: ; preds = %.entry
br i1 false, label %.cont.2, label %.else.2
.else.2: ; preds = %.cont.1
br label %.cont.2
.cont.2: ; preds = %.else.2, %.cont.1
%1 = fcmp olt float %0, 0.000000e+00
br i1 %1, label %2, label %.preheader.3
2: ; preds = %.cont.2
br label %.preheader.3
.preheader.3: ; preds = %2, %.cont.2
ret void
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVkFv4jwQ_TXOZURkTxIghxygET19vXxS704yIV6F2LINqPvrV3FKC5Stutv2thEC6cnz3nhenhjpnNoORAXL1iwrI7n3nbaFUdrb1X9lVOnmqXig4_3jAzRWGwetdB520nfQ9nLrYAaOCHxHYMlY3exrsnBUvgM2522jDmzOoaJeH1myYrxk_PQ959OnoVYNBAetGmApDzQMl22vpQeGWawQU84wB7ZYT7UxDd4-vRDCeIwDS0oYFcGSdE7XMAxygMH9BGlrA7UevJW1B9kO8Ib9DnjMw0MM15yfmCsLvayoD2dHilic3-IEJSv48MOSNRhLjQsdj7zTdV4VlYBW9o7Gtq7U8RKj3lGMFx09Q5_r6Pymt4aAb4cQJG_cbWoH727wjoizWsYCYxFjqDGdOrmTrYOxp9qJCVhWBiRbX1t2oRHOveqI6fWodwZ078_8P9N_9y1QItBcjP_KDGOpI9mQjZPz8fyZF-86gjcd-Y3uBX7Lm0tXXrgt-ZDGZ65FeRXYcw1tPMz-h5mRzpFjSckQBzpuDwNDvFn39XH_hiz_i-gHovP-pD-Zl-8IwF_N-QtCEjVF0uRJLiMqxHwpEoEpz6KuaOpKLltJdZvyZFG3rcjnrWgrmSGmcpFGqkCOCU8FikwkmMVSiCrPs5wvlo2sqzlLOe2k6uO-P-xibbeRcm5PxRx5nkVhQi78uSMasq22OznUNGYT7xjiWMWS1f3jwwhlZWSLEZpV-61jKe-V8-6V2ivfh1Vh2ghYVsLmah0YlwRDTbS3fdF5b9yYWtww3GyV7_ZVXOsdw03QnX5mxuofVHuGm9C6Y7gJ3f8KAAD__5X0Q_c">