[PATCH] D137454: [InstCombine] Avoid passing pow attributes to sqrt
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 09:15:24 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGde36d39e2424: [InstCombine] Avoid passing pow attributes to sqrt (authored by Saldivarcher, committed by spatel).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137454/new/
https://reviews.llvm.org/D137454
Files:
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/test/Transforms/InstCombine/pow-to-sqrt.ll
Index: llvm/test/Transforms/InstCombine/pow-to-sqrt.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/InstCombine/pow-to-sqrt.ll
@@ -0,0 +1,14 @@
+; 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)
Index: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
===================================================================
--- llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -2164,8 +2164,8 @@
return nullptr;
ExpoF = &ExpoI;
- Sqrt = getSqrtCall(Base, Pow->getCalledFunction()->getAttributes(),
- Pow->doesNotAccessMemory(), M, B, TLI);
+ Sqrt = getSqrtCall(Base, AttributeList(), Pow->doesNotAccessMemory(), M,
+ B, TLI);
if (!Sqrt)
return nullptr;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137454.473711.patch
Type: text/x-patch
Size: 1239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221107/ed7412e0/attachment.bin>
More information about the llvm-commits
mailing list