[llvm] [LLVM][IR] Use splat syntax when printing ConstantDataVector. (PR #112548)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 16 07:24:23 PDT 2024
================
@@ -1687,6 +1692,46 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
return;
}
+ // When in the mode where Constant{Int,FP} do not support vector types the
+ // "splat(Ty val)" syntax is interpreted as a ConstantDataVector. Maintaining
+ // this association when outputiing the IR will significantly reduce the
+ // output changes when in the mode where Constant{Int,FP} do support vector
+ // types. In turn this should make it easier to spot difference in output
+ // when switching between the modes. Once the transition is complete this
+ // code will be removed.
+ if (const ConstantDataVector *CDV = dyn_cast<ConstantDataVector>(CV)) {
+ if (auto *SplatVal = CDV->getSplatValue()) {
+ Type* EltTy = SplatVal->getType();
+
+ if (EltTy->isIntegerTy() && !UseConstantIntForFixedLengthSplat) {
----------------
paulwalker-arm wrote:
I agree. This code only exists so that once I've updated all the tests I can remove the check to doubly verify. I'll do this locally so it shouldn't be part of the final PR unless it turns out we're wrong.
https://github.com/llvm/llvm-project/pull/112548
More information about the llvm-commits
mailing list