Miguel Saldivar de36d39e24 [InstCombine] Avoid passing pow attributes to sqrt
As described in issue #58475, we could pass the attributes of pow to sqrt and crash.

Differential Revision: https://reviews.llvm.org/D137454
2022-11-07 12:07:37 -05:00

15 lines
417 B
LLVM

; RUN: opt < %s -passes=instcombine -S | FileCheck %s
; This is a check to assure the attributes of `pow` do
; not get passed to sqrt.
define void @pow_to_sqrt(double %x) {
; CHECK-LABEL: @pow_to_sqrt(
; CHECK-NEXT: [[SQRT:%.*]] = call afn double @sqrt(double [[X:%.*]])
; CHECK-NEXT: ret void
;
%call = call afn double @pow(double %x, double 1.5)
ret void
}
declare double @pow(double noundef, double noundef)