These are used for special arguments to intrinsics and don't make any
sense to consider for poisonness. Fixes not pushing freeze through
llvm.fptrunc.round.
92106641ae297c24877085e0357e8095aa7b43c9 made
isGuaranteedNotToBeUndefOrPoison return false for metadata arguments,
which doesn't entirely make sense. An alternate patch could switch
that to true, and try to filter out adding some pointless noundefs on
metadata arguments (I tried that, attributor breaks one case with a
llvm.dbg.value in it).
// poison.
Use *MaybePoisonOperand = nullptr;
for (Use &U : OrigOpInst->operands()) {
- if (isGuaranteedNotToBeUndefOrPoison(U.get()))
+ if (isa<MetadataAsValue>(U.get()) ||
+ isGuaranteedNotToBeUndefOrPoison(U.get()))
continue;
if (!MaybePoisonOperand)
MaybePoisonOperand = &U;
define float @freeze_fptrunc_round(double %arg0) {
; CHECK-LABEL: @freeze_fptrunc_round(
-; CHECK-NEXT: [[OP:%.*]] = call float @llvm.fptrunc.round.f32.f64(double [[ARG0:%.*]], metadata !"round.downward")
-; CHECK-NEXT: [[FREEZE:%.*]] = freeze float [[OP]]
-; CHECK-NEXT: ret float [[FREEZE]]
+; CHECK-NEXT: [[ARG0_FR:%.*]] = freeze double [[ARG0:%.*]]
+; CHECK-NEXT: [[OP:%.*]] = call float @llvm.fptrunc.round.f32.f64(double [[ARG0_FR]], metadata !"round.downward")
+; CHECK-NEXT: ret float [[OP]]
;
%op = call float @llvm.fptrunc.round.f32.f64(double %arg0, metadata !"round.downward")
%freeze = freeze float %op