[PATCH] D138642: ConstantFolding: Guard use of getFunction

David Stuttard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 06:13:34 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG62498962e42d: ConstantFolding: Guard use of getFunction (authored by dstuttard).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138642/new/

https://reviews.llvm.org/D138642

Files:
  llvm/lib/Analysis/ConstantFolding.cpp


Index: llvm/lib/Analysis/ConstantFolding.cpp
===================================================================
--- llvm/lib/Analysis/ConstantFolding.cpp
+++ llvm/lib/Analysis/ConstantFolding.cpp
@@ -1959,7 +1959,7 @@
   if (Src.isNormal() || Src.isInfinity())
     return ConstantFP::get(CI->getContext(), Src);
 
-  if (Src.isDenormal()) {
+  if (Src.isDenormal() && CI->getParent() && CI->getFunction()) {
     DenormalMode DenormMode =
         CI->getFunction()->getDenormalMode(Src.getSemantics());
     if (DenormMode == DenormalMode::getIEEE())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138642.478927.patch
Type: text/x-patch
Size: 554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221130/8e6c7e3a/attachment.bin>


More information about the llvm-commits mailing list