diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp index 992cccac640506..990ab263352096 100644 --- a/clang/lib/Sema/SemaCoroutine.cpp +++ b/clang/lib/Sema/SemaCoroutine.cpp @@ -449,7 +449,8 @@ static ReadySuspendResumeResult buildCoawaitCalls(Sema &S, VarDecl *CoroPromise, if (!AwaitSuspend->getType()->isDependentType()) { // [expr.await]p3 [...] // - await-suspend is the expression e.await_suspend(h), which shall be - // a prvalue of type void or bool. + // a prvalue of type void, bool, or std::coroutine_handle for some + // type Z. QualType RetType = AwaitSuspend->getCallReturnType(S.Context); // Experimental support for coroutine_handle returning await_suspend. diff --git a/clang/test/Analysis/fuchsia_handle.cpp b/clang/test/Analysis/fuchsia_handle.cpp index dade5261bd78ee..d104b13c77abfa 100644 --- a/clang/test/Analysis/fuchsia_handle.cpp +++ b/clang/test/Analysis/fuchsia_handle.cpp @@ -77,7 +77,9 @@ void handleDieBeforeErrorSymbol01() { void handleDieBeforeErrorSymbol02() { zx_handle_t sa, sb; zx_status_t status = zx_channel_create(0, &sa, &sb); - // expected-note@-1 {{Handle allocated through 2nd parameter}} + // FIXME: There appears to be non-determinism in choosing + // which handle to report. + // expected-note-re@-3 {{Handle allocated through {{(2nd|3rd)}} parameter}} if (status == 0) { // expected-note {{Assuming 'status' is equal to 0}} // expected-note@-1 {{Taking true branch}} return; // expected-warning {{Potential leak of handle}} diff --git a/llvm/lib/IR/User.cpp b/llvm/lib/IR/User.cpp index 7da592f401273f..9105c6fbd230d6 100644 --- a/llvm/lib/IR/User.cpp +++ b/llvm/lib/IR/User.cpp @@ -29,7 +29,7 @@ void User::replaceUsesOfWith(Value *From, Value *To) { // The side effects of this setOperand call include linking to // "To", adding "this" to the uses list of To, and // most importantly, removing "this" from the use list of "From". - setOperand(i, To); // Fix it now... + setOperand(i, To); } } diff --git a/llvm/lib/Target/Hexagon/HexagonPatterns.td b/llvm/lib/Target/Hexagon/HexagonPatterns.td index cc10627955fb0f..c3422d595c7932 100644 --- a/llvm/lib/Target/Hexagon/HexagonPatterns.td +++ b/llvm/lib/Target/Hexagon/HexagonPatterns.td @@ -1082,9 +1082,9 @@ def FShl32r: OutPatFrag<(ops node:$Rs, node:$Rt, node:$Ru), (HiReg (S2_asl_r_p (Combinew $Rs, $Rt), $Ru))>; def FShl64i: OutPatFrag<(ops node:$Rs, node:$Rt, node:$S), - (S2_lsr_i_p_or (S2_asl_i_p $Rt, $S), $Rs, (Subi<64> $S))>; + (S2_lsr_i_p_or (S2_asl_i_p $Rs, $S), $Rt, (Subi<64> $S))>; def FShl64r: OutPatFrag<(ops node:$Rs, node:$Rt, node:$Ru), - (S2_lsr_r_p_or (S2_asl_r_p $Rt, $Ru), $Rs, (A2_subri 64, $Ru))>; + (S2_lsr_r_p_or (S2_asl_r_p $Rs, $Ru), $Rt, (A2_subri 64, $Ru))>; // Combined SDNodeXForm: (Divu8 (Subi<64> $S)) def Divu64_8: SDNodeXFormvalue_op_end(), (CI - 2) + 8); } +TEST(UserTest, replaceUseOfWith) { + LLVMContext C; + + const char *ModuleString = "define void @f(i32 %x) {\n" + "entry:\n" + " %v0 = add i32 1, 1\n" + " %v1 = add i32 %x, 2\n" + " ret void\n" + "}\n"; + SMDiagnostic Err; + std::unique_ptr M = parseAssemblyString(ModuleString, Err, C); + Function *F = M->getFunction("f"); + EXPECT_TRUE(F); + EXPECT_TRUE(F->arg_begin() != F->arg_end()); + BasicBlock& entryBB = F->front(); + Instruction& I0 = *(entryBB.begin()); + Instruction& I1 = *(++(entryBB.begin())); + + Argument &X = *F->arg_begin(); + EXPECT_EQ("x", X.getName()); + EXPECT_NE(X.user_begin() ,X.user_end()); + EXPECT_EQ(I0.user_begin() ,I0.user_end()); + + + auto XUser = find(X.users(), &(I1)); + EXPECT_NE(XUser, X.user_end()); + + XUser->replaceUsesOfWith(&X, &I0); + EXPECT_EQ(X.user_begin() ,X.user_end()); + EXPECT_NE(I0.user_begin() ,I0.user_end()); +} + TEST(UserTest, PersonalityUser) { LLVMContext Context; Module M("", Context);