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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to