Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions llvm/lib/Transforms/Scalar/NewGVN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1646,10 +1646,6 @@ NewGVN::performSymbolicPredicateInfoEvaluation(BitCastInst *I) const {
// Evaluate read only and pure calls, and create an expression result.
NewGVN::ExprResult NewGVN::performSymbolicCallEvaluation(Instruction *I) const {
auto *CI = cast<CallInst>(I);
if (auto *II = dyn_cast<IntrinsicInst>(I)) {
if (auto *ReturnedValue = II->getReturnedArgOperand())
return ExprResult::some(createVariableOrConstant(ReturnedValue));
}

// FIXME: Currently the calls which may access the thread id may
// be considered as not accessing the memory. But this is
Expand Down
21 changes: 21 additions & 0 deletions llvm/test/Transforms/NewGVN/pr159918.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -S -passes=newgvn < %s | FileCheck %s

; Don't use returned argument in memory defining intrinsics.
define void @wombat(ptr %arg) {
; CHECK-LABEL: define void @wombat(
; CHECK-SAME: ptr [[ARG:%.*]]) {
; CHECK-NEXT: [[LOAD:%.*]] = load ptr, ptr [[ARG]], align 8
; CHECK-NEXT: [[CALL:%.*]] = call ptr @llvm.objc.retain(ptr [[LOAD]])
; CHECK-NEXT: store ptr [[CALL]], ptr [[ARG]], align 8
; CHECK-NEXT: ret void
;
%load = load ptr, ptr %arg, align 8
%call = call ptr @llvm.objc.retain(ptr %load)
store ptr %call, ptr %arg, align 8
ret void
}

declare ptr @llvm.objc.retain(ptr returned) #0

attributes #0 = { nounwind }