Skip to content

Commit 1f77f5e

Browse files
committed
Handle features implying other features in the Subtarget constructor.
1 parent d9a88a1 commit 1f77f5e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

llvm/lib/Target/WebAssembly/WebAssemblySubtarget.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ WebAssemblySubtarget::initializeSubtargetDependencies(StringRef CPU,
3434
CPU = "generic";
3535

3636
ParseSubtargetFeatures(CPU, /*TuneCPU*/ CPU, FS);
37+
38+
// reference-types implies call-indirect-overlong
39+
if (HasReferenceTypes)
40+
HasCallIndirectOverlong = true;
41+
42+
// bulk-memory implies bulk-memory-opt
43+
if (HasBulkMemory)
44+
HasBulkMemoryOpt = true;
45+
3746
return *this;
3847
}
3948

llvm/lib/Target/WebAssembly/WebAssemblySubtarget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class WebAssemblySubtarget final : public WebAssemblyGenSubtargetInfo {
9696
bool hasAddr64() const { return TargetTriple.isArch64Bit(); }
9797
bool hasAtomics() const { return HasAtomics; }
9898
bool hasBulkMemory() const { return HasBulkMemory; }
99-
bool hasBulkMemoryOpt() const { return HasBulkMemoryOpt || HasBulkMemory; }
99+
bool hasBulkMemoryOpt() const { return HasBulkMemoryOpt; }
100100
bool hasExceptionHandling() const { return HasExceptionHandling; }
101101
bool hasExtendedConst() const { return HasExtendedConst; }
102102
bool hasFP16() const { return HasFP16; }
@@ -105,7 +105,7 @@ class WebAssemblySubtarget final : public WebAssemblyGenSubtargetInfo {
105105
bool hasMutableGlobals() const { return HasMutableGlobals; }
106106
bool hasNontrappingFPToInt() const { return HasNontrappingFPToInt; }
107107
bool hasReferenceTypes() const { return HasReferenceTypes; }
108-
bool hasCallIndirectOverlong() const { return HasCallIndirectOverlong || HasReferenceTypes; }
108+
bool hasCallIndirectOverlong() const { return HasCallIndirectOverlong; }
109109
bool hasRelaxedSIMD() const { return SIMDLevel >= RelaxedSIMD; }
110110
bool hasSignExt() const { return HasSignExt; }
111111
bool hasSIMD128() const { return SIMDLevel >= SIMD128; }

0 commit comments

Comments
 (0)