Nikita Popov a001e9718f [SimplifyLibCalls] Don't try to manually reprocess calls
The current code for reprocessing the result of fortified libcall
simplifications is not correct, because we might simplify to an
argument of the original call, and if that is again a libcall,
mistakenly think that this is actually the simplification result.

Instead of trying to fix this, simply remove the code entirely,
because InstCombine nowadays correctly handles reprocessing of
SimplifyLibCall results.

Fixes https://github.com/llvm/llvm-project/issues/77064.
2024-01-05 10:45:26 +01:00

19 lines
698 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt -S -passes=instcombine < %s | FileCheck %s
define void @main(ptr %ptr) {
; CHECK-LABEL: define void @main(
; CHECK-SAME: ptr [[PTR:%.*]]) {
; CHECK-NEXT: [[OPENDIR:%.*]] = call fastcc ptr @opendir(ptr [[PTR]])
; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(596) [[OPENDIR]], i8 0, i64 596, i1 false)
; CHECK-NEXT: ret void
;
%opendir = call fastcc ptr @opendir(ptr %ptr)
%memset = call ptr @__memset_chk(ptr %opendir, i32 0, i64 596, i64 -1)
ret void
}
declare ptr @__memset_chk(ptr, i32, i64, i64)
declare fastcc ptr @opendir(ptr)