I upgraded Xcode to 13.1.1, still, I'm facing the same issue.
Also, I tried -Onone instead of -Osize. That also didn't resolve it.
Stack Trace:
LLVM ERROR: out of memory
Allocation failed
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /Users/agam.mahajan/Downloads/Xcode_13.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/agam.mahajan/Library/Developer/Xcode/DerivedData/swiggy-fpqeaxzzxjoxjtfopejvjwuvlfci/Build/Intermediates.noindex/ArchiveIntermediates/swiggy/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/DLS.build/Objects-normal/arm64/RestaurantTextBlock.bc -embed-bitcode -target arm64-apple-ios11.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name DLS -o /Users/agam.mahajan/Library/Developer/Xcode/DerivedData/swiggy-fpqeaxzzxjoxjtfopejvjwuvlfci/Build/Intermediates.noindex/ArchiveIntermediates/swiggy/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/DLS.build/Objects-normal/arm64/RestaurantTextBlock.o
1. Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
2. Compiling with the current language version
3. Running pass 'Function Pass Manager' on module '/Users/agam.mahajan/Library/Developer/Xcode/DerivedData/swiggy-fpqeaxzzxjoxjtfopejvjwuvlfci/Build/Intermediates.noindex/ArchiveIntermediates/swiggy/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/DLS.build/Objects-normal/arm64/RestaurantTextBlock.bc'.
4. Running pass 'ObjC ARC contraction' on function '@_ZL15ASDimensionMaked'