Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td +++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td @@ -71,12 +71,6 @@ def : NotifyPatImmOff; def : NotifyPatImmOff; -def NotifyPatGlobalAddr : - Pat<(i32 (int_wasm_atomic_notify (regPlusGA I32:$addr, - (WebAssemblywrapper tglobaladdr:$off)), - I32:$count)), - (ATOMIC_NOTIFY 0, tglobaladdr:$off, I32:$addr, I32:$count)>; - // Select notifys with just a constant offset. def NotifyPatOffsetOnly : Pat<(i32 (int_wasm_atomic_notify imm:$off, I32:$count)), @@ -105,13 +99,6 @@ def : WaitPatImmOff; def : WaitPatImmOff; -class WaitPatGlobalAddr : - Pat<(i32 (kind (regPlusGA I32:$addr, (WebAssemblywrapper tglobaladdr:$off)), - ty:$exp, I64:$timeout)), - (inst 0, tglobaladdr:$off, I32:$addr, ty:$exp, I64:$timeout)>; -def : WaitPatGlobalAddr; -def : WaitPatGlobalAddr; - // Select wait_i32, ATOMIC_WAIT_I32s with just a constant offset. class WaitPatOffsetOnly : Pat<(i32 (kind imm:$off, ty:$exp, I64:$timeout)), @@ -164,9 +151,6 @@ def : LoadPatImmOff; def : LoadPatImmOff; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; - // Select loads with just a constant offset. def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; @@ -257,16 +241,6 @@ def : LoadPatImmOff; // No 32->64 patterns, just use i32.atomic.load and i64.extend_s/i64 -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; - // Extending loads with just a constant offset def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; @@ -326,13 +300,6 @@ def : AStorePatImmOff; def : AStorePatImmOff; -class AStorePatGlobalAddr : - Pat<(kind (regPlusGA I32:$addr, (WebAssemblywrapper tglobaladdr:$off)), - ty:$val), - (inst 0, tglobaladdr:$off, I32:$addr, ty:$val)>; -def : AStorePatGlobalAddr; -def : AStorePatGlobalAddr; - // Select stores with just a constant offset. class AStorePatOffsetOnly : Pat<(kind imm:$off, ty:$val), (inst 0, imm:$off, (CONST_I32 0), ty:$val)>; @@ -387,12 +354,6 @@ def : AStorePatImmOff; def : AStorePatImmOff; -def : AStorePatGlobalAddr; -def : AStorePatGlobalAddr; -def : AStorePatGlobalAddr; -def : AStorePatGlobalAddr; -def : AStorePatGlobalAddr; - // Truncating stores with just a constant offset def : AStorePatOffsetOnly; def : AStorePatOffsetOnly; @@ -513,11 +474,6 @@ Pat<(ty (kind (operand I32:$addr, imm:$off), ty:$val)), (inst 0, imm:$off, I32:$addr, ty:$val)>; -class BinRMWPatGlobalAddr : - Pat<(ty (kind (regPlusGA I32:$addr, (WebAssemblywrapper tglobaladdr:$off)), - ty:$val)), - (inst 0, tglobaladdr:$off, I32:$addr, ty:$val)>; - // Select binary RMWs with just a constant offset. class BinRMWPatOffsetOnly : Pat<(ty (kind imm:$off, ty:$val)), @@ -538,9 +494,6 @@ def : BinRMWPatImmOff; def : BinRMWPatImmOff; - def : BinRMWPatGlobalAddr; - def : BinRMWPatGlobalAddr; - def : BinRMWPatOffsetOnly; def : BinRMWPatOffsetOnly; @@ -635,17 +588,6 @@ def : BinRMWPatImmOff, or_is_add, inst8_64>; def : BinRMWPatImmOff, or_is_add, inst16_64>; - def : BinRMWPatGlobalAddr, inst8_32>; - def : BinRMWPatGlobalAddr, inst16_32>; - def : BinRMWPatGlobalAddr, inst8_64>; - def : BinRMWPatGlobalAddr, inst16_64>; - def : BinRMWPatGlobalAddr, inst32_64>; - - def : BinRMWPatGlobalAddr, inst8_32>; - def : BinRMWPatGlobalAddr, inst16_32>; - def : BinRMWPatGlobalAddr, inst8_64>; - def : BinRMWPatGlobalAddr, inst16_64>; - // Truncating-extending binary RMWs with just a constant offset def : BinRMWPatOffsetOnly, inst8_32>; def : BinRMWPatOffsetOnly, inst16_32>; @@ -745,11 +687,6 @@ Pat<(ty (kind (operand I32:$addr, imm:$off), ty:$exp, ty:$new)), (inst 0, imm:$off, I32:$addr, ty:$exp, ty:$new)>; -class TerRMWPatGlobalAddr : - Pat<(ty (kind (regPlusGA I32:$addr, (WebAssemblywrapper tglobaladdr:$off)), - ty:$exp, ty:$new)), - (inst 0, tglobaladdr:$off, I32:$addr, ty:$exp, ty:$new)>; - // Select ternary RMWs with just a constant offset. class TerRMWPatOffsetOnly : Pat<(ty (kind imm:$off, ty:$exp, ty:$new)), @@ -770,9 +707,6 @@ def : TerRMWPatImmOff; def : TerRMWPatImmOff; - def : TerRMWPatGlobalAddr; - def : TerRMWPatGlobalAddr; - def : TerRMWPatOffsetOnly; def : TerRMWPatOffsetOnly; @@ -859,17 +793,6 @@ def : TerRMWPatImmOff, or_is_add, inst8_64>; def : TerRMWPatImmOff, or_is_add, inst16_64>; - def : TerRMWPatGlobalAddr, inst8_32>; - def : TerRMWPatGlobalAddr, inst16_32>; - def : TerRMWPatGlobalAddr, inst8_64>; - def : TerRMWPatGlobalAddr, inst16_64>; - def : TerRMWPatGlobalAddr, inst32_64>; - - def : TerRMWPatGlobalAddr, inst8_32>; - def : TerRMWPatGlobalAddr, inst16_32>; - def : TerRMWPatGlobalAddr, inst8_64>; - def : TerRMWPatGlobalAddr, inst16_64>; - // Truncating-extending ternary RMWs with just a constant offset def : TerRMWPatOffsetOnly, inst8_32>; def : TerRMWPatOffsetOnly, inst16_32>; Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td +++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrMemory.td @@ -37,16 +37,6 @@ return (~Known0.Zero & ~Known1.Zero) == 0; }]>; -// GlobalAddresses are conceptually unsigned values, so we can also fold them -// into immediate values as long as the add is 'nuw'. -// TODO: We'd like to also match GA offsets but there are cases where the -// register can have a negative value. Find out what more we can do. -def regPlusGA : PatFrag<(ops node:$addr, node:$off), - (add node:$addr, node:$off), - [{ - return N->getFlags().hasNoUnsignedWrap(); -}]>; - // We don't need a regPlusES because external symbols never have constant // offsets folded into them, so we can just use add. @@ -93,15 +83,6 @@ def : LoadPatImmOff; def : LoadPatImmOff; -class LoadPatGlobalAddr : - Pat<(ty (kind (regPlusGA I32:$addr, (WebAssemblywrapper tglobaladdr:$off)))), - (inst 0, tglobaladdr:$off, I32:$addr)>, Requires<[IsNotPIC]>; - -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; - // Select loads with just a constant offset. class LoadPatOffsetOnly : Pat<(ty (kind imm:$off)), (inst 0, imm:$off, (CONST_I32 0))>; @@ -167,18 +148,6 @@ def : LoadPatImmOff; def : LoadPatImmOff; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; - -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; - // Select extending loads with just a constant offset. def : LoadPatOffsetOnly; def : LoadPatOffsetOnly; @@ -224,11 +193,6 @@ def : LoadPatImmOff; def : LoadPatImmOff; def : LoadPatImmOff; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; -def : LoadPatGlobalAddr; // Select "don't care" extending loads with just a constant offset. def : LoadPatOffsetOnly; @@ -282,15 +246,6 @@ def : StorePatImmOff; def : StorePatImmOff; -class StorePatGlobalAddr : - Pat<(kind ty:$val, - (regPlusGA I32:$addr, (WebAssemblywrapper tglobaladdr:$off))), - (inst 0, tglobaladdr:$off, I32:$addr, ty:$val)>, Requires<[IsNotPIC]>; -def : StorePatGlobalAddr; -def : StorePatGlobalAddr; -def : StorePatGlobalAddr; -def : StorePatGlobalAddr; - // Select stores with just a constant offset. class StorePatOffsetOnly : Pat<(kind ty:$val, imm:$off), (inst 0, imm:$off, (CONST_I32 0), ty:$val)>; @@ -333,12 +288,6 @@ def : StorePatImmOff; def : StorePatImmOff; -def : StorePatGlobalAddr; -def : StorePatGlobalAddr; -def : StorePatGlobalAddr; -def : StorePatGlobalAddr; -def : StorePatGlobalAddr; - // Select truncating stores with just a constant offset. def : StorePatOffsetOnly; def : StorePatOffsetOnly; Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td =================================================================== --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td +++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td @@ -56,7 +56,6 @@ def : LoadPatNoOffset("LOAD_"#vec_t)>; def : LoadPatImmOff("LOAD_"#vec_t)>; def : LoadPatImmOff("LOAD_"#vec_t)>; -def : LoadPatGlobalAddr("LOAD_"#vec_t)>; def : LoadPatOffsetOnly("LOAD_"#vec_t)>; def : LoadPatGlobalAddrOffOnly("LOAD_"#vec_t)>; } @@ -78,7 +77,6 @@ def : StorePatNoOffset("STORE_"#vec_t)>; def : StorePatImmOff("STORE_"#vec_t)>; def : StorePatImmOff("STORE_"#vec_t)>; -def : StorePatGlobalAddr("STORE_"#vec_t)>; def : StorePatOffsetOnly("STORE_"#vec_t)>; def : StorePatGlobalAddrOffOnly("STORE_"#vec_t)>; }