[llvm-bugs] [Bug 51211] New: [SimplifyCFG] Chain of comparisons no longer flattened

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 25 13:25:25 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=51211

            Bug ID: 51211
           Summary: [SimplifyCFG] Chain of comparisons no longer flattened
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nikita.ppv at gmail.com
                CC: lebedev.ri at gmail.com, llvm-bugs at lists.llvm.org

For the following Rust code:

pub struct Blueprint {
    pub fuel_tank_size: u32,
    pub payload: u32,
    pub wheel_diameter: u32,
    pub wheel_width: u32,
}
impl PartialEq for Blueprint{
    fn eq(&self, other: &Self) -> bool {
       self.fuel_tank_size == other.fuel_tank_size
            && self.payload == other.payload
            && self.wheel_diameter == other.wheel_diameter
            && self.wheel_width == other.wheel_width
    }
}

LLVM 12 managed to compile this to a nice <4 x i32> comparison, while in LLVM
13 this is a sequence of i32 comparisons with two branches sitting in between.

Here is an end-to-end IR test case: https://llvm.godbolt.org/z/59cT1coT6

The relevant difference is that SimplifyCFG no longer fully flattens the
control flow in this case.

Here is just the -simplifycfg part: https://llvm.godbolt.org/z/zfd9Ybx58

I haven't checked what change caused this yet.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210725/d42b8a14/attachment.html>


More information about the llvm-bugs mailing list