[PATCH] D107252: [NFC][ConstantFold] Check getAggregateElement before getSplatValue call
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 3 21:52:31 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdf4e0beaeb0c: [NFC][ConstantFold] Check getAggregateElement before getSplatValue call (authored by zsrkmyn, committed by MaskRay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107252/new/
https://reviews.llvm.org/D107252
Files:
llvm/lib/IR/ConstantFold.cpp
Index: llvm/lib/IR/ConstantFold.cpp
===================================================================
--- llvm/lib/IR/ConstantFold.cpp
+++ llvm/lib/IR/ConstantFold.cpp
@@ -667,13 +667,16 @@
}
}
+ if (Constant *C = Val->getAggregateElement(CIdx))
+ return C;
+
// Lane < Splat minimum vector width => extractelt Splat(x), Lane -> x
if (CIdx->getValue().ult(ValVTy->getElementCount().getKnownMinValue())) {
if (Constant *SplatVal = Val->getSplatValue())
return SplatVal;
}
- return Val->getAggregateElement(CIdx);
+ return nullptr;
}
Constant *llvm::ConstantFoldInsertElementInstruction(Constant *Val,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107252.363966.patch
Type: text/x-patch
Size: 645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210804/9b4e2f87/attachment.bin>
More information about the llvm-commits
mailing list