1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/Transforms/InstCombine/early_constfold_changes_IR.ll
Bjorn Pettersson 28906b740e [InstCombine] Make sure AddReachableCodeToWorklist sets MadeIRChange
Summary:
Some optimizations in AddReachableCodeToWorklist did not update
the MadeIRChange state. This could happen both when removing
trivially dead instructions (DCE) and at constant folds.

It is essential that changes to the IR is reported correctly,
since for example InstCombinePass::run() will indicate that all
analyses are preserved otherwise.
And the CGPassManager determines if the CallGraph is up-to-date
based on status from InstructionCombiningPass::runOnFunction().

The new test case early_dce_clobbers_callgraph.ll is a reproducer
for some asserts that started to trigger after changes in the
inliner in r305245. With this patch the test case passes again.

Reviewers: sanjoy, craig.topper, dblaikie

Reviewed By: craig.topper

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34346

llvm-svn: 305725
2017-06-19 18:00:27 +00:00

21 lines
652 B
LLVM

; This run line verifies that we get the expected constant fold.
; RUN: opt < %s -instcombine -S | FileCheck %s
; This run line verifies that InstructionCombiningPass::runOnFunction reports
; this as a modification of the IR.
; RUN: opt < %s -instcombine -disable-output -debug-pass=Details 2>&1 | FileCheck %s --check-prefix=DETAILS
define i32 @foo(i32 %arg) #0 {
; CHECK-LABEL: @foo(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[AND:%.*]] = and i32 [[ARG:%.*]], 7
; CHECK-NEXT: ret i32 [[AND]]
;
entry:
%or = or i32 0, 7
%and = and i32 %arg, %or
ret i32 %and
}
; DETAILS: Made Modification 'Combine redundant instructions' on Function 'foo'