Skip to content

Commit 8d49258

Browse files
committed
Handle features implying other features in the Subtarget constructor.
1 parent 33a6fd3 commit 8d49258

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
@@ -97,7 +97,7 @@ class WebAssemblySubtarget final : public WebAssemblyGenSubtargetInfo {
9797
bool hasAddr64() const { return TargetTriple.isArch64Bit(); }
9898
bool hasAtomics() const { return HasAtomics; }
9999
bool hasBulkMemory() const { return HasBulkMemory; }
100-
bool hasBulkMemoryOpt() const { return HasBulkMemoryOpt || HasBulkMemory; }
100+
bool hasBulkMemoryOpt() const { return HasBulkMemoryOpt; }
101101
bool hasExceptionHandling() const { return HasExceptionHandling; }
102102
bool hasExtendedConst() const { return HasExtendedConst; }
103103
bool hasFP16() const { return HasFP16; }
@@ -106,7 +106,7 @@ class WebAssemblySubtarget final : public WebAssemblyGenSubtargetInfo {
106106
bool hasMutableGlobals() const { return HasMutableGlobals; }
107107
bool hasNontrappingFPToInt() const { return HasNontrappingFPToInt; }
108108
bool hasReferenceTypes() const { return HasReferenceTypes; }
109-
bool hasCallIndirectOverlong() const { return HasCallIndirectOverlong || HasReferenceTypes; }
109+
bool hasCallIndirectOverlong() const { return HasCallIndirectOverlong; }
110110
bool hasRelaxedSIMD() const { return SIMDLevel >= RelaxedSIMD; }
111111
bool hasSignExt() const { return HasSignExt; }
112112
bool hasSIMD128() const { return SIMDLevel >= SIMD128; }

0 commit comments

Comments
 (0)