Skip to content

Commit ec16f44

Browse files
committed
[InstCombine] Use named values in comment (NFC)
Also use opaque pointers.
1 parent ad9fe3b commit ec16f44

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,20 +2359,20 @@ static Instruction *foldSelectCmpBitcasts(SelectInst &Sel,
23592359
/// operand, the result of the select will always be equal to its false value.
23602360
/// For example:
23612361
///
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
23672367
///
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
23702370
/// 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:
23722372
///
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
23762376
///
23772377
static Value *foldSelectCmpXchg(SelectInst &SI) {
23782378
// A helper that determines if V is an extractvalue instruction whose

0 commit comments

Comments
 (0)