[llvm] SimplifyLibCalls: Emit vector ldexp intrinsics in exp2->ldexp combine (PR #92219)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 18:27:56 PDT 2024


================
@@ -2000,11 +2000,13 @@ static Value *getIntToFPVal(Value *I2F, IRBuilderBase &B, unsigned DstWidth) {
     Value *Op = cast<Instruction>(I2F)->getOperand(0);
     // Make sure that the exponent fits inside an "int" of size DstWidth,
     // thus avoiding any range issues that FP has not.
-    unsigned BitWidth = Op->getType()->getPrimitiveSizeInBits();
-    if (BitWidth < DstWidth ||
-        (BitWidth == DstWidth && isa<SIToFPInst>(I2F)))
-      return isa<SIToFPInst>(I2F) ? B.CreateSExt(Op, B.getIntNTy(DstWidth))
-                                  : B.CreateZExt(Op, B.getIntNTy(DstWidth));
+    unsigned BitWidth =
+        Op->getType()->getScalarType()->getPrimitiveSizeInBits();
----------------
nikic wrote:

```suggestion
        Op->getType()->getScalarSizeInBits();
```

https://github.com/llvm/llvm-project/pull/92219


More information about the llvm-commits mailing list