[PATCH] D27932: InstSimplify: Eliminate fabs on known positive

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 11:58:46 PST 2016


efriedma added a comment.

SimplifyIntrinsic() is structured in a confusing way; can you rearrange the whole function (in a separate patch) to look more like the following?

  if (IsIdempotent(IID)) {
    [...]
  }
  switch (IID) {
  case Intrinsic::usub_with_overflow:
  [...]
  case Intrinsic::fabs:
  [...]
  }



================
Comment at: test/Transforms/InstSimplify/floating-point-arithmetic.ll:133-134
+  %cmp = icmp eq i32 %c, 0
+  %select = select i1 %cmp, float -0.0, float 0.0
+  %fabs = call float @llvm.fabs.f32(float %select)
+  ret float %fabs
----------------
fabs() returns +0 if the input is -0, so we can't eliminate it here.


https://reviews.llvm.org/D27932





More information about the llvm-commits mailing list