@@ -2359,20 +2359,20 @@ static Instruction *foldSelectCmpBitcasts(SelectInst &Sel,
2359
2359
// / operand, the result of the select will always be equal to its false value.
2360
2360
// / For example:
2361
2361
// /
2362
- // / %0 = cmpxchg i64* %ptr, i64 %compare, i64 %new_value seq_cst seq_cst
2363
- // / %1 = extractvalue { i64, i1 } %0, 1
2364
- // / %2 = extractvalue { i64, i1 } %0, 0
2365
- // / %3 = select i1 %1 , i64 %compare, i64 %2
2366
- // / ret i64 %3
2362
+ // / %cmpxchg = cmpxchg ptr %ptr, i64 %compare, i64 %new_value seq_cst seq_cst
2363
+ // / %val = extractvalue { i64, i1 } %cmpxchg, 0
2364
+ // / %success = extractvalue { i64, i1 } %cmpxchg, 1
2365
+ // / %sel = select i1 %success , i64 %compare, i64 %val
2366
+ // / ret i64 %sel
2367
2367
// /
2368
- // / The returned value of the cmpxchg instruction (%2 ) is the original value
2369
- // / located at %ptr prior to any update. If the cmpxchg operation succeeds, %2
2368
+ // / The returned value of the cmpxchg instruction (%val ) is the original value
2369
+ // / located at %ptr prior to any update. If the cmpxchg operation succeeds, %val
2370
2370
// / must have been equal to %compare. Thus, the result of the select is always
2371
- // / equal to %2 , and the code can be simplified to:
2371
+ // / equal to %val , and the code can be simplified to:
2372
2372
// /
2373
- // / %0 = cmpxchg i64* %ptr, i64 %compare, i64 %new_value seq_cst seq_cst
2374
- // / %1 = extractvalue { i64, i1 } %0 , 0
2375
- // / ret i64 %1
2373
+ // / %cmpxchg = cmpxchg ptr %ptr, i64 %compare, i64 %new_value seq_cst seq_cst
2374
+ // / %val = extractvalue { i64, i1 } %cmpxchg , 0
2375
+ // / ret i64 %val
2376
2376
// /
2377
2377
static Value *foldSelectCmpXchg (SelectInst &SI) {
2378
2378
// A helper that determines if V is an extractvalue instruction whose
0 commit comments