Revert "Merge pull request #80767 from meg-gupta/reverttransparent"

This reverts commit 198a802719, reversing
changes made to 8eb43af590.
This commit is contained in:
Meghana Gupta
2025-04-19 09:54:53 -07:00
parent d0812a4143
commit d81b5f7e27
6 changed files with 44 additions and 18 deletions

View File

@@ -938,6 +938,16 @@ static void substituteConstants(FoldState &foldState) {
for (SILValue constantSILValue : foldState.getConstantSILValues()) {
SymbolicValue constantSymbolicVal =
evaluator.lookupConstValue(constantSILValue).value();
CanType instType = constantSILValue->getType().getASTType();
// If the SymbolicValue is a string but the instruction that is folded is
// not String typed, we are tracking a StaticString which is represented as
// a raw pointer. Skip folding StaticString as they are already efficiently
// represented.
if (constantSymbolicVal.getKind() == SymbolicValue::String &&
!instType->isString())
continue;
// Make sure that the symbolic value tracked in the foldState is a constant.
// In the case of ArraySymbolicValue, the array storage could be a non-constant
// if some instruction in the array initialization sequence was not evaluated
@@ -976,7 +986,6 @@ static void substituteConstants(FoldState &foldState) {
SILBuilderWithScope builder(insertionPoint);
SILLocation loc = insertionPoint->getLoc();
CanType instType = constantSILValue->getType().getASTType();
SILValue foldedSILVal = emitCodeForSymbolicValue(
constantSymbolicVal, instType, builder, loc, foldState.stringInfo);