1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s 2*9880d681SAndroid Build Coastguard Worker; REQUIRES: default_triple 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; This used to cause a crash. A standard load is converted to a pre-increment 5*9880d681SAndroid Build Coastguard Worker; load. Later the pre-increment load is combined with a subsequent SRL to 6*9880d681SAndroid Build Coastguard Worker; produce a smaller load. This transform invalidly created a standard load 7*9880d681SAndroid Build Coastguard Worker; and propagated the produced value into uses of both produced values of the 8*9880d681SAndroid Build Coastguard Worker; pre-increment load. The result was a crash when attempting to process an 9*9880d681SAndroid Build Coastguard Worker; add with a token-chain operand. 10*9880d681SAndroid Build Coastguard Worker 11*9880d681SAndroid Build Coastguard Worker%struct.Info = type { i32, i32, i8*, i8*, i8*, [32 x i8*], i64, [32 x i64], i64, i64, i64, [32 x i64] } 12*9880d681SAndroid Build Coastguard Worker%struct.S1847 = type { [12 x i8], [4 x i8], [8 x i8], [4 x i8], [8 x i8], [2 x i8], i8, [4 x i64], i8, [3 x i8], [4 x i8], i8, i16, [4 x %struct.anon.76], i16, i8, i8* } 13*9880d681SAndroid Build Coastguard Worker%struct.anon.76 = type { i32 } 14*9880d681SAndroid Build Coastguard Worker@info = common global %struct.Info zeroinitializer, align 8 15*9880d681SAndroid Build Coastguard Worker@fails = common global i32 0, align 4 16*9880d681SAndroid Build Coastguard Worker@a1847 = external global [5 x %struct.S1847] 17*9880d681SAndroid Build Coastguard Workerdefine void @test1847() nounwind { 18*9880d681SAndroid Build Coastguard Workerentry: 19*9880d681SAndroid Build Coastguard Worker %j = alloca i32, align 4 20*9880d681SAndroid Build Coastguard Worker %0 = load i64, i64* getelementptr inbounds (%struct.Info, %struct.Info* @info, i32 0, i32 8), align 8 21*9880d681SAndroid Build Coastguard Worker %1 = load i32, i32* @fails, align 4 22*9880d681SAndroid Build Coastguard Worker %bf.load1 = load i96, i96* bitcast (%struct.S1847* getelementptr inbounds ([5 x %struct.S1847], [5 x %struct.S1847]* @a1847, i32 0, i64 2) to i96*), align 8 23*9880d681SAndroid Build Coastguard Worker %bf.clear2 = and i96 %bf.load1, 302231454903657293676543 24*9880d681SAndroid Build Coastguard Worker %bf.set3 = or i96 %bf.clear2, -38383394772764476296921088 25*9880d681SAndroid Build Coastguard Worker store i96 %bf.set3, i96* bitcast (%struct.S1847* getelementptr inbounds ([5 x %struct.S1847], [5 x %struct.S1847]* @a1847, i32 0, i64 2) to i96*), align 8 26*9880d681SAndroid Build Coastguard Worker %2 = load i32, i32* %j, align 4 27*9880d681SAndroid Build Coastguard Worker %3 = load i32, i32* %j, align 4 28*9880d681SAndroid Build Coastguard Worker %inc11 = add nsw i32 %3, 1 29*9880d681SAndroid Build Coastguard Worker store i32 %inc11, i32* %j, align 4 30*9880d681SAndroid Build Coastguard Worker %bf.load15 = load i96, i96* bitcast (%struct.S1847* getelementptr inbounds ([5 x %struct.S1847], [5 x %struct.S1847]* @a1847, i32 0, i64 2) to i96*), align 8 31*9880d681SAndroid Build Coastguard Worker %bf.clear16 = and i96 %bf.load15, -18446744069414584321 32*9880d681SAndroid Build Coastguard Worker %bf.set17 = or i96 %bf.clear16, 18446743532543672320 33*9880d681SAndroid Build Coastguard Worker store i96 %bf.set17, i96* bitcast (%struct.S1847* getelementptr inbounds ([5 x %struct.S1847], [5 x %struct.S1847]* @a1847, i32 0, i64 2) to i96*), align 8 34*9880d681SAndroid Build Coastguard Worker ret void 35*9880d681SAndroid Build Coastguard Worker} 36