[PATCH] D143954: [ValueTracking] It is not safe to execute FDIV/FREM speculatively

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 13 15:40:25 PST 2023


Carrot added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:4837
+  case Instruction::FRem: {
+    // x / y is undefined if y == 0.0.
+    const APFloat *V;
----------------
craig.topper wrote:
> craig.topper wrote:
> > craig.topper wrote:
> > > I don't think this is correct. x/0.0 is infinity or negative infinity. Unless x is 0.0 in which case it's nan. But in any case its not undefined.
> > > I don't think this is correct. x/0.0 is infinity or negative infinity. Unless x is 0.0 in which case it's nan. But in any case its not undefined.
> > 
> > 
> So I don't understand why this patch is needed. There's nothing undefined about fdiv/frem.
I copied it from the following UDiv/URem case. It should be changed to 
       // x / y causes exception if y == 0.0.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143954



More information about the llvm-commits mailing list