mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-22 23:39:24 +00:00
[AssumeBundles] preserve knowledge in DCE
Reviewers: jdoerfert Reviewed By: jdoerfert Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77403
This commit is contained in:
parent
086de7673e
commit
3bdfa966ec
@ -25,6 +25,7 @@
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/DebugCounter.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
#include "llvm/Transforms/Utils/AssumeBundleBuilder.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
#include "llvm/Transforms/Utils/Local.h"
|
||||
using namespace llvm;
|
||||
@ -127,6 +128,7 @@ static bool DCEInstruction(Instruction *I,
|
||||
return false;
|
||||
|
||||
salvageDebugInfo(*I);
|
||||
salvageKnowledge(I);
|
||||
|
||||
// Null out all of the instruction's operands to see if any operand becomes
|
||||
// dead as we go.
|
||||
|
11
llvm/test/Transforms/DCE/basic-preservation.ll
Normal file
11
llvm/test/Transforms/DCE/basic-preservation.ll
Normal file
@ -0,0 +1,11 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -dce -S --enable-knowledge-retention < %s | FileCheck %s
|
||||
|
||||
define void @test(i32* %P) {
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK-NEXT: call void @llvm.assume(i1 true) [ "dereferenceable"(i32* [[P:%.*]], i64 4), "nonnull"(i32* [[P]]) ]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%a = load i32, i32* %P
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user